@controleonline/ui-default 1.0.263 → 1.0.265
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/AGENTS.md +47 -45
- package/package.json +20 -20
- package/src/react/components/errors/DefaultErrors.js +307 -325
- package/src/react/components/files/DefaultFile.js +46 -46
- package/src/react/components/filters/CompactFilterSelector.js +78 -24
- package/src/react/components/filters/CompactFilterSelector.styles.js +17 -5
- package/src/react/components/filters/DefaultColumnFilter.js +191 -57
- package/src/react/components/filters/DefaultExternalFilters.js +245 -182
- package/src/react/components/filters/DefaultSearch.js +131 -92
- package/src/react/components/filters/DefaultSearch.styles.js +65 -70
- package/src/react/components/form/DefaultForm.js +172 -151
- package/src/react/components/form/DefaultForm.styles.js +71 -66
- package/src/react/components/help/DefaultTooltip.js +87 -87
- package/src/react/components/help/DefaultTooltip.styles.js +61 -61
- package/src/react/components/inputs/DefaultDateInput.js +150 -0
- package/src/react/components/inputs/DefaultInput.js +162 -127
- package/src/react/components/inputs/DefaultInput.styles.js +6 -0
- package/src/react/components/inputs/DefaultSelect.js +320 -152
- package/src/react/components/inputs/defaultInputUtils.js +40 -19
- package/src/react/components/map/DefaultGoogleMap.styles.js +115 -9
- package/src/react/components/map/DefaultGoogleMap.web.js +560 -446
- package/src/react/components/map/DefaultMap.native.js +73 -71
- package/src/react/components/map/DefaultMap.styles.js +16 -16
- package/src/react/components/map/DefaultMap.web.js +68 -66
- package/src/react/components/map/DefaultNativeMap.native.js +307 -183
- package/src/react/components/map/DefaultNativeMap.shared.js +439 -340
- package/src/react/components/map/DefaultNativeMap.styles.js +156 -122
- package/src/react/components/table/DefaultColumnMenu.js +108 -0
- package/src/react/components/table/DefaultDebug.js +233 -0
- package/src/react/components/table/DefaultFiltersModal.js +142 -0
- package/src/react/components/table/DefaultModalButton.js +18 -0
- package/src/react/components/table/DefaultSearchModal.js +49 -0
- package/src/react/components/table/DefaultTable.js +345 -1846
- package/src/react/components/table/DefaultTable.styles.js +247 -136
- package/src/react/components/table/DefaultTable.utils.js +502 -0
- package/src/react/components/table/DefaultTableBody.js +26 -0
- package/src/react/components/table/DefaultTableCards.js +171 -0
- package/src/react/components/table/DefaultTableControls.js +208 -0
- package/src/react/components/table/DefaultTableEmptyState.js +22 -0
- package/src/react/components/table/DefaultTableFooter.js +172 -0
- package/src/react/components/table/DefaultTableInput.js +145 -0
- package/src/react/components/table/DefaultTableRows.js +340 -0
- package/src/react/components/table/DefaultTableSearch.js +100 -0
- package/src/react/components/table/DefaultTableToolbar.js +98 -0
- package/src/react/components/table/DefaultToolbarAction.js +56 -0
- package/src/react/components/table/useDefaultTablePagination.js +370 -0
- package/src/react/components/table/useDefaultTableSorting.js +126 -0
- package/src/react/components/table/useDefaultTableTheme.js +58 -0
- package/src/react/index.js +10 -10
- package/src/react/utils/tableVisibleColumnsPreferences.js +239 -211
- package/src/store/default/actions.js +51 -13
- package/src/store/default/getters.js +10 -8
- package/src/store/default/mutation_types.js +4 -2
- package/src/store/default/mutations.js +10 -1
- package/src/tests/react/components/errors/DefaultErrors.test.js +162 -162
- package/src/tests/react/components/files/DefaultFile.test.js +80 -80
- package/src/tests/react/components/form/DefaultForm.test.js +81 -0
- package/src/tests/react/components/inputs/DefaultSelect.test.js +185 -0
- package/src/tests/react/components/table/DefaultTable.test.js +1183 -0
- package/src/tests/react/store/defaultActions.test.js +59 -0
- package/src/tests/react/utils/tableVisibleColumnsPreferences.test.js +247 -168
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
2
|
-
import {Modal, Pressable, Text, TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {useStore, useStores} from '@store';
|
|
4
|
-
import resolveSystemErrorMessage from '@controleonline/ui-common/src/react/utils/systemErrorMessage';
|
|
5
|
-
|
|
6
|
-
const AUTO_CLOSE_MS = 5000;
|
|
7
|
-
|
|
8
|
-
const resolveText = value => String(value ?? '').trim();
|
|
9
|
-
|
|
1
|
+
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
2
|
+
import {Modal, Pressable, Text, TouchableOpacity, View} from 'react-native';
|
|
3
|
+
import {useStore, useStores} from '@store';
|
|
4
|
+
import resolveSystemErrorMessage from '@controleonline/ui-common/src/react/utils/systemErrorMessage';
|
|
5
|
+
|
|
6
|
+
const AUTO_CLOSE_MS = 5000;
|
|
7
|
+
|
|
8
|
+
const resolveText = value => String(value ?? '').trim();
|
|
9
|
+
|
|
10
10
|
const normalizeStoreNames = (store, stores) => {
|
|
11
11
|
const resolvedStoreNames = [
|
|
12
12
|
...(Array.isArray(store) ? store : store ? [store] : []),
|
|
@@ -16,345 +16,327 @@ const normalizeStoreNames = (store, stores) => {
|
|
|
16
16
|
return resolvedStoreNames.filter(name => typeof name === 'string' && name.trim()).map(name => name.trim());
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const pickThemeColor = (colors, keys, fallback) => {
|
|
20
|
-
for (const key of keys) {
|
|
21
|
-
const value = colors?.[key];
|
|
22
|
-
|
|
23
|
-
if (typeof value === 'string' && value.trim()) {
|
|
24
|
-
return value.trim();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return fallback;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
19
|
const DefaultErrors = ({
|
|
32
|
-
store = null,
|
|
33
|
-
stores = [],
|
|
34
|
-
error = null,
|
|
35
|
-
title = '',
|
|
36
|
-
message = '',
|
|
37
|
-
compact = false,
|
|
38
|
-
align = 'center',
|
|
39
|
-
onRetry = null,
|
|
40
|
-
retryLabel = 'Tentar novamente',
|
|
41
|
-
containerStyle = null,
|
|
42
|
-
contentStyle = null,
|
|
43
|
-
titleStyle = null,
|
|
44
|
-
messageStyle = null,
|
|
45
|
-
retryButtonStyle = null,
|
|
46
|
-
retryTextStyle = null,
|
|
20
|
+
store = null,
|
|
21
|
+
stores = [],
|
|
22
|
+
error = null,
|
|
23
|
+
title = '',
|
|
24
|
+
message = '',
|
|
25
|
+
compact = false,
|
|
26
|
+
align = 'center',
|
|
27
|
+
onRetry = null,
|
|
28
|
+
retryLabel = 'Tentar novamente',
|
|
29
|
+
containerStyle = null,
|
|
30
|
+
contentStyle = null,
|
|
31
|
+
titleStyle = null,
|
|
32
|
+
messageStyle = null,
|
|
33
|
+
retryButtonStyle = null,
|
|
34
|
+
retryTextStyle = null,
|
|
47
35
|
}) => {
|
|
48
36
|
const themeStore = useStore('theme');
|
|
49
37
|
const themeColors = themeStore?.getters?.colors || {};
|
|
38
|
+
const palette = useMemo(
|
|
39
|
+
() => ({
|
|
40
|
+
buttonBackground: themeColors.buttonBackground,
|
|
41
|
+
buttonBorder: themeColors.buttonBorder,
|
|
42
|
+
buttonText: themeColors.buttonText,
|
|
43
|
+
inputErrorBorder: themeColors.inputErrorBorder,
|
|
44
|
+
inputErrorText: themeColors.inputErrorText,
|
|
45
|
+
modalBackground: themeColors.modalBackground,
|
|
46
|
+
modalBorder: themeColors.modalBorder,
|
|
47
|
+
modalCloseIcon: themeColors.modalCloseIcon,
|
|
48
|
+
modalOverlay: themeColors.modalOverlay,
|
|
49
|
+
modalText: themeColors.modalText,
|
|
50
|
+
}),
|
|
51
|
+
[themeColors],
|
|
52
|
+
);
|
|
50
53
|
const allStores = typeof useStores === 'function' ? useStores(state => state) : null;
|
|
51
|
-
const storeNames = useMemo(() => normalizeStoreNames(store, stores), [store, stores]);
|
|
52
|
-
const watchedStoreEntries = useMemo(() => {
|
|
53
|
-
if (!allStores || storeNames.length === 0) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return storeNames
|
|
58
|
-
.map(storeName => {
|
|
59
|
-
const currentStore = allStores?.[storeName] || null;
|
|
60
|
-
const storeError = resolveSystemErrorMessage(currentStore?.getters?.error);
|
|
61
|
-
|
|
62
|
-
if (!storeError) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
error: storeError,
|
|
68
|
-
name: storeName,
|
|
69
|
-
store: currentStore,
|
|
70
|
-
};
|
|
71
|
-
})
|
|
72
|
-
.filter(Boolean);
|
|
73
|
-
}, [allStores, storeNames]);
|
|
74
|
-
|
|
75
|
-
const explicitTitle = resolveText(title);
|
|
76
|
-
const explicitMessage = resolveText(message) || resolveSystemErrorMessage(error);
|
|
77
|
-
const hasStoreError = watchedStoreEntries.length > 0;
|
|
78
|
-
const activeStoreEntry = watchedStoreEntries[0] || null;
|
|
79
|
-
const visibleMessage = hasStoreError ? activeStoreEntry?.error || '' : explicitMessage;
|
|
80
|
-
const hasExplicitContent = storeNames.length === 0
|
|
81
|
-
? Boolean(explicitTitle || explicitMessage || typeof onRetry === 'function')
|
|
82
|
-
: Boolean(explicitMessage || typeof onRetry === 'function');
|
|
83
|
-
const storeDriverSignature = hasStoreError
|
|
84
|
-
? `store:${watchedStoreEntries.map(entry => `${entry.name}:${entry.error}`).join('|')}`
|
|
85
|
-
: '';
|
|
86
|
-
const explicitDriverSignature = hasExplicitContent
|
|
87
|
-
? `explicit:${[explicitTitle, explicitMessage, typeof onRetry === 'function' ? 'retry' : '']
|
|
88
|
-
.map(value => resolveText(value))
|
|
89
|
-
.filter(Boolean)
|
|
90
|
-
.join('|')}`
|
|
91
|
-
: '';
|
|
92
|
-
const activeDriverSignature = storeDriverSignature || explicitDriverSignature;
|
|
54
|
+
const storeNames = useMemo(() => normalizeStoreNames(store, stores), [store, stores]);
|
|
55
|
+
const watchedStoreEntries = useMemo(() => {
|
|
56
|
+
if (!allStores || storeNames.length === 0) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return storeNames
|
|
61
|
+
.map(storeName => {
|
|
62
|
+
const currentStore = allStores?.[storeName] || null;
|
|
63
|
+
const storeError = resolveSystemErrorMessage(currentStore?.getters?.error);
|
|
64
|
+
|
|
65
|
+
if (!storeError) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
error: storeError,
|
|
71
|
+
name: storeName,
|
|
72
|
+
store: currentStore,
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
.filter(Boolean);
|
|
76
|
+
}, [allStores, storeNames]);
|
|
77
|
+
|
|
78
|
+
const explicitTitle = resolveText(title);
|
|
79
|
+
const explicitMessage = resolveText(message) || resolveSystemErrorMessage(error);
|
|
80
|
+
const hasStoreError = watchedStoreEntries.length > 0;
|
|
81
|
+
const activeStoreEntry = watchedStoreEntries[0] || null;
|
|
82
|
+
const visibleMessage = hasStoreError ? activeStoreEntry?.error || '' : explicitMessage;
|
|
83
|
+
const hasExplicitContent = storeNames.length === 0
|
|
84
|
+
? Boolean(explicitTitle || explicitMessage || typeof onRetry === 'function')
|
|
85
|
+
: Boolean(explicitMessage || typeof onRetry === 'function');
|
|
86
|
+
const storeDriverSignature = hasStoreError
|
|
87
|
+
? `store:${watchedStoreEntries.map(entry => `${entry.name}:${entry.error}`).join('|')}`
|
|
88
|
+
: '';
|
|
89
|
+
const explicitDriverSignature = hasExplicitContent
|
|
90
|
+
? `explicit:${[explicitTitle, explicitMessage, typeof onRetry === 'function' ? 'retry' : '']
|
|
91
|
+
.map(value => resolveText(value))
|
|
92
|
+
.filter(Boolean)
|
|
93
|
+
.join('|')}`
|
|
94
|
+
: '';
|
|
95
|
+
const activeDriverSignature = storeDriverSignature || explicitDriverSignature;
|
|
93
96
|
const [dismissedSignatures, setDismissedSignatures] = useState(() => new Set());
|
|
94
97
|
const timerRef = useRef(null);
|
|
95
98
|
const textAlign = align === 'left' ? 'left' : 'center';
|
|
96
|
-
const accentColor =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
{visibleMessage ? (
|
|
273
|
-
<Text
|
|
274
|
-
style={[
|
|
275
|
-
{
|
|
276
|
-
color: messageColor,
|
|
277
|
-
fontSize: compact ? 12 : 13,
|
|
278
|
-
lineHeight: compact ? 18 : 19,
|
|
279
|
-
textAlign,
|
|
280
|
-
},
|
|
281
|
-
messageStyle,
|
|
282
|
-
]}
|
|
283
|
-
>
|
|
284
|
-
{visibleMessage}
|
|
285
|
-
</Text>
|
|
286
|
-
) : null}
|
|
287
|
-
|
|
288
|
-
{typeof onRetry === 'function' ? (
|
|
289
|
-
<TouchableOpacity
|
|
290
|
-
accessibilityRole="button"
|
|
291
|
-
activeOpacity={0.85}
|
|
292
|
-
onPress={onRetry}
|
|
293
|
-
style={[
|
|
99
|
+
const accentColor = palette.inputErrorBorder;
|
|
100
|
+
const backgroundColor = palette.modalBackground;
|
|
101
|
+
const overlayColor = palette.modalOverlay;
|
|
102
|
+
const titleColor = palette.inputErrorText;
|
|
103
|
+
const messageColor = palette.modalText;
|
|
104
|
+
const closeColor = palette.modalCloseIcon;
|
|
105
|
+
const retryBackgroundColor = palette.buttonBackground;
|
|
106
|
+
const retryBorderColor = palette.buttonBorder;
|
|
107
|
+
const retryTextColor = palette.buttonText;
|
|
108
|
+
|
|
109
|
+
const clearStoreErrors = useCallback(() => {
|
|
110
|
+
watchedStoreEntries.forEach(entry => {
|
|
111
|
+
const setError = entry?.store?.actions?.setError;
|
|
112
|
+
|
|
113
|
+
if (typeof setError === 'function') {
|
|
114
|
+
setError('');
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}, [watchedStoreEntries]);
|
|
118
|
+
|
|
119
|
+
const dismissPopup = useCallback(() => {
|
|
120
|
+
if (timerRef.current) {
|
|
121
|
+
clearTimeout(timerRef.current);
|
|
122
|
+
timerRef.current = null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
setDismissedSignatures(previous => {
|
|
126
|
+
const next = new Set(previous);
|
|
127
|
+
|
|
128
|
+
if (storeDriverSignature) {
|
|
129
|
+
next.add(storeDriverSignature);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (explicitDriverSignature) {
|
|
133
|
+
next.add(explicitDriverSignature);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return next;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
clearStoreErrors();
|
|
140
|
+
}, [clearStoreErrors, explicitDriverSignature, storeDriverSignature]);
|
|
141
|
+
|
|
142
|
+
const isVisible = Boolean(activeDriverSignature) && !dismissedSignatures.has(activeDriverSignature);
|
|
143
|
+
const hasContent = Boolean(explicitTitle || visibleMessage || typeof onRetry === 'function');
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (!activeDriverSignature) {
|
|
147
|
+
if (timerRef.current) {
|
|
148
|
+
clearTimeout(timerRef.current);
|
|
149
|
+
timerRef.current = null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
setDismissedSignatures(previous => (previous.size > 0 ? new Set() : previous));
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (!isVisible) {
|
|
157
|
+
if (timerRef.current) {
|
|
158
|
+
clearTimeout(timerRef.current);
|
|
159
|
+
timerRef.current = null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (timerRef.current) {
|
|
166
|
+
clearTimeout(timerRef.current);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
timerRef.current = setTimeout(() => {
|
|
170
|
+
dismissPopup();
|
|
171
|
+
}, AUTO_CLOSE_MS);
|
|
172
|
+
|
|
173
|
+
return () => {
|
|
174
|
+
if (timerRef.current) {
|
|
175
|
+
clearTimeout(timerRef.current);
|
|
176
|
+
timerRef.current = null;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}, [activeDriverSignature, dismissPopup, isVisible]);
|
|
180
|
+
|
|
181
|
+
if (!isVisible || !hasContent) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<Modal
|
|
187
|
+
animationType="fade"
|
|
188
|
+
onRequestClose={dismissPopup}
|
|
189
|
+
transparent
|
|
190
|
+
visible={isVisible}
|
|
191
|
+
>
|
|
192
|
+
<Pressable
|
|
193
|
+
accessibilityRole="button"
|
|
194
|
+
onPress={dismissPopup}
|
|
195
|
+
style={[
|
|
196
|
+
{
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
backgroundColor: overlayColor,
|
|
199
|
+
flex: 1,
|
|
200
|
+
justifyContent: 'center',
|
|
201
|
+
padding: 18,
|
|
202
|
+
},
|
|
203
|
+
]}
|
|
204
|
+
>
|
|
205
|
+
<View
|
|
206
|
+
onStartShouldSetResponder={() => true}
|
|
207
|
+
style={[
|
|
208
|
+
{
|
|
209
|
+
backgroundColor,
|
|
210
|
+
borderColor: accentColor,
|
|
211
|
+
borderRadius: 16,
|
|
212
|
+
borderWidth: 1,
|
|
213
|
+
maxWidth: compact ? 360 : 440,
|
|
214
|
+
padding: compact ? 14 : 16,
|
|
215
|
+
shadowColor: accentColor,
|
|
216
|
+
shadowOffset: {height: 10, width: 0},
|
|
217
|
+
shadowOpacity: 0.12,
|
|
218
|
+
shadowRadius: 18,
|
|
219
|
+
width: '100%',
|
|
220
|
+
elevation: 12,
|
|
221
|
+
},
|
|
222
|
+
containerStyle,
|
|
223
|
+
]}
|
|
224
|
+
>
|
|
225
|
+
<View
|
|
226
|
+
style={[
|
|
227
|
+
{
|
|
228
|
+
alignItems: 'flex-start',
|
|
229
|
+
flexDirection: 'row',
|
|
230
|
+
gap: 10,
|
|
231
|
+
justifyContent: 'space-between',
|
|
232
|
+
},
|
|
233
|
+
contentStyle,
|
|
234
|
+
]}
|
|
235
|
+
>
|
|
236
|
+
<View style={{flex: 1, gap: explicitTitle ? 10 : 8}}>
|
|
237
|
+
{explicitTitle ? (
|
|
238
|
+
<Text
|
|
239
|
+
style={[
|
|
240
|
+
{
|
|
241
|
+
color: titleColor,
|
|
242
|
+
fontSize: compact ? 14 : 15,
|
|
243
|
+
fontWeight: '800',
|
|
244
|
+
textAlign,
|
|
245
|
+
},
|
|
246
|
+
titleStyle,
|
|
247
|
+
]}
|
|
248
|
+
>
|
|
249
|
+
{explicitTitle}
|
|
250
|
+
</Text>
|
|
251
|
+
) : null}
|
|
252
|
+
|
|
253
|
+
{visibleMessage ? (
|
|
254
|
+
<Text
|
|
255
|
+
style={[
|
|
256
|
+
{
|
|
257
|
+
color: messageColor,
|
|
258
|
+
fontSize: compact ? 12 : 13,
|
|
259
|
+
lineHeight: compact ? 18 : 19,
|
|
260
|
+
textAlign,
|
|
261
|
+
},
|
|
262
|
+
messageStyle,
|
|
263
|
+
]}
|
|
264
|
+
>
|
|
265
|
+
{visibleMessage}
|
|
266
|
+
</Text>
|
|
267
|
+
) : null}
|
|
268
|
+
|
|
269
|
+
{typeof onRetry === 'function' ? (
|
|
270
|
+
<TouchableOpacity
|
|
271
|
+
accessibilityRole="button"
|
|
272
|
+
activeOpacity={0.85}
|
|
273
|
+
onPress={onRetry}
|
|
274
|
+
style={[
|
|
294
275
|
{
|
|
295
276
|
alignItems: 'center',
|
|
296
277
|
alignSelf: textAlign === 'left' ? 'flex-start' : 'center',
|
|
297
278
|
borderRadius: 999,
|
|
298
279
|
borderWidth: 1,
|
|
299
|
-
borderColor:
|
|
300
|
-
backgroundColor:
|
|
280
|
+
borderColor: retryBorderColor,
|
|
281
|
+
backgroundColor: retryBackgroundColor,
|
|
301
282
|
marginTop: 4,
|
|
302
283
|
paddingHorizontal: 12,
|
|
303
284
|
paddingVertical: 8,
|
|
304
|
-
},
|
|
305
|
-
retryButtonStyle,
|
|
306
|
-
]}
|
|
307
|
-
>
|
|
308
|
-
<Text
|
|
285
|
+
},
|
|
286
|
+
retryButtonStyle,
|
|
287
|
+
]}
|
|
288
|
+
>
|
|
289
|
+
<Text
|
|
309
290
|
style={[
|
|
310
291
|
{
|
|
311
|
-
color:
|
|
292
|
+
color: retryTextColor,
|
|
312
293
|
fontSize: 12,
|
|
313
294
|
fontWeight: '800',
|
|
314
295
|
},
|
|
315
|
-
retryTextStyle,
|
|
316
|
-
]}
|
|
317
|
-
>
|
|
318
|
-
{retryLabel}
|
|
319
|
-
</Text>
|
|
320
|
-
</TouchableOpacity>
|
|
321
|
-
) : null}
|
|
322
|
-
</View>
|
|
323
|
-
|
|
324
|
-
<TouchableOpacity
|
|
325
|
-
accessibilityLabel="Fechar erro"
|
|
326
|
-
accessibilityRole="button"
|
|
327
|
-
activeOpacity={0.8}
|
|
328
|
-
onPress={dismissPopup}
|
|
329
|
-
testID="default-errors-close"
|
|
330
|
-
style={[
|
|
296
|
+
retryTextStyle,
|
|
297
|
+
]}
|
|
298
|
+
>
|
|
299
|
+
{retryLabel}
|
|
300
|
+
</Text>
|
|
301
|
+
</TouchableOpacity>
|
|
302
|
+
) : null}
|
|
303
|
+
</View>
|
|
304
|
+
|
|
305
|
+
<TouchableOpacity
|
|
306
|
+
accessibilityLabel="Fechar erro"
|
|
307
|
+
accessibilityRole="button"
|
|
308
|
+
activeOpacity={0.8}
|
|
309
|
+
onPress={dismissPopup}
|
|
310
|
+
testID="default-errors-close"
|
|
311
|
+
style={[
|
|
331
312
|
{
|
|
332
313
|
alignItems: 'center',
|
|
333
|
-
|
|
314
|
+
backgroundColor,
|
|
315
|
+
borderColor: palette.modalBorder,
|
|
334
316
|
borderRadius: 999,
|
|
335
317
|
borderWidth: 1,
|
|
336
318
|
height: 28,
|
|
337
|
-
justifyContent: 'center',
|
|
338
|
-
width: 28,
|
|
339
|
-
},
|
|
340
|
-
]}
|
|
341
|
-
>
|
|
342
|
-
<Text
|
|
343
|
-
style={{
|
|
344
|
-
color: closeColor,
|
|
345
|
-
fontSize: 16,
|
|
346
|
-
fontWeight: '800',
|
|
347
|
-
lineHeight: 16,
|
|
348
|
-
}}
|
|
349
|
-
>
|
|
350
|
-
×
|
|
351
|
-
</Text>
|
|
352
|
-
</TouchableOpacity>
|
|
353
|
-
</View>
|
|
354
|
-
</View>
|
|
355
|
-
</Pressable>
|
|
356
|
-
</Modal>
|
|
357
|
-
);
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
export default DefaultErrors;
|
|
319
|
+
justifyContent: 'center',
|
|
320
|
+
width: 28,
|
|
321
|
+
},
|
|
322
|
+
]}
|
|
323
|
+
>
|
|
324
|
+
<Text
|
|
325
|
+
style={{
|
|
326
|
+
color: closeColor,
|
|
327
|
+
fontSize: 16,
|
|
328
|
+
fontWeight: '800',
|
|
329
|
+
lineHeight: 16,
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
×
|
|
333
|
+
</Text>
|
|
334
|
+
</TouchableOpacity>
|
|
335
|
+
</View>
|
|
336
|
+
</View>
|
|
337
|
+
</Pressable>
|
|
338
|
+
</Modal>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export default DefaultErrors;
|