@dloizides/ui-feedback 1.11.0 → 1.12.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 +17 -1
- package/dist/index.d.mts +32 -6
- package/dist/index.d.ts +32 -6
- package/dist/index.js +178 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -90
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useMemo, useContext, useCallback, useState, useEffect, useSyncExternalStore, Component, useRef } from 'react';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { StyleSheet, Platform,
|
|
3
|
+
import { StyleSheet, Platform, TouchableOpacity, Text, View, ActivityIndicator, Modal, Animated } from 'react-native';
|
|
4
4
|
import { Skeleton } from '@dloizides/ui-motion';
|
|
5
5
|
|
|
6
6
|
// src/context/FeedbackUiContext.tsx
|
|
@@ -58,57 +58,146 @@ var FEEDBACK_TEST_IDS = {
|
|
|
58
58
|
warmingOverlay: "warming-overlay",
|
|
59
59
|
errorBoundary: "error-boundary"
|
|
60
60
|
};
|
|
61
|
-
var
|
|
62
|
-
var
|
|
61
|
+
var WELL_SIZE = 56;
|
|
62
|
+
var WELL_MARGIN_BOTTOM = 16;
|
|
63
|
+
var WELL_TINT_OPACITY = 0.12;
|
|
63
64
|
var BUTTON_MARGIN_TOP = 12;
|
|
64
65
|
var BUTTON_PADDING_V = 8;
|
|
65
66
|
var BUTTON_PADDING_H = 16;
|
|
66
67
|
var BUTTON_BORDER_RADIUS = 6;
|
|
68
|
+
var BUTTON_BORDER_WIDTH = 1;
|
|
67
69
|
var BUTTON_FONT_SIZE = 14;
|
|
68
70
|
var styles = StyleSheet.create({
|
|
71
|
+
well: {
|
|
72
|
+
width: WELL_SIZE,
|
|
73
|
+
height: WELL_SIZE,
|
|
74
|
+
borderRadius: WELL_SIZE / 2,
|
|
75
|
+
marginBottom: WELL_MARGIN_BOTTOM,
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
justifyContent: "center",
|
|
78
|
+
overflow: "hidden"
|
|
79
|
+
},
|
|
80
|
+
wellTint: {
|
|
81
|
+
...StyleSheet.absoluteFillObject,
|
|
82
|
+
opacity: WELL_TINT_OPACITY
|
|
83
|
+
},
|
|
84
|
+
secondaryButton: {
|
|
85
|
+
marginTop: BUTTON_MARGIN_TOP,
|
|
86
|
+
paddingVertical: BUTTON_PADDING_V,
|
|
87
|
+
paddingHorizontal: BUTTON_PADDING_H,
|
|
88
|
+
borderRadius: BUTTON_BORDER_RADIUS,
|
|
89
|
+
borderWidth: BUTTON_BORDER_WIDTH
|
|
90
|
+
},
|
|
91
|
+
secondaryText: {
|
|
92
|
+
fontSize: BUTTON_FONT_SIZE,
|
|
93
|
+
fontWeight: "600"
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
var ErrorStateIconWell = ({ icon, tint, testID }) => /* @__PURE__ */ jsxs(View, { "aria-hidden": true, style: styles.well, testID, children: [
|
|
97
|
+
/* @__PURE__ */ jsx(View, { style: [styles.wellTint, { backgroundColor: tint }] }),
|
|
98
|
+
icon
|
|
99
|
+
] });
|
|
100
|
+
var ErrorStateSecondaryButton = ({
|
|
101
|
+
action,
|
|
102
|
+
theme
|
|
103
|
+
}) => /* @__PURE__ */ jsx(
|
|
104
|
+
TouchableOpacity,
|
|
105
|
+
{
|
|
106
|
+
accessibilityHint: action.hint,
|
|
107
|
+
accessibilityLabel: action.label,
|
|
108
|
+
accessibilityRole: "button",
|
|
109
|
+
style: [styles.secondaryButton, { borderColor: theme.colors.border }],
|
|
110
|
+
testID: action.testID,
|
|
111
|
+
onPress: action.onPress,
|
|
112
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles.secondaryText, { color: theme.colors.text }], children: action.label })
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
var MESSAGE_FONT_SIZE = 16;
|
|
116
|
+
var CONTAINER_PADDING = 20;
|
|
117
|
+
var BUTTON_MARGIN_TOP2 = 12;
|
|
118
|
+
var BUTTON_PADDING_V2 = 8;
|
|
119
|
+
var BUTTON_PADDING_H2 = 16;
|
|
120
|
+
var BUTTON_BORDER_RADIUS2 = 6;
|
|
121
|
+
var BUTTON_FONT_SIZE2 = 14;
|
|
122
|
+
var TITLE_FONT_SIZE = 20;
|
|
123
|
+
var TITLE_MARGIN_BOTTOM = 8;
|
|
124
|
+
var ACTION_GAP = 12;
|
|
125
|
+
var styles2 = StyleSheet.create({
|
|
69
126
|
container: {
|
|
70
127
|
flex: 1,
|
|
71
128
|
justifyContent: "center",
|
|
72
129
|
alignItems: "center",
|
|
73
130
|
padding: CONTAINER_PADDING
|
|
74
131
|
},
|
|
132
|
+
title: {
|
|
133
|
+
fontSize: TITLE_FONT_SIZE,
|
|
134
|
+
fontWeight: "600",
|
|
135
|
+
textAlign: "center",
|
|
136
|
+
marginBottom: TITLE_MARGIN_BOTTOM
|
|
137
|
+
},
|
|
75
138
|
message: {
|
|
76
139
|
fontSize: MESSAGE_FONT_SIZE,
|
|
77
140
|
textAlign: "center"
|
|
78
141
|
},
|
|
142
|
+
actions: {
|
|
143
|
+
flexDirection: "row",
|
|
144
|
+
flexWrap: "wrap",
|
|
145
|
+
justifyContent: "center",
|
|
146
|
+
columnGap: ACTION_GAP
|
|
147
|
+
},
|
|
79
148
|
retryButton: {
|
|
80
|
-
marginTop:
|
|
81
|
-
paddingVertical:
|
|
82
|
-
paddingHorizontal:
|
|
83
|
-
borderRadius:
|
|
149
|
+
marginTop: BUTTON_MARGIN_TOP2,
|
|
150
|
+
paddingVertical: BUTTON_PADDING_V2,
|
|
151
|
+
paddingHorizontal: BUTTON_PADDING_H2,
|
|
152
|
+
borderRadius: BUTTON_BORDER_RADIUS2
|
|
84
153
|
},
|
|
85
154
|
retryText: {
|
|
86
|
-
fontSize:
|
|
155
|
+
fontSize: BUTTON_FONT_SIZE2,
|
|
87
156
|
fontWeight: "600"
|
|
88
157
|
}
|
|
89
158
|
});
|
|
90
159
|
var ErrorState = ({
|
|
91
160
|
message,
|
|
92
161
|
onRetry,
|
|
93
|
-
testID = FEEDBACK_TEST_IDS.errorState
|
|
162
|
+
testID = FEEDBACK_TEST_IDS.errorState,
|
|
163
|
+
title,
|
|
164
|
+
icon,
|
|
165
|
+
secondaryAction
|
|
94
166
|
}) => {
|
|
95
167
|
const { theme, t } = useFeedbackUi();
|
|
96
168
|
const errorColor = theme.semantic.error["500"];
|
|
97
169
|
const primary = theme.palette.primary["500"];
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
170
|
+
const hasTitle = typeof title === "string" && title !== "";
|
|
171
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
172
|
+
const messageColor = hasTitle ? theme.colors.textSecondary : errorColor;
|
|
173
|
+
const retry = typeof onRetry === "function" ? /* @__PURE__ */ jsx(
|
|
174
|
+
TouchableOpacity,
|
|
175
|
+
{
|
|
176
|
+
accessibilityHint: t("common.retryHint"),
|
|
177
|
+
accessibilityLabel: t("common.retry"),
|
|
178
|
+
accessibilityRole: "button",
|
|
179
|
+
style: [styles2.retryButton, { backgroundColor: primary }],
|
|
180
|
+
testID: FEEDBACK_TEST_IDS.errorStateRetry,
|
|
181
|
+
onPress: onRetry,
|
|
182
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles2.retryText, { color: theme.colors.surfaceElevated }], children: t("common.retry") })
|
|
183
|
+
}
|
|
184
|
+
) : null;
|
|
185
|
+
return /* @__PURE__ */ jsxs(View, { style: styles2.container, testID, children: [
|
|
186
|
+
hasIcon ? /* @__PURE__ */ jsx(ErrorStateIconWell, { icon, testID: `${testID}-icon`, tint: errorColor }) : null,
|
|
187
|
+
hasTitle ? /* @__PURE__ */ jsx(
|
|
188
|
+
Text,
|
|
102
189
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
testID: FEEDBACK_TEST_IDS.errorStateRetry,
|
|
108
|
-
onPress: onRetry,
|
|
109
|
-
children: /* @__PURE__ */ jsx(Text, { style: [styles.retryText, { color: theme.colors.surfaceElevated }], children: t("common.retry") })
|
|
190
|
+
accessibilityRole: "header",
|
|
191
|
+
style: [styles2.title, { color: theme.colors.text }],
|
|
192
|
+
testID: `${testID}-title`,
|
|
193
|
+
children: title
|
|
110
194
|
}
|
|
111
|
-
) : null
|
|
195
|
+
) : null,
|
|
196
|
+
/* @__PURE__ */ jsx(Text, { style: [styles2.message, { color: messageColor }], children: message }),
|
|
197
|
+
secondaryAction === void 0 ? retry : /* @__PURE__ */ jsxs(View, { style: styles2.actions, children: [
|
|
198
|
+
retry,
|
|
199
|
+
/* @__PURE__ */ jsx(ErrorStateSecondaryButton, { action: secondaryAction, theme })
|
|
200
|
+
] })
|
|
112
201
|
] });
|
|
113
202
|
};
|
|
114
203
|
var MESSAGE_FONT_SIZE2 = 16;
|
|
@@ -118,7 +207,7 @@ var CTA_PADDING_HORIZONTAL = 20;
|
|
|
118
207
|
var CTA_BORDER_RADIUS = 8;
|
|
119
208
|
var CTA_FONT_SIZE = 14;
|
|
120
209
|
var CONTAINER_PADDING2 = 32;
|
|
121
|
-
var
|
|
210
|
+
var styles3 = StyleSheet.create({
|
|
122
211
|
container: {
|
|
123
212
|
flex: 1,
|
|
124
213
|
justifyContent: "center",
|
|
@@ -154,25 +243,25 @@ var EmptyListState = ({
|
|
|
154
243
|
if (typeof ctaRoute === "string" && typeof navigate === "function") navigate(ctaRoute);
|
|
155
244
|
}, [navigate, ctaRoute]);
|
|
156
245
|
const showCta = typeof ctaTextKey === "string" && typeof ctaHintKey === "string" && typeof ctaRoute === "string";
|
|
157
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
158
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
246
|
+
return /* @__PURE__ */ jsxs(View, { style: styles3.container, testID, children: [
|
|
247
|
+
/* @__PURE__ */ jsx(Text, { style: [styles3.message, { color: colors.textSecondary }], children: t(messageKey) }),
|
|
159
248
|
showCta ? /* @__PURE__ */ jsx(
|
|
160
249
|
TouchableOpacity,
|
|
161
250
|
{
|
|
162
251
|
accessibilityHint: t(ctaHintKey),
|
|
163
252
|
accessibilityLabel: t(ctaTextKey),
|
|
164
253
|
accessibilityRole: "button",
|
|
165
|
-
style: [
|
|
254
|
+
style: [styles3.ctaButton, { backgroundColor: primary }],
|
|
166
255
|
testID: FEEDBACK_TEST_IDS.emptyListCta,
|
|
167
256
|
onPress: handlePress,
|
|
168
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
257
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles3.ctaText, { color: colors.background }], children: t(ctaTextKey) })
|
|
169
258
|
}
|
|
170
259
|
) : null
|
|
171
260
|
] });
|
|
172
261
|
};
|
|
173
262
|
var FULLSCREEN_MIN_HEIGHT = 300;
|
|
174
263
|
var CONTAINER_MIN_HEIGHT = 100;
|
|
175
|
-
var
|
|
264
|
+
var styles4 = StyleSheet.create({
|
|
176
265
|
container: {
|
|
177
266
|
flex: 1,
|
|
178
267
|
justifyContent: "center",
|
|
@@ -193,7 +282,7 @@ var LoadingFallback = ({ fullScreen = false, size = "large" }) => {
|
|
|
193
282
|
accessibilityHint: t("loadingFallback.hint"),
|
|
194
283
|
accessibilityLabel: t("loadingFallback.label"),
|
|
195
284
|
accessibilityRole: "progressbar",
|
|
196
|
-
style: [
|
|
285
|
+
style: [styles4.container, fullScreen && styles4.fullScreen, { backgroundColor: colors.background }],
|
|
197
286
|
testID: FEEDBACK_TEST_IDS.loadingFallback,
|
|
198
287
|
children: /* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size })
|
|
199
288
|
}
|
|
@@ -210,7 +299,7 @@ var TEXT_LINE_HEIGHT = 16;
|
|
|
210
299
|
var TEXT_LINE_FULL_WIDTH = "100%";
|
|
211
300
|
var TEXT_LINE_SHORT_WIDTH = "70%";
|
|
212
301
|
var CARD_HEIGHT = 120;
|
|
213
|
-
var
|
|
302
|
+
var styles5 = StyleSheet.create({
|
|
214
303
|
container: {
|
|
215
304
|
flex: 1,
|
|
216
305
|
padding: 16
|
|
@@ -244,25 +333,25 @@ var PageSkeleton = ({
|
|
|
244
333
|
const { theme, t } = useFeedbackUi();
|
|
245
334
|
const colors = theme.colors;
|
|
246
335
|
const skeletonColor = String(colors.border);
|
|
247
|
-
const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style:
|
|
336
|
+
const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style: styles5.row, children: [
|
|
248
337
|
/* @__PURE__ */ jsx(
|
|
249
338
|
Skeleton,
|
|
250
339
|
{
|
|
251
340
|
backgroundColor: skeletonColor,
|
|
252
341
|
borderRadius: AVATAR_BORDER_RADIUS,
|
|
253
342
|
height: AVATAR_SIZE,
|
|
254
|
-
style:
|
|
343
|
+
style: styles5.avatar,
|
|
255
344
|
width: AVATAR_SIZE
|
|
256
345
|
}
|
|
257
346
|
),
|
|
258
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
347
|
+
/* @__PURE__ */ jsxs(View, { style: styles5.textContainer, children: [
|
|
259
348
|
/* @__PURE__ */ jsx(
|
|
260
349
|
Skeleton,
|
|
261
350
|
{
|
|
262
351
|
backgroundColor: skeletonColor,
|
|
263
352
|
borderRadius: SKELETON_BORDER_RADIUS,
|
|
264
353
|
height: TEXT_LINE_HEIGHT,
|
|
265
|
-
style:
|
|
354
|
+
style: styles5.textLine,
|
|
266
355
|
width: TEXT_LINE_FULL_WIDTH
|
|
267
356
|
}
|
|
268
357
|
),
|
|
@@ -272,7 +361,7 @@ var PageSkeleton = ({
|
|
|
272
361
|
backgroundColor: skeletonColor,
|
|
273
362
|
borderRadius: SKELETON_BORDER_RADIUS,
|
|
274
363
|
height: TEXT_LINE_HEIGHT,
|
|
275
|
-
style:
|
|
364
|
+
style: styles5.textLine,
|
|
276
365
|
width: TEXT_LINE_SHORT_WIDTH
|
|
277
366
|
}
|
|
278
367
|
)
|
|
@@ -284,7 +373,7 @@ var PageSkeleton = ({
|
|
|
284
373
|
backgroundColor: skeletonColor,
|
|
285
374
|
borderRadius: CARD_BORDER_RADIUS,
|
|
286
375
|
height: CARD_HEIGHT,
|
|
287
|
-
style:
|
|
376
|
+
style: styles5.card
|
|
288
377
|
},
|
|
289
378
|
index
|
|
290
379
|
);
|
|
@@ -295,7 +384,7 @@ var PageSkeleton = ({
|
|
|
295
384
|
accessibilityHint: t("pageSkeleton.loadingHint"),
|
|
296
385
|
accessibilityLabel: t("pageSkeleton.loadingLabel"),
|
|
297
386
|
accessibilityState: { busy: true },
|
|
298
|
-
style: [
|
|
387
|
+
style: [styles5.container, { backgroundColor: colors.background }],
|
|
299
388
|
testID: FEEDBACK_TEST_IDS.pageSkeleton,
|
|
300
389
|
children: [
|
|
301
390
|
showHeader ? /* @__PURE__ */ jsx(
|
|
@@ -304,7 +393,7 @@ var PageSkeleton = ({
|
|
|
304
393
|
backgroundColor: skeletonColor,
|
|
305
394
|
borderRadius: SKELETON_BORDER_RADIUS,
|
|
306
395
|
height: HEADER_HEIGHT,
|
|
307
|
-
style:
|
|
396
|
+
style: styles5.header,
|
|
308
397
|
width: HEADER_WIDTH
|
|
309
398
|
}
|
|
310
399
|
) : null,
|
|
@@ -329,7 +418,7 @@ var AsyncSurface = ({
|
|
|
329
418
|
return children;
|
|
330
419
|
};
|
|
331
420
|
var DIALOG_MAX_WIDTH = 400;
|
|
332
|
-
var
|
|
421
|
+
var styles6 = StyleSheet.create({
|
|
333
422
|
overlay: {
|
|
334
423
|
flex: 1,
|
|
335
424
|
backgroundColor: MODAL_OVERLAY_COLOR,
|
|
@@ -419,17 +508,17 @@ var ConfirmDialog = ({
|
|
|
419
508
|
animationType: "fade",
|
|
420
509
|
visible,
|
|
421
510
|
onRequestClose: onCancel,
|
|
422
|
-
children: /* @__PURE__ */ jsx(View, { style:
|
|
511
|
+
children: /* @__PURE__ */ jsx(View, { style: styles6.overlay, testID: FEEDBACK_TEST_IDS.confirmDialog, children: /* @__PURE__ */ jsxs(
|
|
423
512
|
View,
|
|
424
513
|
{
|
|
425
514
|
accessibilityViewIsModal: true,
|
|
426
515
|
"aria-label": title,
|
|
427
516
|
role: "dialog",
|
|
428
|
-
style: [
|
|
517
|
+
style: [styles6.dialog, colorStyles.dialog],
|
|
429
518
|
children: [
|
|
430
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
431
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
432
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
519
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.title, colorStyles.title], children: title }),
|
|
520
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.message, colorStyles.message], children: message }),
|
|
521
|
+
/* @__PURE__ */ jsxs(View, { style: styles6.buttonRow, children: [
|
|
433
522
|
/* @__PURE__ */ jsx(
|
|
434
523
|
TouchableOpacity,
|
|
435
524
|
{
|
|
@@ -437,13 +526,13 @@ var ConfirmDialog = ({
|
|
|
437
526
|
accessibilityLabel: resolvedCancelLabel,
|
|
438
527
|
accessibilityRole: "button",
|
|
439
528
|
style: [
|
|
440
|
-
|
|
441
|
-
|
|
529
|
+
styles6.button,
|
|
530
|
+
styles6.cancelButton,
|
|
442
531
|
colorStyles.cancelButton
|
|
443
532
|
],
|
|
444
533
|
testID: FEEDBACK_TEST_IDS.cancelConfirmButton,
|
|
445
534
|
onPress: onCancel,
|
|
446
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
535
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.buttonText, colorStyles.cancelButtonText], children: resolvedCancelLabel })
|
|
447
536
|
}
|
|
448
537
|
),
|
|
449
538
|
/* @__PURE__ */ jsx(
|
|
@@ -455,10 +544,10 @@ var ConfirmDialog = ({
|
|
|
455
544
|
accessibilityState: { disabled: isConfirmDisabled },
|
|
456
545
|
disabled: isConfirmDisabled,
|
|
457
546
|
style: [
|
|
458
|
-
|
|
459
|
-
|
|
547
|
+
styles6.button,
|
|
548
|
+
styles6.confirmButton,
|
|
460
549
|
colorStyles.confirmButton,
|
|
461
|
-
isConfirmDisabled &&
|
|
550
|
+
isConfirmDisabled && styles6.disabledButton
|
|
462
551
|
],
|
|
463
552
|
testID: FEEDBACK_TEST_IDS.confirmButton,
|
|
464
553
|
onPress: onConfirm,
|
|
@@ -472,7 +561,7 @@ var ConfirmDialog = ({
|
|
|
472
561
|
) : /* @__PURE__ */ jsx(
|
|
473
562
|
Text,
|
|
474
563
|
{
|
|
475
|
-
style: [
|
|
564
|
+
style: [styles6.buttonText, colorStyles.confirmButtonText],
|
|
476
565
|
children: resolvedConfirmLabel
|
|
477
566
|
}
|
|
478
567
|
)
|
|
@@ -504,7 +593,7 @@ var C1_CONTROL_END = 159;
|
|
|
504
593
|
var ZERO_WIDTH_START = 8203;
|
|
505
594
|
var ZERO_WIDTH_END = 8207;
|
|
506
595
|
var BYTE_ORDER_MARK = 65279;
|
|
507
|
-
var
|
|
596
|
+
var styles7 = StyleSheet.create({
|
|
508
597
|
container: {
|
|
509
598
|
position: "absolute",
|
|
510
599
|
top: Platform.OS === "web" ? TOAST_TOP_WEB : TOAST_TOP_MOBILE,
|
|
@@ -569,9 +658,9 @@ var ToastItem = ({ message, onDone, colors, durationMs, fadeMs, testID }) => {
|
|
|
569
658
|
{
|
|
570
659
|
accessibilityLiveRegion: isError ? "assertive" : "polite",
|
|
571
660
|
role: isError ? "alert" : "status",
|
|
572
|
-
style: [
|
|
661
|
+
style: [styles7.toast, { backgroundColor, transform: [{ translateY }], opacity }],
|
|
573
662
|
testID,
|
|
574
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
663
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles7.text, { color: colors.text }], children: message.text })
|
|
575
664
|
}
|
|
576
665
|
);
|
|
577
666
|
};
|
|
@@ -609,7 +698,7 @@ var ToastHost = ({
|
|
|
609
698
|
}, []);
|
|
610
699
|
useEffect(() => subscribe(push), [subscribe, push]);
|
|
611
700
|
if (messages.length === 0) return null;
|
|
612
|
-
return /* @__PURE__ */ jsx(View, { style:
|
|
701
|
+
return /* @__PURE__ */ jsx(View, { style: styles7.container, children: messages.map((m) => /* @__PURE__ */ jsx(
|
|
613
702
|
ToastItem,
|
|
614
703
|
{
|
|
615
704
|
colors,
|
|
@@ -680,12 +769,12 @@ function getWarmingSnapshot() {
|
|
|
680
769
|
}
|
|
681
770
|
var OVERLAY_Z_INDEX = 1e5;
|
|
682
771
|
var CARD_GAP = 12;
|
|
683
|
-
var
|
|
772
|
+
var TITLE_FONT_SIZE2 = 20;
|
|
684
773
|
var SUBTITLE_FONT_SIZE = 15;
|
|
685
774
|
var ATTEMPT_FONT_SIZE = 13;
|
|
686
775
|
var CARD_PADDING = 24;
|
|
687
776
|
var NO_ATTEMPT = 0;
|
|
688
|
-
var
|
|
777
|
+
var styles8 = StyleSheet.create({
|
|
689
778
|
overlay: {
|
|
690
779
|
position: "absolute",
|
|
691
780
|
top: 0,
|
|
@@ -704,7 +793,7 @@ var styles7 = StyleSheet.create({
|
|
|
704
793
|
maxWidth: 320
|
|
705
794
|
},
|
|
706
795
|
title: {
|
|
707
|
-
fontSize:
|
|
796
|
+
fontSize: TITLE_FONT_SIZE2,
|
|
708
797
|
fontWeight: "700",
|
|
709
798
|
textAlign: "center"
|
|
710
799
|
},
|
|
@@ -742,13 +831,13 @@ var WarmingOverlay = ({
|
|
|
742
831
|
{
|
|
743
832
|
accessibilityLabel: mergedLabels.accessibilityLabel,
|
|
744
833
|
accessibilityRole: "alert",
|
|
745
|
-
style: [
|
|
834
|
+
style: [styles8.overlay, { backgroundColor: colors.background }],
|
|
746
835
|
testID: testIdPrefix,
|
|
747
|
-
children: /* @__PURE__ */ jsxs(View, { style:
|
|
836
|
+
children: /* @__PURE__ */ jsxs(View, { style: styles8.card, children: [
|
|
748
837
|
/* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size: "large" }),
|
|
749
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
750
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
751
|
-
showHint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
838
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.title, { color: colors.text }], testID: `${testIdPrefix}-title`, children: mergedLabels.title }),
|
|
839
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.subtitle, { color: colors.textSecondary }], testID: `${testIdPrefix}-subtitle`, children: mergedLabels.subtitle }),
|
|
840
|
+
showHint ? /* @__PURE__ */ jsx(Text, { style: [styles8.attempt, { color: colors.textSecondary }], testID: `${testIdPrefix}-attempt`, children: mergedLabels.attemptHint(snapshot2.attempt) }) : null
|
|
752
841
|
] })
|
|
753
842
|
}
|
|
754
843
|
);
|
|
@@ -782,8 +871,8 @@ function createToastBus() {
|
|
|
782
871
|
}
|
|
783
872
|
var CONTAINER_PADDING3 = 20;
|
|
784
873
|
var CONTENT_MAX_WIDTH = 400;
|
|
785
|
-
var
|
|
786
|
-
var
|
|
874
|
+
var TITLE_FONT_SIZE3 = 24;
|
|
875
|
+
var TITLE_MARGIN_BOTTOM2 = 12;
|
|
787
876
|
var DETAILS_PADDING = 12;
|
|
788
877
|
var DETAILS_BORDER_RADIUS = 8;
|
|
789
878
|
var DETAILS_BORDER_WIDTH = 1;
|
|
@@ -791,12 +880,12 @@ var DETAILS_MARGIN_VERTICAL = 16;
|
|
|
791
880
|
var DETAILS_TITLE_FONT_SIZE = 14;
|
|
792
881
|
var DETAILS_TITLE_MARGIN_BOTTOM = 4;
|
|
793
882
|
var DETAILS_TEXT_FONT_SIZE = 12;
|
|
794
|
-
var
|
|
795
|
-
var
|
|
796
|
-
var
|
|
797
|
-
var
|
|
798
|
-
var
|
|
799
|
-
var
|
|
883
|
+
var BUTTON_PADDING_H3 = 24;
|
|
884
|
+
var BUTTON_PADDING_V3 = 12;
|
|
885
|
+
var BUTTON_BORDER_RADIUS3 = 8;
|
|
886
|
+
var BUTTON_MARGIN_TOP3 = 12;
|
|
887
|
+
var BUTTON_FONT_SIZE3 = 16;
|
|
888
|
+
var styles9 = StyleSheet.create({
|
|
800
889
|
container: {
|
|
801
890
|
flex: 1,
|
|
802
891
|
justifyContent: "center",
|
|
@@ -808,9 +897,9 @@ var styles8 = StyleSheet.create({
|
|
|
808
897
|
alignItems: "center"
|
|
809
898
|
},
|
|
810
899
|
title: {
|
|
811
|
-
fontSize:
|
|
900
|
+
fontSize: TITLE_FONT_SIZE3,
|
|
812
901
|
fontWeight: "bold",
|
|
813
|
-
marginBottom:
|
|
902
|
+
marginBottom: TITLE_MARGIN_BOTTOM2,
|
|
814
903
|
textAlign: "center"
|
|
815
904
|
},
|
|
816
905
|
details: {
|
|
@@ -830,13 +919,13 @@ var styles8 = StyleSheet.create({
|
|
|
830
919
|
fontFamily: "monospace"
|
|
831
920
|
},
|
|
832
921
|
button: {
|
|
833
|
-
paddingHorizontal:
|
|
834
|
-
paddingVertical:
|
|
835
|
-
borderRadius:
|
|
836
|
-
marginTop:
|
|
922
|
+
paddingHorizontal: BUTTON_PADDING_H3,
|
|
923
|
+
paddingVertical: BUTTON_PADDING_V3,
|
|
924
|
+
borderRadius: BUTTON_BORDER_RADIUS3,
|
|
925
|
+
marginTop: BUTTON_MARGIN_TOP3
|
|
837
926
|
},
|
|
838
927
|
buttonText: {
|
|
839
|
-
fontSize:
|
|
928
|
+
fontSize: BUTTON_FONT_SIZE3,
|
|
840
929
|
fontWeight: "600"
|
|
841
930
|
}
|
|
842
931
|
});
|
|
@@ -864,10 +953,10 @@ var ErrorBoundaryFallback = ({
|
|
|
864
953
|
accessibilityHint: labels.tryAgainHint,
|
|
865
954
|
accessibilityLabel: labels.tryAgain,
|
|
866
955
|
accessibilityRole: "button",
|
|
867
|
-
style: [
|
|
956
|
+
style: [styles9.button, reloadIsPrimary ? secondaryFill : primaryFill],
|
|
868
957
|
testID: `${testIDPrefix}-retry-button`,
|
|
869
958
|
onPress: onRetry,
|
|
870
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
959
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles9.buttonText, reloadIsPrimary ? secondaryInk : primaryInk], children: labels.tryAgain })
|
|
871
960
|
}
|
|
872
961
|
) : null;
|
|
873
962
|
const reloadButton = typeof onReload === "function" ? /* @__PURE__ */ jsx(
|
|
@@ -876,10 +965,10 @@ var ErrorBoundaryFallback = ({
|
|
|
876
965
|
accessibilityHint: labels.reloadHint,
|
|
877
966
|
accessibilityLabel: labels.reload,
|
|
878
967
|
accessibilityRole: "button",
|
|
879
|
-
style: [
|
|
968
|
+
style: [styles9.button, reloadIsPrimary ? primaryFill : secondaryFill],
|
|
880
969
|
testID: `${testIDPrefix}-reload-button`,
|
|
881
970
|
onPress: onReload,
|
|
882
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
971
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles9.buttonText, reloadIsPrimary ? primaryInk : secondaryInk], children: labels.reload })
|
|
883
972
|
}
|
|
884
973
|
) : null;
|
|
885
974
|
return /* @__PURE__ */ jsx(
|
|
@@ -887,19 +976,19 @@ var ErrorBoundaryFallback = ({
|
|
|
887
976
|
{
|
|
888
977
|
accessibilityLiveRegion: "assertive",
|
|
889
978
|
role: "alert",
|
|
890
|
-
style: [
|
|
979
|
+
style: [styles9.container, { backgroundColor: theme.colors.background }],
|
|
891
980
|
testID: testIDPrefix,
|
|
892
|
-
children: /* @__PURE__ */ jsxs(View, { style:
|
|
893
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
981
|
+
children: /* @__PURE__ */ jsxs(View, { style: styles9.content, children: [
|
|
982
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.title, { color: theme.colors.text }], children: labels.title }),
|
|
894
983
|
/* @__PURE__ */ jsx(ErrorState, { message: labels.message, testID: `${testIDPrefix}-message` }),
|
|
895
984
|
hasDetails ? /* @__PURE__ */ jsxs(
|
|
896
985
|
View,
|
|
897
986
|
{
|
|
898
|
-
style: [
|
|
987
|
+
style: [styles9.details, { backgroundColor: theme.colors.surface, borderColor: warningColor }],
|
|
899
988
|
testID: `${testIDPrefix}-details`,
|
|
900
989
|
children: [
|
|
901
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
902
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
990
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.detailsTitle, { color: warningColor }], children: labels.errorDetails }),
|
|
991
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.detailsText, { color: theme.colors.textSecondary }], children: error.message })
|
|
903
992
|
]
|
|
904
993
|
}
|
|
905
994
|
) : null,
|
|
@@ -912,7 +1001,7 @@ var ErrorBoundaryFallback = ({
|
|
|
912
1001
|
var CONTAINER_PADDING4 = 20;
|
|
913
1002
|
var MESSAGE_FONT_SIZE3 = 16;
|
|
914
1003
|
var MESSAGE_MARGIN_TOP = 12;
|
|
915
|
-
var
|
|
1004
|
+
var styles10 = StyleSheet.create({
|
|
916
1005
|
container: {
|
|
917
1006
|
flex: 1,
|
|
918
1007
|
justifyContent: "center",
|
|
@@ -935,11 +1024,11 @@ var ErrorBoundaryRecovering = ({
|
|
|
935
1024
|
{
|
|
936
1025
|
accessibilityLiveRegion: "polite",
|
|
937
1026
|
role: "status",
|
|
938
|
-
style: [
|
|
1027
|
+
style: [styles10.container, { backgroundColor: theme.colors.background }],
|
|
939
1028
|
testID,
|
|
940
1029
|
children: [
|
|
941
1030
|
/* @__PURE__ */ jsx(ActivityIndicator, { color: theme.palette.primary["500"], size: "large" }),
|
|
942
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1031
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.message, { color: theme.colors.textSecondary }], children: message })
|
|
943
1032
|
]
|
|
944
1033
|
}
|
|
945
1034
|
);
|