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