@widergy/mobile-ui 1.50.0 → 1.51.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/UTCuit/constants.js +8 -0
- package/lib/components/UTCuit/index.js +191 -0
- package/lib/components/UTCuit/styles.js +33 -0
- package/lib/components/UTHeader/index.js +17 -9
- package/lib/components/UTModal/index.js +2 -3
- package/lib/components/UTModal/styles.js +1 -2
- package/lib/components/UTTopbar/index.js +8 -3
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/components/ActionButton/index.js +4 -2
- package/lib/components/UTWorkflowContainer/versions/V1/components/BottomActions/index.js +15 -2
- package/lib/constants/testIds.js +30 -7
- package/lib/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.51.0](https://github.com/widergy/mobile-ui/compare/v1.50.1...v1.51.0) (2025-09-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [AUTO-47] Testids for workflowContainer components ([#452](https://github.com/widergy/mobile-ui/issues/452)) ([1fc2bb5](https://github.com/widergy/mobile-ui/commit/1fc2bb5893380f26186e0d089832b88668b91182))
|
|
7
|
+
|
|
8
|
+
## [1.50.1](https://github.com/widergy/mobile-ui/compare/v1.50.0...v1.50.1) (2025-09-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [CX-1130] UTCuit Field Refactor ([#456](https://github.com/widergy/mobile-ui/issues/456)) ([19cce9d](https://github.com/widergy/mobile-ui/commit/19cce9dc619a04044b662cb3e359dd755c5c4715))
|
|
14
|
+
|
|
1
15
|
# [1.50.0](https://github.com/widergy/mobile-ui/compare/v1.49.7...v1.50.0) (2025-08-12)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { bool, func, oneOf, oneOfType, string } from 'prop-types';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import UTLabel from '../UTLabel';
|
|
6
|
+
import UTTextInput from '../UTTextInput';
|
|
7
|
+
|
|
8
|
+
import styles from './styles';
|
|
9
|
+
import { ID_CODE_REGEX, PREFIX_LENGTH, DOCUMENT_LENGTH, TITLE } from './constants';
|
|
10
|
+
|
|
11
|
+
const UTCuit = ({
|
|
12
|
+
blurOnSubmit,
|
|
13
|
+
defaultValue,
|
|
14
|
+
editable = true,
|
|
15
|
+
editableDocument = true,
|
|
16
|
+
formError,
|
|
17
|
+
onBlur,
|
|
18
|
+
onChange,
|
|
19
|
+
onFocus,
|
|
20
|
+
onSubmitEditing,
|
|
21
|
+
returnKeyType = 'done',
|
|
22
|
+
title,
|
|
23
|
+
value
|
|
24
|
+
}) => {
|
|
25
|
+
const prefixRef = useRef();
|
|
26
|
+
const documentNumberRef = useRef();
|
|
27
|
+
const suffixRef = useRef();
|
|
28
|
+
|
|
29
|
+
const [documentNumber, setDocumentNumber] = useState('');
|
|
30
|
+
const [prefix, setPrefix] = useState('');
|
|
31
|
+
const [suffix, setSuffix] = useState('');
|
|
32
|
+
|
|
33
|
+
const valuesRef = useRef({ prefix: '', documentNumber: '', suffix: '' });
|
|
34
|
+
const isInitialized = useRef(false);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!isInitialized.current) {
|
|
38
|
+
const initialValue = value || defaultValue || '';
|
|
39
|
+
const code = initialValue.match(ID_CODE_REGEX);
|
|
40
|
+
|
|
41
|
+
let initialPrefix = '';
|
|
42
|
+
let initialDocNumber = '';
|
|
43
|
+
let initialSuffix = '';
|
|
44
|
+
|
|
45
|
+
if (code) {
|
|
46
|
+
if (code.length === 3) [initialPrefix, initialDocNumber, initialSuffix] = code;
|
|
47
|
+
else [initialDocNumber] = code;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const formattedDocumentNumber = !editableDocument
|
|
51
|
+
? `${'0'.repeat(DOCUMENT_LENGTH - initialDocNumber.length)}${initialDocNumber}`
|
|
52
|
+
: initialDocNumber;
|
|
53
|
+
|
|
54
|
+
setDocumentNumber(formattedDocumentNumber);
|
|
55
|
+
setPrefix(initialPrefix);
|
|
56
|
+
setSuffix(initialSuffix);
|
|
57
|
+
|
|
58
|
+
valuesRef.current = {
|
|
59
|
+
prefix: initialPrefix,
|
|
60
|
+
documentNumber: formattedDocumentNumber,
|
|
61
|
+
suffix: initialSuffix
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
isInitialized.current = true;
|
|
65
|
+
}
|
|
66
|
+
}, [value, defaultValue, editableDocument]);
|
|
67
|
+
|
|
68
|
+
const changeDocumentNumber = newDocumentNumber => {
|
|
69
|
+
if (editableDocument) {
|
|
70
|
+
setDocumentNumber(newDocumentNumber);
|
|
71
|
+
valuesRef.current.documentNumber = newDocumentNumber;
|
|
72
|
+
if (onChange) {
|
|
73
|
+
onChange(`${valuesRef.current.prefix}-${newDocumentNumber}-${valuesRef.current.suffix}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const changePrefix = newPrefix => {
|
|
79
|
+
if (newPrefix.length === 1 && !['2', '3'].includes(newPrefix)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (newPrefix.length === 2 && !/^[23][0-9]$/.test(newPrefix)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
setPrefix(newPrefix);
|
|
87
|
+
valuesRef.current.prefix = newPrefix;
|
|
88
|
+
if (onChange) {
|
|
89
|
+
onChange(`${newPrefix}-${valuesRef.current.documentNumber}-${valuesRef.current.suffix}`);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const changeSuffix = newSuffix => {
|
|
94
|
+
setSuffix(newSuffix);
|
|
95
|
+
valuesRef.current.suffix = newSuffix;
|
|
96
|
+
if (onChange) {
|
|
97
|
+
onChange(`${valuesRef.current.prefix}-${valuesRef.current.documentNumber}-${newSuffix}`);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const handleBlur = () => {
|
|
102
|
+
if (onBlur) {
|
|
103
|
+
onBlur();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<View style={styles.container}>
|
|
109
|
+
<UTLabel variant="medium" style={styles.title}>
|
|
110
|
+
{title || TITLE}
|
|
111
|
+
</UTLabel>
|
|
112
|
+
<View style={styles.fieldContainer}>
|
|
113
|
+
<View style={styles.input}>
|
|
114
|
+
<UTTextInput
|
|
115
|
+
alwaysShowPlaceholder
|
|
116
|
+
blurOnSubmit={blurOnSubmit}
|
|
117
|
+
disabled={!editable}
|
|
118
|
+
error={!!formError && ' '}
|
|
119
|
+
inputRef={prefixRef}
|
|
120
|
+
maxLength={PREFIX_LENGTH}
|
|
121
|
+
onBlur={handleBlur}
|
|
122
|
+
onChange={changePrefix}
|
|
123
|
+
onFocus={onFocus}
|
|
124
|
+
placeholder="XX"
|
|
125
|
+
returnKeyType={returnKeyType}
|
|
126
|
+
type="numeric"
|
|
127
|
+
value={prefix}
|
|
128
|
+
version="V1"
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
<View style={styles.documentContainer}>
|
|
132
|
+
<UTTextInput
|
|
133
|
+
alwaysShowPlaceholder
|
|
134
|
+
blurOnSubmit={blurOnSubmit}
|
|
135
|
+
disabled={!editable || !editableDocument}
|
|
136
|
+
error={!!formError && ' '}
|
|
137
|
+
inputRef={documentNumberRef}
|
|
138
|
+
maxLength={DOCUMENT_LENGTH}
|
|
139
|
+
onBlur={handleBlur}
|
|
140
|
+
onChange={changeDocumentNumber}
|
|
141
|
+
onFocus={onFocus}
|
|
142
|
+
placeholder="XXXXXXXX"
|
|
143
|
+
returnKeyType={returnKeyType}
|
|
144
|
+
type="numeric"
|
|
145
|
+
value={documentNumber}
|
|
146
|
+
version="V1"
|
|
147
|
+
/>
|
|
148
|
+
</View>
|
|
149
|
+
<View style={styles.input}>
|
|
150
|
+
<UTTextInput
|
|
151
|
+
alwaysShowPlaceholder
|
|
152
|
+
blurOnSubmit={blurOnSubmit}
|
|
153
|
+
disabled={!editable}
|
|
154
|
+
error={!!formError && ' '}
|
|
155
|
+
inputRef={suffixRef}
|
|
156
|
+
maxLength={1}
|
|
157
|
+
onBlur={handleBlur}
|
|
158
|
+
onChange={changeSuffix}
|
|
159
|
+
onFocus={onFocus}
|
|
160
|
+
onSubmitEditing={onSubmitEditing}
|
|
161
|
+
placeholder="X"
|
|
162
|
+
returnKeyType={returnKeyType}
|
|
163
|
+
type="numeric"
|
|
164
|
+
value={suffix}
|
|
165
|
+
version="V1"
|
|
166
|
+
/>
|
|
167
|
+
</View>
|
|
168
|
+
</View>
|
|
169
|
+
<UTLabel colorTheme="error" variant="xsmall" style={styles.error}>
|
|
170
|
+
{formError || ''}
|
|
171
|
+
</UTLabel>
|
|
172
|
+
</View>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
UTCuit.propTypes = {
|
|
177
|
+
blurOnSubmit: bool,
|
|
178
|
+
defaultValue: string,
|
|
179
|
+
editable: bool,
|
|
180
|
+
editableDocument: bool,
|
|
181
|
+
formError: oneOfType([string, bool]),
|
|
182
|
+
onBlur: func,
|
|
183
|
+
onChange: func.isRequired,
|
|
184
|
+
onFocus: func,
|
|
185
|
+
onSubmitEditing: func,
|
|
186
|
+
returnKeyType: oneOf(['done', 'go', 'next', 'search']),
|
|
187
|
+
title: string,
|
|
188
|
+
value: string
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export default UTCuit;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export default StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: 'column'
|
|
6
|
+
},
|
|
7
|
+
title: {
|
|
8
|
+
marginBottom: 8
|
|
9
|
+
},
|
|
10
|
+
fieldContainer: {
|
|
11
|
+
alignItems: 'flex-end',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
marginTop: 6
|
|
14
|
+
},
|
|
15
|
+
documentContainer: {
|
|
16
|
+
flex: 2,
|
|
17
|
+
paddingHorizontal: 4
|
|
18
|
+
},
|
|
19
|
+
input: {
|
|
20
|
+
flex: 1
|
|
21
|
+
},
|
|
22
|
+
inputContainer: {
|
|
23
|
+
flex: 1
|
|
24
|
+
},
|
|
25
|
+
message: {
|
|
26
|
+
paddingTop: 15,
|
|
27
|
+
marginBottom: -25
|
|
28
|
+
},
|
|
29
|
+
error: {
|
|
30
|
+
marginBottom: 12,
|
|
31
|
+
marginTop: 12
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -3,12 +3,15 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { string, bool, shape } from 'prop-types';
|
|
4
4
|
import merge from 'lodash/merge';
|
|
5
5
|
|
|
6
|
+
import { TEST_IDS } from '../../constants/testIds';
|
|
6
7
|
import UTLabel from '../UTLabel';
|
|
7
8
|
import UTBanner from '../UTBanner';
|
|
8
9
|
import { useTheme } from '../../theming';
|
|
9
10
|
|
|
10
11
|
import ownStyles from './styles';
|
|
11
12
|
|
|
13
|
+
const { workflowContainer } = TEST_IDS;
|
|
14
|
+
|
|
12
15
|
const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMarkdown, banner, style }) => {
|
|
13
16
|
const theme = useTheme();
|
|
14
17
|
const themedStyles = merge({}, ownStyles, theme?.UTHeader, style);
|
|
@@ -19,11 +22,12 @@ const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMa
|
|
|
19
22
|
const Tagline = renderComponent(
|
|
20
23
|
tagline,
|
|
21
24
|
<UTLabel
|
|
25
|
+
colorTheme={themedStyles.taglineColor || 'gray'}
|
|
26
|
+
dataTestId={workflowContainer.header.tagline}
|
|
27
|
+
style={[themedStyles.child, themedStyles.tagline]}
|
|
22
28
|
variant="small"
|
|
23
29
|
weight="medium"
|
|
24
|
-
colorTheme={themedStyles.taglineColor || 'gray'}
|
|
25
30
|
withMarkdown={useMarkdown}
|
|
26
|
-
style={[themedStyles.child, themedStyles.tagline]}
|
|
27
31
|
>
|
|
28
32
|
{tagline?.toUpperCase?.()}
|
|
29
33
|
</UTLabel>
|
|
@@ -32,10 +36,11 @@ const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMa
|
|
|
32
36
|
const Title = renderComponent(
|
|
33
37
|
title,
|
|
34
38
|
<UTLabel
|
|
35
|
-
variant="title3"
|
|
36
|
-
weight="medium"
|
|
37
39
|
colorTheme={themedStyles.titleColor}
|
|
40
|
+
dataTestId={workflowContainer.header.title}
|
|
38
41
|
style={themedStyles.title}
|
|
42
|
+
variant="title3"
|
|
43
|
+
weight="medium"
|
|
39
44
|
withMarkdown={useMarkdown}
|
|
40
45
|
>
|
|
41
46
|
{title}
|
|
@@ -46,8 +51,9 @@ const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMa
|
|
|
46
51
|
subtitle,
|
|
47
52
|
<UTLabel
|
|
48
53
|
colorTheme={themedStyles.subtitleColor || 'gray'}
|
|
49
|
-
|
|
54
|
+
dataTestId={workflowContainer.header.subtitle}
|
|
50
55
|
style={[themedStyles.child, themedStyles.subtitle]}
|
|
56
|
+
withMarkdown={useMarkdown}
|
|
51
57
|
>
|
|
52
58
|
{subtitle}
|
|
53
59
|
</UTLabel>
|
|
@@ -56,10 +62,11 @@ const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMa
|
|
|
56
62
|
const RequiredFieldInfo = renderComponent(
|
|
57
63
|
requiredFieldInfo,
|
|
58
64
|
<UTLabel
|
|
59
|
-
variant="small"
|
|
60
65
|
colorTheme={themedStyles.requiredFieldInfoColor || 'gray'}
|
|
61
|
-
|
|
66
|
+
dataTestId={workflowContainer.header.requiredFieldInfo}
|
|
67
|
+
variant="small"
|
|
62
68
|
style={[themedStyles.child, themedStyles.requiredFieldInfo]}
|
|
69
|
+
withMarkdown={useMarkdown}
|
|
63
70
|
>
|
|
64
71
|
{requiredFieldInfo}
|
|
65
72
|
</UTLabel>
|
|
@@ -68,10 +75,11 @@ const UTHeader = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMa
|
|
|
68
75
|
const HelpText = renderComponent(
|
|
69
76
|
helpText,
|
|
70
77
|
<UTLabel
|
|
71
|
-
variant="small"
|
|
72
78
|
colorTheme={themedStyles.helpTextColor || theme.colors.disabled}
|
|
73
|
-
|
|
79
|
+
dataTestId={workflowContainer.header.helpText}
|
|
74
80
|
style={[themedStyles.child, themedStyles.helpText]}
|
|
81
|
+
variant="small"
|
|
82
|
+
withMarkdown={useMarkdown}
|
|
75
83
|
>
|
|
76
84
|
{helpText}
|
|
77
85
|
</UTLabel>
|
|
@@ -115,11 +115,10 @@ const UTModal = ({
|
|
|
115
115
|
<View style={[styles.headerContainer, !!title && styles.closeButtonContainer]}>
|
|
116
116
|
{!!title && (
|
|
117
117
|
<UTLabel
|
|
118
|
-
style={styles.title }
|
|
119
|
-
variant="title3"
|
|
120
|
-
weight="medium"
|
|
121
118
|
dataTestId={`${dataTestId}.${titleTestId}`}
|
|
122
119
|
style={styles.title}
|
|
120
|
+
variant="title3"
|
|
121
|
+
weight="medium"
|
|
123
122
|
>
|
|
124
123
|
{title}
|
|
125
124
|
</UTLabel>
|
|
@@ -51,7 +51,6 @@ export default StyleSheet.create({
|
|
|
51
51
|
closeButton: {
|
|
52
52
|
alignSelf: 'flex-end'
|
|
53
53
|
},
|
|
54
|
-
title: { flex: 1 },
|
|
55
54
|
imageContainer: {
|
|
56
55
|
alignItems: 'center',
|
|
57
56
|
height: verticalScale(35),
|
|
@@ -61,7 +60,7 @@ export default StyleSheet.create({
|
|
|
61
60
|
keyboardAvoidingView: {
|
|
62
61
|
flex: 1
|
|
63
62
|
},
|
|
64
|
-
title:{
|
|
63
|
+
title: {
|
|
65
64
|
flexShrink: 1
|
|
66
65
|
}
|
|
67
66
|
});
|
|
@@ -3,6 +3,7 @@ import { BackHandler, View } from 'react-native';
|
|
|
3
3
|
import { number } from 'prop-types';
|
|
4
4
|
import { useFocusEffect } from '@react-navigation/native';
|
|
5
5
|
|
|
6
|
+
import { TEST_IDS } from '../../constants/testIds';
|
|
6
7
|
import UTButton from '../UTButton';
|
|
7
8
|
import UTStepper from '../UTStepper';
|
|
8
9
|
import UTProgressBar from '../UTProgressBar';
|
|
@@ -12,6 +13,8 @@ import UTLabel from '../UTLabel';
|
|
|
12
13
|
import ownStyles, { BAR_HEIGHT } from './styles';
|
|
13
14
|
import { TopbarPropTypes } from './types';
|
|
14
15
|
|
|
16
|
+
const { goBack: goBackTestId, title: titleTestId } = TEST_IDS.topbar;
|
|
17
|
+
|
|
15
18
|
const UTTopbar = ({
|
|
16
19
|
currentStage,
|
|
17
20
|
currentStep,
|
|
@@ -41,18 +44,20 @@ const UTTopbar = ({
|
|
|
41
44
|
<View>
|
|
42
45
|
<View style={[ownStyles.container, ownTheme?.container]}>
|
|
43
46
|
<UTButton
|
|
47
|
+
dataTestId={goBackTestId}
|
|
44
48
|
Icon={Icon || 'IconArrowLeft'}
|
|
45
|
-
|
|
49
|
+
onPress={goBack}
|
|
46
50
|
style={{
|
|
47
51
|
root: ownStyles.goBack
|
|
48
52
|
}}
|
|
49
|
-
|
|
53
|
+
variant="text"
|
|
50
54
|
/>
|
|
51
55
|
<UTLabel
|
|
52
56
|
colorTheme={ownTheme?.text || 'dark'}
|
|
57
|
+
dataTestId={titleTestId}
|
|
58
|
+
style={ownStyles.child}
|
|
53
59
|
variant="subtitle1"
|
|
54
60
|
weight="medium"
|
|
55
|
-
style={ownStyles.child}
|
|
56
61
|
>
|
|
57
62
|
{title}
|
|
58
63
|
</UTLabel>
|
|
@@ -8,7 +8,7 @@ import { useTheme } from '../../../../../../../../theming';
|
|
|
8
8
|
|
|
9
9
|
import ownStyles from './styles';
|
|
10
10
|
|
|
11
|
-
const ActionButton = ({ colorTheme, disabled, hidden, label, onPress, style, variant, icon }) => {
|
|
11
|
+
const ActionButton = ({ colorTheme, dataTestId, disabled, hidden, label, onPress, style, variant, icon }) => {
|
|
12
12
|
const theme = useTheme();
|
|
13
13
|
const themedStyles = merge({}, ownStyles, theme?.UTWorkflowContainer?.actionButton, style);
|
|
14
14
|
|
|
@@ -16,12 +16,13 @@ const ActionButton = ({ colorTheme, disabled, hidden, label, onPress, style, var
|
|
|
16
16
|
<View style={themedStyles.actionButton}>
|
|
17
17
|
<UTButton
|
|
18
18
|
colorTheme={colorTheme}
|
|
19
|
+
dataTestId={dataTestId}
|
|
19
20
|
disabled={disabled || hidden}
|
|
21
|
+
Icon={icon}
|
|
20
22
|
onPress={onPress}
|
|
21
23
|
size="large"
|
|
22
24
|
style={{ root: themedStyles.buttonContainer, childrenContainer: themedStyles.buttonContent }}
|
|
23
25
|
variant={variant}
|
|
24
|
-
Icon={icon}
|
|
25
26
|
>
|
|
26
27
|
{label}
|
|
27
28
|
</UTButton>
|
|
@@ -31,6 +32,7 @@ const ActionButton = ({ colorTheme, disabled, hidden, label, onPress, style, var
|
|
|
31
32
|
|
|
32
33
|
ActionButton.propTypes = {
|
|
33
34
|
colorTheme: string,
|
|
35
|
+
dataTestId: string,
|
|
34
36
|
disabled: bool,
|
|
35
37
|
hidden: bool,
|
|
36
38
|
icon: string,
|
|
@@ -3,6 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import merge from 'lodash/merge';
|
|
4
4
|
import { number } from 'prop-types';
|
|
5
5
|
|
|
6
|
+
import { TEST_IDS } from '../../../../../../constants/testIds';
|
|
6
7
|
import UTLabel from '../../../../../UTLabel';
|
|
7
8
|
import Surface from '../../../../../Surface';
|
|
8
9
|
import UTIcon from '../../../../../UTIcon';
|
|
@@ -16,6 +17,8 @@ import ActionButtonPropTypes from './components/ActionButton/types';
|
|
|
16
17
|
import ownStyles from './styles';
|
|
17
18
|
import { NEXT, RETURN } from './constants';
|
|
18
19
|
|
|
20
|
+
const { workflowContainer } = TEST_IDS;
|
|
21
|
+
|
|
19
22
|
const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summary, style }) => {
|
|
20
23
|
const messageIcon = message?.Icon;
|
|
21
24
|
const MESSAGE_ICON_SIZE = 16;
|
|
@@ -28,7 +31,10 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
|
|
|
28
31
|
return (
|
|
29
32
|
<Surface position="top" style={[themedStyles.bottomNav, themedStyles.bottomSafeArea(bottomSafeArea)]}>
|
|
30
33
|
{summary && (
|
|
31
|
-
<View
|
|
34
|
+
<View
|
|
35
|
+
testID={workflowContainer.bottomActions.summary}
|
|
36
|
+
style={[themedStyles.summary, checkboxProps && themedStyles.summaryCheckbox]}
|
|
37
|
+
>
|
|
32
38
|
{checkboxProps ? (
|
|
33
39
|
<Checkbox {...checkboxProps} />
|
|
34
40
|
) : (
|
|
@@ -75,7 +81,12 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
|
|
|
75
81
|
themedStyles[`message${message.variant?.charAt(0).toUpperCase()}${message.variant?.slice(1)}`]
|
|
76
82
|
]}
|
|
77
83
|
>
|
|
78
|
-
<UTLabel
|
|
84
|
+
<UTLabel
|
|
85
|
+
colorTheme="negative"
|
|
86
|
+
dataTestId={workflowContainer.bottomActions.message}
|
|
87
|
+
style={themedStyles.messageChild}
|
|
88
|
+
weight="medium"
|
|
89
|
+
>
|
|
79
90
|
{message.title}
|
|
80
91
|
</UTLabel>
|
|
81
92
|
{messageIcon && <UTIcon colorTheme="negative" name={messageIcon} size={MESSAGE_ICON_SIZE} />}
|
|
@@ -84,6 +95,7 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
|
|
|
84
95
|
<View style={themedStyles.actionsContainer}>
|
|
85
96
|
{returnButtonEnabled && (
|
|
86
97
|
<ActionButton
|
|
98
|
+
dataTestId={workflowContainer.bottomActions.returnButton}
|
|
87
99
|
label={returnButton.label || RETURN}
|
|
88
100
|
variant="text"
|
|
89
101
|
style={{
|
|
@@ -98,6 +110,7 @@ const BottomActions = ({ bottomSafeArea, message, nextButton, returnButton, summ
|
|
|
98
110
|
)}
|
|
99
111
|
{nextButtonEnabled && (
|
|
100
112
|
<ActionButton
|
|
113
|
+
dataTestId={workflowContainer.bottomActions.nextButton}
|
|
101
114
|
label={nextButton.label || NEXT}
|
|
102
115
|
style={{
|
|
103
116
|
actionButton: themedStyles.nextActionButton,
|
package/lib/constants/testIds.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export const TEST_IDS = {
|
|
2
|
-
modal: 'modal',
|
|
3
|
-
roundView: 'roundView',
|
|
4
|
-
skeletonLoader: 'skeletonLoader'
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
export const TEST_ID_CONSTANTS = {
|
|
8
2
|
acceptButton: 'acceptButton',
|
|
9
3
|
additionalInfo: 'additionalInfo',
|
|
@@ -11,6 +5,7 @@ export const TEST_ID_CONSTANTS = {
|
|
|
11
5
|
areaCode: 'areaCode',
|
|
12
6
|
attribution: 'attribution',
|
|
13
7
|
badge: 'badge',
|
|
8
|
+
bottomActions: 'bottomActions',
|
|
14
9
|
cancelButton: 'cancelButton',
|
|
15
10
|
characterCount: 'characterCount',
|
|
16
11
|
checkIcon: 'checkIcon',
|
|
@@ -31,15 +26,43 @@ export const TEST_ID_CONSTANTS = {
|
|
|
31
26
|
primaryAction: 'primaryAction',
|
|
32
27
|
required: 'required',
|
|
33
28
|
right: 'right',
|
|
29
|
+
requiredFieldInfo: 'requiredFieldInfo',
|
|
34
30
|
searchInput: 'searchInput',
|
|
35
31
|
secondaryAction: 'secondaryAction',
|
|
36
32
|
selectAll: 'selectAll',
|
|
37
33
|
subLabel: 'subLabel',
|
|
38
34
|
subtitle: 'subtitle',
|
|
35
|
+
tagline: 'tagline',
|
|
39
36
|
tertiaryAction: 'tertiaryAction',
|
|
40
37
|
text: 'text',
|
|
41
38
|
title: 'title',
|
|
42
39
|
titleText: 'titleText',
|
|
43
40
|
tooltip: 'tooltip',
|
|
44
|
-
validation: 'validation'
|
|
41
|
+
validation: 'validation',
|
|
42
|
+
workflowContainer: 'workflowContainer'
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const TEST_IDS = {
|
|
46
|
+
modal: 'modal',
|
|
47
|
+
roundView: 'roundView',
|
|
48
|
+
skeletonLoader: 'skeletonLoader',
|
|
49
|
+
topbar: {
|
|
50
|
+
goBack: 'topbar.goBack',
|
|
51
|
+
title: 'topbar.title'
|
|
52
|
+
},
|
|
53
|
+
workflowContainer: {
|
|
54
|
+
bottomActions: {
|
|
55
|
+
message: `${TEST_ID_CONSTANTS.workflowContainer}.${TEST_ID_CONSTANTS.bottomActions}.message`,
|
|
56
|
+
nextButton: `${TEST_ID_CONSTANTS.workflowContainer}.${TEST_ID_CONSTANTS.bottomActions}.nextButton`,
|
|
57
|
+
returnButton: `${TEST_ID_CONSTANTS.workflowContainer}.${TEST_ID_CONSTANTS.bottomActions}.returnButton`,
|
|
58
|
+
summary: `${TEST_ID_CONSTANTS.workflowContainer}.${TEST_ID_CONSTANTS.bottomActions}.summary`
|
|
59
|
+
},
|
|
60
|
+
header: {
|
|
61
|
+
tagline: `${TEST_ID_CONSTANTS.workflowContainer}.header.${TEST_ID_CONSTANTS.tagline}`,
|
|
62
|
+
title: `${TEST_ID_CONSTANTS.workflowContainer}.header.${TEST_ID_CONSTANTS.title}`,
|
|
63
|
+
subtitle: `${TEST_ID_CONSTANTS.workflowContainer}.header.${TEST_ID_CONSTANTS.subtitle}`,
|
|
64
|
+
requiredFieldInfo: `${TEST_ID_CONSTANTS.workflowContainer}.header.${TEST_ID_CONSTANTS.requiredFieldInfo}`,
|
|
65
|
+
helpText: `${TEST_ID_CONSTANTS.workflowContainer}.header.${TEST_ID_CONSTANTS.helpText}`
|
|
66
|
+
}
|
|
67
|
+
}
|
|
45
68
|
};
|
package/lib/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export { default as UTButton } from './components/UTButton';
|
|
|
44
44
|
export { default as UTButtonGroup } from './components/UTButtonGroup';
|
|
45
45
|
export { default as UTCBUInput } from './components/UTCBUInput';
|
|
46
46
|
export { default as UTCheckBox } from './components/UTCheckBox';
|
|
47
|
+
export { default as UTCuit } from './components/UTCuit';
|
|
47
48
|
export { default as UTCheckList } from './components/UTCheckList';
|
|
48
49
|
export { default as UTDataCategory } from './components/UTDataCategory';
|
|
49
50
|
export { default as UTDataElement } from './components/UTDataElement';
|
package/package.json
CHANGED