@controleonline/ui-default 1.0.272 → 1.0.274
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/.github/workflows/publish-npm.yml +91 -0
- package/AGENTS.md +1 -1
- package/docs/technical/DefaultTable.md +70 -1
- package/package.json +22 -22
- package/src/react/components/address/DefaultAddress.js +20 -9
- package/src/react/components/address/DefaultAddressCoordFields.js +59 -0
- package/src/react/components/address/LatLonReadonlyFields.js +2 -2
- package/src/react/components/address/defaultAddressStyles.js +13 -1
- package/src/react/components/files/DefaultFile.js +2 -2
- package/src/react/components/files/DefaultFileColumn.js +1 -1
- package/src/react/components/filters/DefaultColumnFilter.js +2 -7
- package/src/react/components/filters/DefaultExternalFilters.js +4 -11
- package/src/react/components/filters/filterValue.js +65 -0
- package/src/react/components/help/DefaultTooltip.js +73 -63
- package/src/react/components/help/DefaultTooltip.styles.js +23 -23
- package/src/react/components/inputs/DefaultInput.js +301 -210
- package/src/react/components/inputs/defaultInputUtils.js +193 -170
- package/src/react/components/table/DefaultColumnMenu.js +127 -109
- package/src/react/components/table/DefaultTable.js +43 -92
- package/src/react/components/table/DefaultTable.styles.js +10 -4
- package/src/react/components/table/DefaultTable.utils.js +38 -4
- package/src/react/components/table/DefaultTableRows.js +324 -153
- package/src/react/components/table/DefaultTableToolbar.js +17 -7
- package/src/react/components/table/DefaultTableView.js +118 -0
- package/src/react/components/upload/DefaultUpload.js +6 -36
- package/src/react/components/upload/DefaultUpload.styles.js +5 -5
- package/src/react/components/upload/DefaultUploadAttachmentsList.js +11 -3
- package/src/react/hooks/usePostalCodeLookup.js +15 -1
- package/src/react/services/addressFormUtils.js +104 -38
- package/src/react/services/addressGeo.js +6 -3
- package/src/react/utils/tableVisibleColumnsPreferences.js +84 -3
- package/src/tests/react/components/files/DefaultFile.test.js +16 -0
- package/src/tests/react/components/files/DefaultFileColumn.company.test.js +24 -0
- package/src/tests/react/components/help/DefaultTooltip.test.js +93 -0
- package/src/tests/react/components/table/DefaultTable.test.js +37 -0
- package/src/tests/react/components/table/DefaultTable.utils.test.js +10 -0
- package/src/tests/react/components/table/DefaultTableRowActions.test.js +23 -0
- package/src/tests/react/components/table/DefaultTableRows.rowActions.test.js +152 -0
- package/src/tests/react/components/table/DefaultTableToolbar.waiter.test.js +42 -0
- package/src/tests/react/components/upload/defaultUploadLibrary.test.js +31 -9
- package/src/tests/react/filters/filterValue.test.js +46 -0
- package/src/tests/react/hooks/usePostalCodeLookup.test.js +67 -0
- package/src/tests/react/inputs/defaultInputUtils.test.js +9 -1
- package/src/tests/react/services/addressFormUtils.test.js +6 -3
- package/src/tests/react/utils/tableVisibleColumnsPreferences.test.js +12 -1
|
@@ -4,28 +4,32 @@ import styles from './DefaultTooltip.styles';
|
|
|
4
4
|
|
|
5
5
|
const DefaultTooltip = ({
|
|
6
6
|
accentColor = '#0EA5E9',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
accessibilityLabel = 'Abrir ajuda',
|
|
8
|
+
backdropTestID,
|
|
9
|
+
children = null,
|
|
10
|
+
closeAccessibilityLabel = 'Fechar ajuda',
|
|
11
|
+
closeLabel = 'Fechar',
|
|
12
|
+
dialogTestID,
|
|
13
|
+
hitSlop,
|
|
14
|
+
label = '?',
|
|
15
|
+
message = '',
|
|
16
|
+
rows = [],
|
|
17
|
+
style = null,
|
|
18
|
+
testID,
|
|
19
|
+
textStyle = null,
|
|
20
|
+
title = 'Ajuda',
|
|
21
|
+
}) => {
|
|
20
22
|
const [visible, setVisible] = useState(false);
|
|
23
|
+
const hasRows = Array.isArray(rows) && rows.length > 0;
|
|
24
|
+
const hasContent = Boolean(message || children || hasRows);
|
|
21
25
|
|
|
22
26
|
const openTooltip = useCallback(() => {
|
|
23
|
-
if (!
|
|
27
|
+
if (!hasContent) {
|
|
24
28
|
return;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
setVisible(true);
|
|
28
|
-
}, [
|
|
32
|
+
}, [hasContent]);
|
|
29
33
|
|
|
30
34
|
const closeTooltip = useCallback(() => {
|
|
31
35
|
setVisible(false);
|
|
@@ -34,10 +38,11 @@ const DefaultTooltip = ({
|
|
|
34
38
|
return (
|
|
35
39
|
<>
|
|
36
40
|
<TouchableOpacity
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
activeOpacity={0.85}
|
|
40
|
-
disabled={!
|
|
41
|
+
accessibilityLabel={accessibilityLabel}
|
|
42
|
+
accessibilityRole="button"
|
|
43
|
+
activeOpacity={0.85}
|
|
44
|
+
disabled={!hasContent}
|
|
45
|
+
hitSlop={hitSlop}
|
|
41
46
|
onPress={openTooltip}
|
|
42
47
|
style={[
|
|
43
48
|
styles.button,
|
|
@@ -45,13 +50,17 @@ const DefaultTooltip = ({
|
|
|
45
50
|
borderColor: accentColor,
|
|
46
51
|
backgroundColor: `${accentColor}14`,
|
|
47
52
|
},
|
|
48
|
-
!
|
|
49
|
-
style,
|
|
50
|
-
]}
|
|
51
|
-
testID={testID}>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
!hasContent && {opacity: 0.55},
|
|
54
|
+
style,
|
|
55
|
+
]}
|
|
56
|
+
testID={testID}>
|
|
57
|
+
{React.isValidElement(label) ? (
|
|
58
|
+
label
|
|
59
|
+
) : (
|
|
60
|
+
<Text style={[styles.label, {color: accentColor}, textStyle]}>
|
|
61
|
+
{label}
|
|
62
|
+
</Text>
|
|
63
|
+
)}
|
|
55
64
|
</TouchableOpacity>
|
|
56
65
|
|
|
57
66
|
<Modal
|
|
@@ -59,50 +68,51 @@ const DefaultTooltip = ({
|
|
|
59
68
|
onRequestClose={closeTooltip}
|
|
60
69
|
transparent
|
|
61
70
|
visible={visible}>
|
|
62
|
-
<Pressable
|
|
63
|
-
style={styles.overlay}
|
|
64
|
-
onPress={closeTooltip}
|
|
65
|
-
testID={backdropTestID}>
|
|
71
|
+
<Pressable
|
|
72
|
+
style={styles.overlay}
|
|
73
|
+
onPress={closeTooltip}
|
|
74
|
+
testID={backdropTestID}>
|
|
66
75
|
<View
|
|
76
|
+
accessibilityLabel={title}
|
|
77
|
+
accessibilityRole="summary"
|
|
67
78
|
onStartShouldSetResponder={() => true}
|
|
68
79
|
style={[
|
|
69
80
|
styles.card,
|
|
70
81
|
{
|
|
71
82
|
borderColor: accentColor,
|
|
72
83
|
},
|
|
73
|
-
]}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</View>
|
|
84
|
+
]}
|
|
85
|
+
testID={dialogTestID}>
|
|
86
|
+
<View style={styles.cardHeader}>
|
|
87
|
+
<Text style={[styles.title, {color: accentColor}]}>{title}</Text>
|
|
88
|
+
<TouchableOpacity
|
|
89
|
+
accessibilityLabel={closeAccessibilityLabel}
|
|
90
|
+
accessibilityRole="button"
|
|
91
|
+
activeOpacity={0.8}
|
|
92
|
+
onPress={closeTooltip}
|
|
93
|
+
style={[
|
|
94
|
+
styles.closeButton,
|
|
95
|
+
{
|
|
96
|
+
borderColor: accentColor,
|
|
97
|
+
},
|
|
98
|
+
]}>
|
|
99
|
+
<Text style={[styles.closeButtonText, {color: accentColor}]}>
|
|
100
|
+
{closeLabel}
|
|
101
|
+
</Text>
|
|
102
|
+
</TouchableOpacity>
|
|
103
|
+
</View>
|
|
104
|
+
{message ? <Text style={styles.message}>{message}</Text> : null}
|
|
105
|
+
{hasRows
|
|
106
|
+
? rows.map(row => (
|
|
107
|
+
<View key={row.key || row.label} style={styles.row}>
|
|
108
|
+
<Text style={styles.rowLabel}>{row.label}</Text>
|
|
109
|
+
<Text style={styles.rowValue}>
|
|
110
|
+
{String(row.value ?? 'Não configurado')}
|
|
111
|
+
</Text>
|
|
112
|
+
</View>
|
|
113
|
+
))
|
|
114
|
+
: null}
|
|
115
|
+
{children}
|
|
106
116
|
</View>
|
|
107
117
|
</Pressable>
|
|
108
118
|
</Modal>
|
|
@@ -41,31 +41,11 @@ const styles = StyleSheet.create({
|
|
|
41
41
|
fontSize: 15,
|
|
42
42
|
fontWeight: '800',
|
|
43
43
|
},
|
|
44
|
-
message: {
|
|
44
|
+
message: {
|
|
45
45
|
color: '#334155',
|
|
46
46
|
fontSize: 13,
|
|
47
|
-
lineHeight: 19,
|
|
48
|
-
},
|
|
49
|
-
rows: {
|
|
50
|
-
gap: 9,
|
|
51
|
-
},
|
|
52
|
-
row: {
|
|
53
|
-
flexDirection: 'row',
|
|
54
|
-
gap: 12,
|
|
55
|
-
justifyContent: 'space-between',
|
|
56
|
-
},
|
|
57
|
-
rowLabel: {
|
|
58
|
-
color: '#64748B',
|
|
59
|
-
flex: 1,
|
|
60
|
-
fontSize: 12,
|
|
61
|
-
},
|
|
62
|
-
rowValue: {
|
|
63
|
-
color: '#0F172A',
|
|
64
|
-
flex: 1,
|
|
65
|
-
fontSize: 12,
|
|
66
|
-
fontWeight: '700',
|
|
67
|
-
textAlign: 'right',
|
|
68
|
-
},
|
|
47
|
+
lineHeight: 19,
|
|
48
|
+
},
|
|
69
49
|
closeButton: {
|
|
70
50
|
borderRadius: 999,
|
|
71
51
|
borderWidth: 1,
|
|
@@ -76,6 +56,26 @@ const styles = StyleSheet.create({
|
|
|
76
56
|
fontSize: 12,
|
|
77
57
|
fontWeight: '700',
|
|
78
58
|
},
|
|
59
|
+
row: {
|
|
60
|
+
borderTopColor: '#E2E8F0',
|
|
61
|
+
borderTopWidth: 1,
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
justifyContent: 'space-between',
|
|
64
|
+
paddingVertical: 9,
|
|
65
|
+
},
|
|
66
|
+
rowLabel: {
|
|
67
|
+
color: '#64748B',
|
|
68
|
+
fontSize: 13,
|
|
69
|
+
fontWeight: '600',
|
|
70
|
+
},
|
|
71
|
+
rowValue: {
|
|
72
|
+
color: '#0F172A',
|
|
73
|
+
flexShrink: 1,
|
|
74
|
+
fontSize: 13,
|
|
75
|
+
fontWeight: '700',
|
|
76
|
+
marginLeft: 12,
|
|
77
|
+
textAlign: 'right',
|
|
78
|
+
},
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
export default styles;
|