vpt-sebraeds 0.0.77 → 0.0.79
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/components/Button/index.jsx +2 -0
- package/components/ButtonGroup/ButtonGroup.stories.jsx +50 -2
- package/components/ButtonGroup/index.tsx +79 -2
- package/components/Checkbox/index.jsx +3 -1
- package/components/ContentCard/index.jsx +2 -1
- package/components/ContentSlot/index.jsx +2 -1
- package/components/Datepicker/index.jsx +18 -4
- package/components/EventListItem/index.tsx +23 -5
- package/components/Header/HeaderV2.stories.jsx +1 -0
- package/components/Header/v2/index.jsx +4 -0
- package/components/Header/v2/parts/Hero.jsx +15 -5
- package/components/Header/v2/parts/Information.jsx +5 -2
- package/components/Header/v2/parts/Shortcut.jsx +2 -1
- package/components/Header/v2/parts/SwitchAccount.jsx +10 -2
- package/components/Modal/index.jsx +8 -4
- package/components/NavigationItem/NavigationItem.stories.tsx +33 -4
- package/components/NavigationItem/index.tsx +473 -203
- package/components/Shortcut/index.jsx +7 -5
- package/components/TaskCard/index.jsx +7 -1
- package/components/Toggle/index.jsx +3 -1
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +2 -2
- package/dist/components/ButtonGroup/index.d.ts +4 -2
- package/dist/components/ButtonGroup/index.d.ts.map +1 -1
- package/dist/components/ButtonGroup/index.js +44 -1
- package/dist/components/Checkbox/index.d.ts +3 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +3 -2
- package/dist/components/ContentCard/index.d.ts +2 -1
- package/dist/components/ContentCard/index.d.ts.map +1 -1
- package/dist/components/ContentCard/index.js +2 -2
- package/dist/components/ContentSlot/index.d.ts +2 -1
- package/dist/components/ContentSlot/index.d.ts.map +1 -1
- package/dist/components/ContentSlot/index.js +2 -2
- package/dist/components/Datepicker/index.d.ts.map +1 -1
- package/dist/components/Datepicker/index.js +14 -5
- package/dist/components/EventListItem/index.d.ts.map +1 -1
- package/dist/components/EventListItem/index.js +23 -5
- package/dist/components/Header/v2/index.d.ts.map +1 -1
- package/dist/components/Header/v2/index.js +4 -1
- package/dist/components/Header/v2/parts/Hero.d.ts +3 -1
- package/dist/components/Header/v2/parts/Hero.d.ts.map +1 -1
- package/dist/components/Header/v2/parts/Hero.js +10 -6
- package/dist/components/Header/v2/parts/Information.d.ts.map +1 -1
- package/dist/components/Header/v2/parts/Information.js +5 -5
- package/dist/components/Header/v2/parts/Shortcut.d.ts +2 -1
- package/dist/components/Header/v2/parts/Shortcut.d.ts.map +1 -1
- package/dist/components/Header/v2/parts/Shortcut.js +2 -2
- package/dist/components/Header/v2/parts/SwitchAccount.d.ts.map +1 -1
- package/dist/components/Header/v2/parts/SwitchAccount.js +10 -6
- package/dist/components/Modal/index.d.ts +2 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +4 -8
- package/dist/components/NavigationItem/index.d.ts +74 -10
- package/dist/components/NavigationItem/index.d.ts.map +1 -1
- package/dist/components/NavigationItem/index.js +300 -145
- package/dist/components/Shortcut/index.d.ts +2 -1
- package/dist/components/Shortcut/index.d.ts.map +1 -1
- package/dist/components/Shortcut/index.js +7 -7
- package/dist/components/TaskCard/index.d.ts +3 -1
- package/dist/components/TaskCard/index.d.ts.map +1 -1
- package/dist/components/TaskCard/index.js +6 -6
- package/dist/components/Toggle/index.d.ts +2 -1
- package/dist/components/Toggle/index.d.ts.map +1 -1
- package/dist/components/Toggle/index.js +2 -3
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/package.json +1 -1
- package/src/index.ts +8 -1
|
@@ -15,6 +15,7 @@ const Button = ({
|
|
|
15
15
|
expand = false,
|
|
16
16
|
iconColor,
|
|
17
17
|
badge,
|
|
18
|
+
testID,
|
|
18
19
|
}) => {
|
|
19
20
|
const [isFocused, setIsFocused] = useState(false);
|
|
20
21
|
const iconOnly = useMemo(() => !label && iconName, [label, iconName]);
|
|
@@ -208,6 +209,7 @@ const Button = ({
|
|
|
208
209
|
onPressIn={() => setIsFocused(true)}
|
|
209
210
|
onPressOut={() => setIsFocused(false)}
|
|
210
211
|
activeOpacity={0.95}
|
|
212
|
+
testID={testID}
|
|
211
213
|
>
|
|
212
214
|
<View style={styles.contentContainer}>
|
|
213
215
|
{iconOnly && renderIcon()}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { View, StyleSheet, Text, ScrollView } from 'react-native';
|
|
3
3
|
import ButtonGroup from './index';
|
|
4
|
+
import Icon from '../Icon';
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'Atom/ButtonGroup',
|
|
@@ -24,6 +25,7 @@ const meta = {
|
|
|
24
25
|
values: [
|
|
25
26
|
{ name: 'light', value: '#EEF2FF' },
|
|
26
27
|
{ name: 'white', value: '#FFFFFF' },
|
|
28
|
+
{ name: 'dark', value: '#081032' },
|
|
27
29
|
],
|
|
28
30
|
},
|
|
29
31
|
},
|
|
@@ -49,8 +51,8 @@ const meta = {
|
|
|
49
51
|
description: 'Callback por item (recebe id, nextSelected, selectedIds e itemData)',
|
|
50
52
|
},
|
|
51
53
|
variant: {
|
|
52
|
-
control: { type: 'select', options: ['default', 'card'] },
|
|
53
|
-
description: 'Variação do componente (default = pills, card = cards com título)',
|
|
54
|
+
control: { type: 'select', options: ['default', 'card', 'outline'] },
|
|
55
|
+
description: 'Variação do componente (default = pills, card = cards com título, outline = pills com borda para fundo escuro)',
|
|
54
56
|
},
|
|
55
57
|
cardVariant: {
|
|
56
58
|
control: { type: 'select', options: ['gray', 'green'] },
|
|
@@ -154,6 +156,27 @@ export const InteractionArea = {
|
|
|
154
156
|
},
|
|
155
157
|
};
|
|
156
158
|
|
|
159
|
+
export const OutlineNavigation = {
|
|
160
|
+
parameters: {
|
|
161
|
+
backgrounds: { default: 'dark' },
|
|
162
|
+
},
|
|
163
|
+
render: () => (
|
|
164
|
+
<View style={[styles.page, styles.darkFrame]}>
|
|
165
|
+
<View style={styles.rowNav}>
|
|
166
|
+
<View style={styles.leadingIcon}>
|
|
167
|
+
<Icon name="star-s-fill" color="#FFFFFF" size={20} />
|
|
168
|
+
</View>
|
|
169
|
+
<ButtonGroup variant="outline" multiple={false} containerStyle={styles.navGroup}>
|
|
170
|
+
<ButtonGroup.Item id="1" label="Item 1" trailingIconName="arrow-right-line" />
|
|
171
|
+
<ButtonGroup.Item id="2" label="Item 2" trailingIconName="arrow-right-line" />
|
|
172
|
+
<ButtonGroup.Item id="3" label="Item 3" trailingIconName="arrow-right-line" />
|
|
173
|
+
<ButtonGroup.Item id="4" label="Mais 6" trailingIconName="arrow-right-up-line" />
|
|
174
|
+
</ButtonGroup>
|
|
175
|
+
</View>
|
|
176
|
+
</View>
|
|
177
|
+
),
|
|
178
|
+
};
|
|
179
|
+
|
|
157
180
|
// ================ VARIAÇÃO CARD ================
|
|
158
181
|
|
|
159
182
|
export const AllCardVariants = {
|
|
@@ -342,6 +365,11 @@ const styles = StyleSheet.create({
|
|
|
342
365
|
page: {
|
|
343
366
|
// padding: 24,
|
|
344
367
|
width: '100%',
|
|
368
|
+
flex: 1,
|
|
369
|
+
},
|
|
370
|
+
darkFrame: {
|
|
371
|
+
padding: 24,
|
|
372
|
+
backgroundColor: '#081032',
|
|
345
373
|
},
|
|
346
374
|
card: {
|
|
347
375
|
backgroundColor: '#FFFFFF',
|
|
@@ -380,4 +408,24 @@ const styles = StyleSheet.create({
|
|
|
380
408
|
marginBottom: 8,
|
|
381
409
|
textTransform: 'uppercase',
|
|
382
410
|
},
|
|
411
|
+
rowNav: {
|
|
412
|
+
flexDirection: 'row',
|
|
413
|
+
alignItems: 'center',
|
|
414
|
+
gap: 12,
|
|
415
|
+
width: '100%',
|
|
416
|
+
flexWrap: 'wrap',
|
|
417
|
+
},
|
|
418
|
+
leadingIcon: {
|
|
419
|
+
width: 28,
|
|
420
|
+
height: 28,
|
|
421
|
+
borderRadius: 999,
|
|
422
|
+
alignItems: 'center',
|
|
423
|
+
justifyContent: 'center',
|
|
424
|
+
},
|
|
425
|
+
navGroup: {
|
|
426
|
+
flexDirection: 'row',
|
|
427
|
+
flexWrap: 'wrap',
|
|
428
|
+
gap: 12,
|
|
429
|
+
flex: 1,
|
|
430
|
+
},
|
|
383
431
|
});
|
|
@@ -14,7 +14,7 @@ const { useCallback, useMemo, useState, createContext, useContext } = React;
|
|
|
14
14
|
|
|
15
15
|
export type CardVariant = 'gray' | 'green';
|
|
16
16
|
export type CardLayout = 'metric' | 'center' | 'left' | 'auto';
|
|
17
|
-
export type ButtonGroupVariant = 'default' | 'card';
|
|
17
|
+
export type ButtonGroupVariant = 'default' | 'card' | 'outline';
|
|
18
18
|
|
|
19
19
|
type ButtonGroupContextValue = {
|
|
20
20
|
multiple: boolean;
|
|
@@ -200,9 +200,23 @@ export type ButtonGroupItemProps = {
|
|
|
200
200
|
style?: StyleProp<ViewStyle>;
|
|
201
201
|
iconName?: string;
|
|
202
202
|
iconColor?: string;
|
|
203
|
+
trailingIconName?: string;
|
|
204
|
+
trailingIconColor?: string;
|
|
203
205
|
};
|
|
204
206
|
|
|
205
|
-
function Item({
|
|
207
|
+
function Item({
|
|
208
|
+
id,
|
|
209
|
+
label,
|
|
210
|
+
title,
|
|
211
|
+
disabled: itemDisabled,
|
|
212
|
+
onPress,
|
|
213
|
+
testID,
|
|
214
|
+
style,
|
|
215
|
+
iconName,
|
|
216
|
+
iconColor,
|
|
217
|
+
trailingIconName,
|
|
218
|
+
trailingIconColor,
|
|
219
|
+
}: ButtonGroupItemProps) {
|
|
206
220
|
const {
|
|
207
221
|
selectedIds,
|
|
208
222
|
handlePress,
|
|
@@ -286,6 +300,44 @@ function Item({ id, label, title, disabled: itemDisabled, onPress, testID, style
|
|
|
286
300
|
);
|
|
287
301
|
}
|
|
288
302
|
|
|
303
|
+
if (variant === 'outline') {
|
|
304
|
+
const trailingName = trailingIconName || iconName;
|
|
305
|
+
const trailingColor = trailingIconColor || iconColor;
|
|
306
|
+
return (
|
|
307
|
+
<Pressable
|
|
308
|
+
testID={testID}
|
|
309
|
+
accessibilityRole="button"
|
|
310
|
+
accessibilityState={{ selected: isSelected, disabled: isDisabled }}
|
|
311
|
+
disabled={isDisabled}
|
|
312
|
+
onPress={handleItemPress}
|
|
313
|
+
>
|
|
314
|
+
{({ pressed }) => (
|
|
315
|
+
<View
|
|
316
|
+
style={[
|
|
317
|
+
styles.outlineItem,
|
|
318
|
+
isSelected ? styles.outlineItemSelected : styles.outlineItemUnselected,
|
|
319
|
+
!isDisabled && pressed && styles.outlineItemPressed,
|
|
320
|
+
isDisabled && styles.itemDisabled,
|
|
321
|
+
style,
|
|
322
|
+
]}
|
|
323
|
+
>
|
|
324
|
+
<SEText type="ns-sm-body-bold" style={[styles.outlineLabel, groupLabelStyle, isSelected && selectedLabelStyle]}>
|
|
325
|
+
{label}
|
|
326
|
+
</SEText>
|
|
327
|
+
{trailingName && (
|
|
328
|
+
<Icon
|
|
329
|
+
name={trailingName}
|
|
330
|
+
color={trailingColor || '#FFFFFF'}
|
|
331
|
+
size={20}
|
|
332
|
+
style={styles.outlineTrailingIcon}
|
|
333
|
+
/>
|
|
334
|
+
)}
|
|
335
|
+
</View>
|
|
336
|
+
)}
|
|
337
|
+
</Pressable>
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
289
341
|
return (
|
|
290
342
|
<Pressable
|
|
291
343
|
testID={testID}
|
|
@@ -434,6 +486,31 @@ const styles = StyleSheet.create({
|
|
|
434
486
|
labelPressed: {
|
|
435
487
|
color: '#2A4FDA',
|
|
436
488
|
},
|
|
489
|
+
outlineItem: {
|
|
490
|
+
borderRadius: 999,
|
|
491
|
+
borderWidth: 2,
|
|
492
|
+
borderColor: '#C24BD6',
|
|
493
|
+
backgroundColor: 'transparent',
|
|
494
|
+
paddingHorizontal: 18,
|
|
495
|
+
minHeight: 44,
|
|
496
|
+
flexDirection: 'row',
|
|
497
|
+
alignItems: 'center',
|
|
498
|
+
justifyContent: 'space-between',
|
|
499
|
+
gap: 12,
|
|
500
|
+
},
|
|
501
|
+
outlineItemUnselected: {},
|
|
502
|
+
outlineItemSelected: {
|
|
503
|
+
backgroundColor: '#C24BD6',
|
|
504
|
+
},
|
|
505
|
+
outlineItemPressed: {
|
|
506
|
+
backgroundColor: 'rgba(194, 75, 214, 0.16)',
|
|
507
|
+
},
|
|
508
|
+
outlineLabel: {
|
|
509
|
+
color: '#FFFFFF',
|
|
510
|
+
},
|
|
511
|
+
outlineTrailingIcon: {
|
|
512
|
+
marginLeft: 2,
|
|
513
|
+
},
|
|
437
514
|
});
|
|
438
515
|
|
|
439
516
|
export default ButtonGroup;
|
|
@@ -9,7 +9,7 @@ import Icon from '../Icon';
|
|
|
9
9
|
import SEText from '../SEText';
|
|
10
10
|
import { fontFamily } from '../utils/fontFamily';
|
|
11
11
|
|
|
12
|
-
const Checkbox = ({ label, checked, disabled, variant, onChange, noBorder = false }) => {
|
|
12
|
+
const Checkbox = ({ label, checked, disabled, variant, onChange, noBorder = false, testID }) => {
|
|
13
13
|
return (
|
|
14
14
|
<TouchableOpacity
|
|
15
15
|
style={[
|
|
@@ -19,6 +19,7 @@ const Checkbox = ({ label, checked, disabled, variant, onChange, noBorder = fals
|
|
|
19
19
|
onPress={onChange}
|
|
20
20
|
disabled={disabled}
|
|
21
21
|
activeOpacity={0.8}
|
|
22
|
+
testID={testID}
|
|
22
23
|
>
|
|
23
24
|
<View
|
|
24
25
|
style={[
|
|
@@ -57,6 +58,7 @@ Checkbox.propTypes = {
|
|
|
57
58
|
variant: PropTypes.oneOf(['empty', 'check-line', 'subtract-line']),
|
|
58
59
|
onChange: PropTypes.func,
|
|
59
60
|
noBorder: PropTypes.bool,
|
|
61
|
+
testID: PropTypes.string,
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
Checkbox.defaultProps = {
|
|
@@ -35,6 +35,7 @@ const ContentCard = ({
|
|
|
35
35
|
style, // NOVO: permite passar estilos customizados
|
|
36
36
|
centerDonut = false, // NOVO: centraliza o DonutChart
|
|
37
37
|
progressType = 'donut',
|
|
38
|
+
testID,
|
|
38
39
|
}) => {
|
|
39
40
|
console.log("Chegou isso:", progress);
|
|
40
41
|
const containerStyle = [
|
|
@@ -182,7 +183,7 @@ const ContentCard = ({
|
|
|
182
183
|
style={containerStyle}
|
|
183
184
|
activeOpacity={0.85}
|
|
184
185
|
onPress={onPressCard}
|
|
185
|
-
testID="content-card-touchable"
|
|
186
|
+
testID={testID || "content-card-touchable"}
|
|
186
187
|
>
|
|
187
188
|
{CardContent}
|
|
188
189
|
</TouchableOpacity>
|
|
@@ -38,6 +38,7 @@ const ContentSlot = ({
|
|
|
38
38
|
eventDate,
|
|
39
39
|
eventTime,
|
|
40
40
|
eventLocation,
|
|
41
|
+
testID,
|
|
41
42
|
}) => {
|
|
42
43
|
const containerStyle = [
|
|
43
44
|
styles.container,
|
|
@@ -107,7 +108,7 @@ const ContentSlot = ({
|
|
|
107
108
|
style={containerStyle}
|
|
108
109
|
activeOpacity={0.85}
|
|
109
110
|
onPress={onPress}
|
|
110
|
-
testID="content-slot-touchable"
|
|
111
|
+
testID={testID || "content-slot-touchable"}
|
|
111
112
|
>
|
|
112
113
|
{CardContent}
|
|
113
114
|
</TouchableOpacity>
|
|
@@ -392,8 +392,12 @@ const DatePicker = forwardRef(({
|
|
|
392
392
|
>
|
|
393
393
|
<View style={styles.dayContent}>
|
|
394
394
|
<Text style={textStyle}>{date.getUTCDate()}</Text>
|
|
395
|
-
{!!commitmentMeta && <View style={dotStyle} />}
|
|
396
395
|
</View>
|
|
396
|
+
{!!commitmentMeta && (
|
|
397
|
+
<View style={styles.commitmentDotWrapper} pointerEvents="none">
|
|
398
|
+
<View style={dotStyle} />
|
|
399
|
+
</View>
|
|
400
|
+
)}
|
|
397
401
|
</TouchableOpacity>
|
|
398
402
|
);
|
|
399
403
|
})}
|
|
@@ -488,8 +492,12 @@ const DatePicker = forwardRef(({
|
|
|
488
492
|
<Text style={textStyle}>
|
|
489
493
|
{date ? date.getUTCDate() : ''}
|
|
490
494
|
</Text>
|
|
491
|
-
{!!commitmentMeta && !!date && <View style={dotStyle} />}
|
|
492
495
|
</View>
|
|
496
|
+
{!!commitmentMeta && !!date && (
|
|
497
|
+
<View style={styles.commitmentDotWrapper} pointerEvents="none">
|
|
498
|
+
<View style={dotStyle} />
|
|
499
|
+
</View>
|
|
500
|
+
)}
|
|
493
501
|
</TouchableOpacity>
|
|
494
502
|
);
|
|
495
503
|
})}
|
|
@@ -702,7 +710,6 @@ const styles = StyleSheet.create({
|
|
|
702
710
|
width: '100%',
|
|
703
711
|
alignItems: 'center',
|
|
704
712
|
justifyContent: 'center',
|
|
705
|
-
gap: 4,
|
|
706
713
|
},
|
|
707
714
|
dayText: {
|
|
708
715
|
fontSize: 16,
|
|
@@ -731,7 +738,14 @@ const styles = StyleSheet.create({
|
|
|
731
738
|
},
|
|
732
739
|
endDayText: { color: '#FFFFFF', fontWeight: '700', fontFamily: fontFamily.bold },
|
|
733
740
|
commitmentDot: {
|
|
734
|
-
|
|
741
|
+
},
|
|
742
|
+
commitmentDotWrapper: {
|
|
743
|
+
position: 'absolute',
|
|
744
|
+
left: 0,
|
|
745
|
+
right: 0,
|
|
746
|
+
bottom: 6,
|
|
747
|
+
alignItems: 'center',
|
|
748
|
+
justifyContent: 'center',
|
|
735
749
|
},
|
|
736
750
|
commitmentDotSelected: {
|
|
737
751
|
// backgroundColor: 'transparent',
|
|
@@ -12,6 +12,7 @@ import Icon from '../Icon';
|
|
|
12
12
|
import Tag from '../Tag';
|
|
13
13
|
import tokens from '../styles/tokens';
|
|
14
14
|
import { fontFamily } from '../utils/fontFamily';
|
|
15
|
+
import SEText from '../SEText';
|
|
15
16
|
|
|
16
17
|
export type EventListItemKind = 'detailed' | 'simple';
|
|
17
18
|
|
|
@@ -223,11 +224,15 @@ function EventListItem({
|
|
|
223
224
|
)}
|
|
224
225
|
|
|
225
226
|
{!!tags?.length && (
|
|
226
|
-
<
|
|
227
|
+
<View style={styles.tagsRow}>
|
|
227
228
|
{tags.slice(0, 2).map((t, idx) => (
|
|
228
|
-
<
|
|
229
|
+
<View key={`${t}-${idx}`} style={styles.tag}>
|
|
230
|
+
<SEText bold style={styles.tagText}>
|
|
231
|
+
{t}
|
|
232
|
+
</SEText>
|
|
233
|
+
</View>
|
|
229
234
|
))}
|
|
230
|
-
</
|
|
235
|
+
</View>
|
|
231
236
|
)}
|
|
232
237
|
</Card>
|
|
233
238
|
</View>
|
|
@@ -438,12 +443,25 @@ const styles = StyleSheet.create({
|
|
|
438
443
|
fontWeight: '400',
|
|
439
444
|
},
|
|
440
445
|
tagsRow: {
|
|
441
|
-
marginTop: 10,
|
|
442
446
|
flexDirection: 'row',
|
|
443
|
-
|
|
447
|
+
marginTop: 10,
|
|
444
448
|
},
|
|
445
449
|
tag: {
|
|
450
|
+
minWidth: 52,
|
|
446
451
|
height: 32,
|
|
452
|
+
borderWidth: 1,
|
|
453
|
+
borderColor: '#D7DDFA',
|
|
454
|
+
borderRadius: 16,
|
|
455
|
+
alignItems: 'center',
|
|
456
|
+
justifyContent: 'center',
|
|
457
|
+
marginRight: 8,
|
|
458
|
+
backgroundColor: '#FFFFFF',
|
|
459
|
+
paddingHorizontal: 14,
|
|
460
|
+
},
|
|
461
|
+
tagText: {
|
|
462
|
+
color: '#37416F',
|
|
463
|
+
fontSize: 13,
|
|
464
|
+
lineHeight: 17,
|
|
447
465
|
},
|
|
448
466
|
trailingPlaceholder: {
|
|
449
467
|
width: 20,
|
|
@@ -35,6 +35,7 @@ const HeaderV2 = forwardRef(({
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
headerOptions = defaultHeaderOptions,
|
|
38
|
+
testIDPrefix,
|
|
38
39
|
}, ref) => {
|
|
39
40
|
const [headerOptionsState, setHeaderOptionsState] = useState(headerOptions)
|
|
40
41
|
const [selectedEnterprise, setSelectedEnterprise] = useState(() => {
|
|
@@ -74,10 +75,12 @@ const HeaderV2 = forwardRef(({
|
|
|
74
75
|
selectedEnterprise,
|
|
75
76
|
},
|
|
76
77
|
setSelectedEnterprise,
|
|
78
|
+
testIDPrefix,
|
|
77
79
|
}), [
|
|
78
80
|
mergedHeaderOptions,
|
|
79
81
|
userOptions,
|
|
80
82
|
selectedEnterprise,
|
|
83
|
+
testIDPrefix,
|
|
81
84
|
])
|
|
82
85
|
|
|
83
86
|
const normalizedVariant = (variant || 'default').toLowerCase()
|
|
@@ -176,6 +179,7 @@ HeaderV2.getHeroProps = ({
|
|
|
176
179
|
return {
|
|
177
180
|
show: shortcutOptions?.showShortcut ?? true,
|
|
178
181
|
shortcuts: shortcutOptions?.shortcuts ?? [],
|
|
182
|
+
onUserRedirect: userOptions?.user?.onRedirect,
|
|
179
183
|
userName: userOptions?.user?.name,
|
|
180
184
|
backgroundColor,
|
|
181
185
|
textColor,
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import SEText from '../../../SEText'
|
|
5
5
|
import Shortcut from './Shortcut'
|
|
6
|
+
import Icon from '../../../Icon'
|
|
6
7
|
|
|
7
8
|
export default function Hero({
|
|
8
9
|
userName,
|
|
10
|
+
onUserRedirect,
|
|
9
11
|
shortcuts = [],
|
|
10
12
|
show = true,
|
|
11
13
|
greeting,
|
|
12
14
|
title,
|
|
13
15
|
backgroundColor = '#001152',
|
|
14
16
|
textColor = '#fff',
|
|
17
|
+
testIDPrefix,
|
|
15
18
|
}) {
|
|
16
19
|
if (!show) return null
|
|
17
20
|
|
|
@@ -21,11 +24,17 @@ export default function Hero({
|
|
|
21
24
|
return (
|
|
22
25
|
<View style={[styles.container, { backgroundColor }]}>
|
|
23
26
|
<View style={styles.wrapper}>
|
|
24
|
-
|
|
27
|
+
{onUserRedirect ? (
|
|
28
|
+
<TouchableOpacity onPress={onUserRedirect} style={{ flexDirection: 'row', alignItems: 'center' }} testID={testIDPrefix ? `${testIDPrefix}.Greeting` : undefined}>
|
|
29
|
+
<SEText size={18} color={textColor}>{resolvedGreeting}</SEText>
|
|
30
|
+
<Icon name="arrow-right-line" color={textColor} size={16} style={{ marginLeft: 8 }} />
|
|
31
|
+
</TouchableOpacity>
|
|
32
|
+
) : (
|
|
33
|
+
<SEText size={18} color={textColor}>{resolvedGreeting}</SEText>
|
|
34
|
+
)}
|
|
25
35
|
<SEText size={28} color={textColor} bold>{resolvedTitle}</SEText>
|
|
26
36
|
</View>
|
|
27
|
-
|
|
28
|
-
<Shortcut shortcutsList={shortcuts} />
|
|
37
|
+
<Shortcut shortcutsList={shortcuts} testIDPrefix={testIDPrefix} />
|
|
29
38
|
</View>
|
|
30
39
|
)
|
|
31
40
|
}
|
|
@@ -52,8 +61,9 @@ const styles = StyleSheet.create({
|
|
|
52
61
|
paddingBottom: 24,
|
|
53
62
|
},
|
|
54
63
|
wrapper: {
|
|
55
|
-
paddingTop: 20,
|
|
64
|
+
// paddingTop: 20,
|
|
56
65
|
paddingBottom: 24,
|
|
57
66
|
paddingHorizontal: 20,
|
|
67
|
+
gap: 8,
|
|
58
68
|
},
|
|
59
69
|
})
|
|
@@ -6,13 +6,13 @@ import { useHeaderV2 } from './Context'
|
|
|
6
6
|
import { styles } from '../styles'
|
|
7
7
|
|
|
8
8
|
export default function Information({ enterprisesList = [], status, multiple }) {
|
|
9
|
-
const { headerOptions = {} } = useHeaderV2()
|
|
9
|
+
const { headerOptions = {}, testIDPrefix } = useHeaderV2()
|
|
10
10
|
|
|
11
11
|
const isWhiteTheme = headerOptions?.theme === 'white'
|
|
12
12
|
const iconColor = isWhiteTheme ? '#111111' : '#ffffff'
|
|
13
13
|
const isMultiple = multiple ?? headerOptions?.multiple ?? false
|
|
14
14
|
|
|
15
|
-
const InfoButton = ({ type, hasInfo, onPress }) => (
|
|
15
|
+
const InfoButton = ({ type, hasInfo, onPress, testID }) => (
|
|
16
16
|
<View style={styles.information.infoBulletWrapper}>
|
|
17
17
|
{hasInfo && (
|
|
18
18
|
<View
|
|
@@ -29,6 +29,7 @@ export default function Information({ enterprisesList = [], status, multiple })
|
|
|
29
29
|
iconName={type === 'notification' ? 'notification-2-line' : 'chat-3-line'}
|
|
30
30
|
size='large'
|
|
31
31
|
onPress={onPress}
|
|
32
|
+
testID={testID}
|
|
32
33
|
/>
|
|
33
34
|
</View>
|
|
34
35
|
)
|
|
@@ -55,12 +56,14 @@ export default function Information({ enterprisesList = [], status, multiple })
|
|
|
55
56
|
type='chat'
|
|
56
57
|
hasInfo={status?.hasMessage}
|
|
57
58
|
onPress={headerOptions.onClickMessage}
|
|
59
|
+
testID={testIDPrefix ? `${testIDPrefix}.MessageButton` : undefined}
|
|
58
60
|
/>
|
|
59
61
|
|
|
60
62
|
<InfoButton
|
|
61
63
|
type='notification'
|
|
62
64
|
hasInfo={status?.hasNotification}
|
|
63
65
|
onPress={headerOptions.onClickNotification}
|
|
66
|
+
testID={testIDPrefix ? `${testIDPrefix}.NotificationButton` : undefined}
|
|
64
67
|
/>
|
|
65
68
|
</View>
|
|
66
69
|
)
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { FlatList, StyleSheet, View } from 'react-native'
|
|
3
3
|
import Shortcut from '../../../Shortcut'
|
|
4
4
|
|
|
5
|
-
export default function ShortcutWrapper({ shortcutsList = [] }) {
|
|
5
|
+
export default function ShortcutWrapper({ shortcutsList = [], testIDPrefix }) {
|
|
6
6
|
const RenderShortcut = ({ item }) => (
|
|
7
7
|
<Shortcut
|
|
8
8
|
label={item.title}
|
|
@@ -10,6 +10,7 @@ export default function ShortcutWrapper({ shortcutsList = [] }) {
|
|
|
10
10
|
variant={item.variant || 'filled'}
|
|
11
11
|
onPress={item.onPress}
|
|
12
12
|
badge={item.badge}
|
|
13
|
+
testID={testIDPrefix ? `${testIDPrefix}.Shortcut.${item.id}` : undefined}
|
|
13
14
|
/>
|
|
14
15
|
)
|
|
15
16
|
|
|
@@ -7,7 +7,7 @@ import { useHeaderV2 } from './Context'
|
|
|
7
7
|
const { height: SCREEN_HEIGHT } = Dimensions.get('window')
|
|
8
8
|
|
|
9
9
|
export default function SwitchAccount({ accounts = [], forceAddEnterprise = false, onSelectEnterprise, onEnterpriseMoreOptions, theme, multiple = false }) {
|
|
10
|
-
const { headerOptions = {}, user = {}, setSelectedEnterprise } = useHeaderV2()
|
|
10
|
+
const { headerOptions = {}, user = {}, setSelectedEnterprise, testIDPrefix } = useHeaderV2()
|
|
11
11
|
const [visible, setVisible] = useState(false)
|
|
12
12
|
const [canCloseByBackdrop, setCanCloseByBackdrop] = useState(false)
|
|
13
13
|
|
|
@@ -116,9 +116,13 @@ export default function SwitchAccount({ accounts = [], forceAddEnterprise = fals
|
|
|
116
116
|
const AccountsListItem = ({ item }) => {
|
|
117
117
|
const isSelected = isSameEnterprise(item)
|
|
118
118
|
const isPending = item?.pending === true
|
|
119
|
+
const itemKey = item?.cnpj || item?.id || item?.displayName
|
|
120
|
+
const itemTestIDBase = testIDPrefix
|
|
121
|
+
? `${testIDPrefix}.SwitchAccount.Item.${itemKey}`
|
|
122
|
+
: undefined
|
|
119
123
|
|
|
120
124
|
return (
|
|
121
|
-
<View style={[
|
|
125
|
+
<View testID={itemTestIDBase} style={[
|
|
122
126
|
styles.dropdownItem,
|
|
123
127
|
isSelected && (isWhiteTheme ? styles.selectedDropdownItemWhite : styles.selectedDropdownItem),
|
|
124
128
|
]}>
|
|
@@ -150,6 +154,7 @@ export default function SwitchAccount({ accounts = [], forceAddEnterprise = fals
|
|
|
150
154
|
}, 300)
|
|
151
155
|
}}
|
|
152
156
|
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
157
|
+
testID={itemTestIDBase ? `${itemTestIDBase}.More` : undefined}
|
|
153
158
|
>
|
|
154
159
|
<Icon name='more-2-line' size={20} color={isWhiteTheme ? whiteThemeTextColor : '#fff'} />
|
|
155
160
|
</TouchableOpacity>
|
|
@@ -173,6 +178,7 @@ export default function SwitchAccount({ accounts = [], forceAddEnterprise = fals
|
|
|
173
178
|
{ opacity: pressed ? 0.8 : 1 }
|
|
174
179
|
]}
|
|
175
180
|
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
181
|
+
testID={testIDPrefix ? `${testIDPrefix}.SwitchAccount.AdicionarEmpresa` : undefined}
|
|
176
182
|
>
|
|
177
183
|
<Icon name='add-circle-line' size={20} color={isWhiteTheme ? whiteThemeTextColor : '#fff'} />
|
|
178
184
|
<SEText type='ns-subtitle' color={isWhiteTheme ? whiteThemeTextColor : '#fff'}>
|
|
@@ -227,6 +233,7 @@ export default function SwitchAccount({ accounts = [], forceAddEnterprise = fals
|
|
|
227
233
|
isWhiteTheme && styles.switchAccountButtonWhite,
|
|
228
234
|
{ opacity: pressed ? 0.8 : 1 }
|
|
229
235
|
]}
|
|
236
|
+
testID={testIDPrefix ? `${testIDPrefix}.SwitchAccount.Trigger` : undefined}
|
|
230
237
|
>
|
|
231
238
|
{multiple ? (
|
|
232
239
|
renderTags()
|
|
@@ -279,6 +286,7 @@ export default function SwitchAccount({ accounts = [], forceAddEnterprise = fals
|
|
|
279
286
|
}
|
|
280
287
|
}, 300)
|
|
281
288
|
}}
|
|
289
|
+
testID={testIDPrefix ? `${testIDPrefix}.SwitchAccount.AdicionarEmpresa` : undefined}
|
|
282
290
|
>
|
|
283
291
|
<Icon name='add-circle-line' size={20} color={isWhiteTheme ? whiteThemeTextColor : '#fff'} />
|
|
284
292
|
<SEText type='ns-sm-body-bold' color={isWhiteTheme ? whiteThemeTextColor : '#fff'}>Adicionar empresa</SEText>
|
|
@@ -12,11 +12,12 @@ const Modal = ({
|
|
|
12
12
|
icon,
|
|
13
13
|
title,
|
|
14
14
|
supportingText,
|
|
15
|
-
checkbox,
|
|
16
|
-
primaryAction,
|
|
17
|
-
secondaryAction,
|
|
15
|
+
checkbox,
|
|
16
|
+
primaryAction,
|
|
17
|
+
secondaryAction,
|
|
18
18
|
loadingText = 'Carregando',
|
|
19
19
|
children,
|
|
20
|
+
testID,
|
|
20
21
|
}) => {
|
|
21
22
|
const renderContent = () => {
|
|
22
23
|
if (variant === 'loading') {
|
|
@@ -50,6 +51,7 @@ const Modal = ({
|
|
|
50
51
|
icon={primaryAction.icon}
|
|
51
52
|
disabled={primaryAction.disabled}
|
|
52
53
|
fullWidth
|
|
54
|
+
testID={primaryAction.testID || (testID ? `${testID}.PrimaryAction` : undefined)}
|
|
53
55
|
/>
|
|
54
56
|
)}
|
|
55
57
|
</View>
|
|
@@ -61,8 +63,9 @@ const Modal = ({
|
|
|
61
63
|
onPress={secondaryAction.onPress}
|
|
62
64
|
icon={secondaryAction.icon}
|
|
63
65
|
disabled={secondaryAction.disabled}
|
|
64
|
-
variant="transparent"
|
|
66
|
+
variant="transparent"
|
|
65
67
|
fullWidth
|
|
68
|
+
testID={secondaryAction.testID || (testID ? `${testID}.SecondaryAction` : undefined)}
|
|
66
69
|
/>
|
|
67
70
|
</View>
|
|
68
71
|
)}
|
|
@@ -76,6 +79,7 @@ const Modal = ({
|
|
|
76
79
|
visible={visible}
|
|
77
80
|
onRequestClose={onClose}
|
|
78
81
|
animationType="fade"
|
|
82
|
+
testID={testID}
|
|
79
83
|
>
|
|
80
84
|
<Pressable onPress={onClose} style={styles.overlay}>
|
|
81
85
|
<Pressable style={styles.modalView}>
|