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