@dloizides/ui-feedback 1.17.0 → 1.19.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 +13 -0
- package/dist/index.d.mts +46 -34
- package/dist/index.d.ts +46 -34
- package/dist/index.js +349 -127
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -131
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createContext, useMemo, useContext,
|
|
1
|
+
import { createContext, useMemo, useContext, useState, useRef, useEffect, useCallback, useId, useSyncExternalStore, Component } from 'react';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { Platform, StyleSheet, TouchableOpacity, Text, View, ActivityIndicator, Modal, useWindowDimensions, Animated, Pressable } from 'react-native';
|
|
4
4
|
import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
|
|
5
5
|
import { Skeleton } from '@dloizides/ui-motion';
|
|
6
|
-
import { Z_INDEX, resolveOnBrand } from '@dloizides/design-tokens';
|
|
6
|
+
import { Z_INDEX, resolveOnBrand, UI_DEEP_STEP, UI_MAIN_STEP, isHexColor, canCarryAccessibleInk } from '@dloizides/design-tokens';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
|
|
9
9
|
// src/context/FeedbackUiContext.tsx
|
|
@@ -63,6 +63,147 @@ var FEEDBACK_TEST_IDS = {
|
|
|
63
63
|
progressBar: "progress-bar"
|
|
64
64
|
};
|
|
65
65
|
var MIN_TOUCH_TARGET = 44;
|
|
66
|
+
|
|
67
|
+
// src/ErrorReference/utils/copyText.ts
|
|
68
|
+
var OFFSCREEN_POSITION = "-9999px";
|
|
69
|
+
function hasDom() {
|
|
70
|
+
return typeof document !== "undefined" && document.body !== null;
|
|
71
|
+
}
|
|
72
|
+
function copyViaExecCommand(value) {
|
|
73
|
+
if (!hasDom()) return false;
|
|
74
|
+
const area = document.createElement("textarea");
|
|
75
|
+
area.value = value;
|
|
76
|
+
area.readOnly = true;
|
|
77
|
+
area.setAttribute("aria-hidden", "true");
|
|
78
|
+
area.style.position = "fixed";
|
|
79
|
+
area.style.top = OFFSCREEN_POSITION;
|
|
80
|
+
area.style.left = OFFSCREEN_POSITION;
|
|
81
|
+
area.style.opacity = "0";
|
|
82
|
+
document.body.appendChild(area);
|
|
83
|
+
try {
|
|
84
|
+
area.select();
|
|
85
|
+
area.setSelectionRange(0, value.length);
|
|
86
|
+
return document.execCommand("copy");
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
89
|
+
} finally {
|
|
90
|
+
document.body.removeChild(area);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function hasAsyncClipboard() {
|
|
94
|
+
return typeof navigator !== "undefined" && typeof navigator.clipboard?.writeText === "function";
|
|
95
|
+
}
|
|
96
|
+
async function tryWrite(write) {
|
|
97
|
+
try {
|
|
98
|
+
await write();
|
|
99
|
+
return true;
|
|
100
|
+
} catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function copyText(value, writer) {
|
|
105
|
+
if (value === "") return false;
|
|
106
|
+
if (writer !== void 0 && await tryWrite(() => writer(value))) return true;
|
|
107
|
+
if (hasAsyncClipboard() && await tryWrite(() => navigator.clipboard.writeText(value))) return true;
|
|
108
|
+
return copyViaExecCommand(value);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/ErrorReference/utils/CopyStatus.ts
|
|
112
|
+
var CopyStatus = /* @__PURE__ */ ((CopyStatus2) => {
|
|
113
|
+
CopyStatus2["Idle"] = "idle";
|
|
114
|
+
CopyStatus2["Copied"] = "copied";
|
|
115
|
+
CopyStatus2["Failed"] = "failed";
|
|
116
|
+
return CopyStatus2;
|
|
117
|
+
})(CopyStatus || {});
|
|
118
|
+
|
|
119
|
+
// src/ErrorReference/hooks/useCopyToClipboard.ts
|
|
120
|
+
var COPY_FEEDBACK_MS = 1500;
|
|
121
|
+
function useCopyToClipboard(value, writer) {
|
|
122
|
+
const [status, setStatus] = useState("idle" /* Idle */);
|
|
123
|
+
const timerRef = useRef(null);
|
|
124
|
+
const mountedRef = useRef(true);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
mountedRef.current = true;
|
|
127
|
+
return () => {
|
|
128
|
+
mountedRef.current = false;
|
|
129
|
+
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
130
|
+
};
|
|
131
|
+
}, []);
|
|
132
|
+
const copy = useCallback(() => {
|
|
133
|
+
void copyText(value, writer).then((ok) => {
|
|
134
|
+
if (!mountedRef.current) return;
|
|
135
|
+
setStatus(ok ? "copied" /* Copied */ : "failed" /* Failed */);
|
|
136
|
+
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
137
|
+
timerRef.current = setTimeout(() => {
|
|
138
|
+
if (mountedRef.current) setStatus("idle" /* Idle */);
|
|
139
|
+
}, COPY_FEEDBACK_MS);
|
|
140
|
+
});
|
|
141
|
+
}, [value, writer]);
|
|
142
|
+
return { status, copy };
|
|
143
|
+
}
|
|
144
|
+
var REFERENCE_FONT_SIZE = 13;
|
|
145
|
+
var ROW_GAP = 8;
|
|
146
|
+
var COPY_MIN_WIDTH = 56;
|
|
147
|
+
var COPY_PADDING_H = 8;
|
|
148
|
+
var COPY_RADIUS = 6;
|
|
149
|
+
var MONO_FONT = Platform.select({
|
|
150
|
+
web: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
151
|
+
ios: "Menlo",
|
|
152
|
+
default: "monospace"
|
|
153
|
+
});
|
|
154
|
+
var styles = StyleSheet.create({
|
|
155
|
+
row: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: ROW_GAP },
|
|
156
|
+
label: { fontSize: REFERENCE_FONT_SIZE },
|
|
157
|
+
id: { fontSize: REFERENCE_FONT_SIZE, fontFamily: MONO_FONT },
|
|
158
|
+
copy: {
|
|
159
|
+
minWidth: COPY_MIN_WIDTH,
|
|
160
|
+
minHeight: MIN_TOUCH_TARGET_PX,
|
|
161
|
+
paddingHorizontal: COPY_PADDING_H,
|
|
162
|
+
borderRadius: COPY_RADIUS,
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
justifyContent: "center"
|
|
165
|
+
},
|
|
166
|
+
copyText: { fontSize: REFERENCE_FONT_SIZE, fontWeight: "600" }
|
|
167
|
+
});
|
|
168
|
+
var STATUS_KEY = {
|
|
169
|
+
["idle" /* Idle */]: "common.copy",
|
|
170
|
+
["copied" /* Copied */]: "common.copied",
|
|
171
|
+
["failed" /* Failed */]: "common.copyFailed"
|
|
172
|
+
};
|
|
173
|
+
var Reference = ({ traceId, color, actionColor, testID, style }) => {
|
|
174
|
+
const { t } = useFeedbackUi();
|
|
175
|
+
const { status, copy } = useCopyToClipboard(traceId);
|
|
176
|
+
const copyLabel = t(STATUS_KEY[status]);
|
|
177
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.row, style], testID, children: [
|
|
178
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.label, { color }], children: t("common.errorReference") }),
|
|
179
|
+
/* @__PURE__ */ jsx(Text, { selectable: true, style: [styles.id, { color }], testID: `${testID}-id`, children: traceId }),
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
TouchableOpacity,
|
|
182
|
+
{
|
|
183
|
+
accessibilityHint: t("common.copyHint"),
|
|
184
|
+
accessibilityLabel: copyLabel,
|
|
185
|
+
accessibilityRole: "button",
|
|
186
|
+
style: styles.copy,
|
|
187
|
+
testID: `${testID}-copy`,
|
|
188
|
+
onPress: copy,
|
|
189
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles.copyText, { color: actionColor }], children: copyLabel })
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
] });
|
|
193
|
+
};
|
|
194
|
+
var ErrorReferenceRow = (props) => props.traceId === void 0 ? null : /* @__PURE__ */ jsx(Reference, { ...props, traceId: props.traceId });
|
|
195
|
+
|
|
196
|
+
// src/ErrorReference/utils/readTraceId.ts
|
|
197
|
+
function isRecord(value) {
|
|
198
|
+
return typeof value === "object" && value !== null;
|
|
199
|
+
}
|
|
200
|
+
function readTraceId(error) {
|
|
201
|
+
if (!isRecord(error)) return void 0;
|
|
202
|
+
const id = error.traceId;
|
|
203
|
+
if (typeof id !== "string") return void 0;
|
|
204
|
+
const trimmed = id.trim();
|
|
205
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
206
|
+
}
|
|
66
207
|
var WELL_SIZE = 56;
|
|
67
208
|
var WELL_MARGIN_BOTTOM = 16;
|
|
68
209
|
var WELL_TINT_OPACITY = 0.12;
|
|
@@ -72,7 +213,7 @@ var BUTTON_PADDING_H = 16;
|
|
|
72
213
|
var BUTTON_BORDER_RADIUS = 6;
|
|
73
214
|
var BUTTON_BORDER_WIDTH = 1;
|
|
74
215
|
var BUTTON_FONT_SIZE = 14;
|
|
75
|
-
var
|
|
216
|
+
var styles2 = StyleSheet.create({
|
|
76
217
|
well: {
|
|
77
218
|
width: WELL_SIZE,
|
|
78
219
|
height: WELL_SIZE,
|
|
@@ -101,8 +242,8 @@ var styles = StyleSheet.create({
|
|
|
101
242
|
fontWeight: "600"
|
|
102
243
|
}
|
|
103
244
|
});
|
|
104
|
-
var ErrorStateIconWell = ({ icon, tint, testID }) => /* @__PURE__ */ jsxs(View, { "aria-hidden": true, style:
|
|
105
|
-
/* @__PURE__ */ jsx(View, { style: [
|
|
245
|
+
var ErrorStateIconWell = ({ icon, tint, testID }) => /* @__PURE__ */ jsxs(View, { "aria-hidden": true, style: styles2.well, testID, children: [
|
|
246
|
+
/* @__PURE__ */ jsx(View, { style: [styles2.wellTint, { backgroundColor: tint }] }),
|
|
106
247
|
icon
|
|
107
248
|
] });
|
|
108
249
|
var ErrorStateSecondaryButton = ({
|
|
@@ -114,10 +255,10 @@ var ErrorStateSecondaryButton = ({
|
|
|
114
255
|
accessibilityHint: action.hint,
|
|
115
256
|
accessibilityLabel: action.label,
|
|
116
257
|
accessibilityRole: "button",
|
|
117
|
-
style: [
|
|
258
|
+
style: [styles2.secondaryButton, { borderColor: theme.colors.border }],
|
|
118
259
|
testID: action.testID,
|
|
119
260
|
onPress: action.onPress,
|
|
120
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
261
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles2.secondaryText, { color: theme.colors.text }], children: action.label })
|
|
121
262
|
}
|
|
122
263
|
);
|
|
123
264
|
var MESSAGE_FONT_SIZE = 16;
|
|
@@ -130,7 +271,8 @@ var BUTTON_FONT_SIZE2 = 14;
|
|
|
130
271
|
var TITLE_FONT_SIZE = 20;
|
|
131
272
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
132
273
|
var ACTION_GAP = 12;
|
|
133
|
-
var
|
|
274
|
+
var REFERENCE_MARGIN_TOP = 12;
|
|
275
|
+
var styles3 = StyleSheet.create({
|
|
134
276
|
container: {
|
|
135
277
|
flex: 1,
|
|
136
278
|
justifyContent: "center",
|
|
@@ -162,6 +304,10 @@ var styles2 = StyleSheet.create({
|
|
|
162
304
|
paddingHorizontal: BUTTON_PADDING_H2,
|
|
163
305
|
borderRadius: BUTTON_BORDER_RADIUS2
|
|
164
306
|
},
|
|
307
|
+
reference: {
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
marginTop: REFERENCE_MARGIN_TOP
|
|
310
|
+
},
|
|
165
311
|
retryText: {
|
|
166
312
|
fontSize: BUTTON_FONT_SIZE2,
|
|
167
313
|
fontWeight: "600"
|
|
@@ -173,7 +319,8 @@ var ErrorState = ({
|
|
|
173
319
|
testID = FEEDBACK_TEST_IDS.errorState,
|
|
174
320
|
title,
|
|
175
321
|
icon,
|
|
176
|
-
secondaryAction
|
|
322
|
+
secondaryAction,
|
|
323
|
+
error
|
|
177
324
|
}) => {
|
|
178
325
|
const { theme, t } = useFeedbackUi();
|
|
179
326
|
const errorColor = theme.semantic.error["500"];
|
|
@@ -187,28 +334,38 @@ var ErrorState = ({
|
|
|
187
334
|
accessibilityHint: t("common.retryHint"),
|
|
188
335
|
accessibilityLabel: t("common.retry"),
|
|
189
336
|
accessibilityRole: "button",
|
|
190
|
-
style: [
|
|
337
|
+
style: [styles3.retryButton, { backgroundColor: primary }],
|
|
191
338
|
testID: FEEDBACK_TEST_IDS.errorStateRetry,
|
|
192
339
|
onPress: onRetry,
|
|
193
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
340
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles3.retryText, { color: theme.colors.surfaceElevated }], children: t("common.retry") })
|
|
194
341
|
}
|
|
195
342
|
) : null;
|
|
196
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
343
|
+
return /* @__PURE__ */ jsxs(View, { style: styles3.container, testID, children: [
|
|
197
344
|
hasIcon ? /* @__PURE__ */ jsx(ErrorStateIconWell, { icon, testID: `${testID}-icon`, tint: errorColor }) : null,
|
|
198
345
|
hasTitle ? /* @__PURE__ */ jsx(
|
|
199
346
|
Text,
|
|
200
347
|
{
|
|
201
348
|
accessibilityRole: "header",
|
|
202
|
-
style: [
|
|
349
|
+
style: [styles3.title, { color: theme.colors.text }],
|
|
203
350
|
testID: `${testID}-title`,
|
|
204
351
|
children: title
|
|
205
352
|
}
|
|
206
353
|
) : null,
|
|
207
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
208
|
-
secondaryAction === void 0 ? retry : /* @__PURE__ */ jsxs(View, { style:
|
|
354
|
+
/* @__PURE__ */ jsx(Text, { style: [styles3.message, { color: messageColor }], children: message }),
|
|
355
|
+
secondaryAction === void 0 ? retry : /* @__PURE__ */ jsxs(View, { style: styles3.actions, children: [
|
|
209
356
|
retry,
|
|
210
357
|
/* @__PURE__ */ jsx(ErrorStateSecondaryButton, { action: secondaryAction, theme })
|
|
211
|
-
] })
|
|
358
|
+
] }),
|
|
359
|
+
/* @__PURE__ */ jsx(
|
|
360
|
+
ErrorReferenceRow,
|
|
361
|
+
{
|
|
362
|
+
actionColor: primary,
|
|
363
|
+
color: theme.colors.textSecondary,
|
|
364
|
+
style: styles3.reference,
|
|
365
|
+
testID: `${testID}-reference`,
|
|
366
|
+
traceId: readTraceId(error)
|
|
367
|
+
}
|
|
368
|
+
)
|
|
212
369
|
] });
|
|
213
370
|
};
|
|
214
371
|
var MESSAGE_FONT_SIZE2 = 16;
|
|
@@ -218,7 +375,7 @@ var CTA_PADDING_HORIZONTAL = 20;
|
|
|
218
375
|
var CTA_BORDER_RADIUS = 8;
|
|
219
376
|
var CTA_FONT_SIZE = 14;
|
|
220
377
|
var CONTAINER_PADDING2 = 32;
|
|
221
|
-
var
|
|
378
|
+
var styles4 = StyleSheet.create({
|
|
222
379
|
container: {
|
|
223
380
|
flex: 1,
|
|
224
381
|
justifyContent: "center",
|
|
@@ -254,25 +411,25 @@ var EmptyListState = ({
|
|
|
254
411
|
if (typeof ctaRoute === "string" && typeof navigate === "function") navigate(ctaRoute);
|
|
255
412
|
}, [navigate, ctaRoute]);
|
|
256
413
|
const showCta = typeof ctaTextKey === "string" && typeof ctaHintKey === "string" && typeof ctaRoute === "string";
|
|
257
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
258
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
414
|
+
return /* @__PURE__ */ jsxs(View, { style: styles4.container, testID, children: [
|
|
415
|
+
/* @__PURE__ */ jsx(Text, { style: [styles4.message, { color: colors.textSecondary }], children: t(messageKey) }),
|
|
259
416
|
showCta ? /* @__PURE__ */ jsx(
|
|
260
417
|
TouchableOpacity,
|
|
261
418
|
{
|
|
262
419
|
accessibilityHint: t(ctaHintKey),
|
|
263
420
|
accessibilityLabel: t(ctaTextKey),
|
|
264
421
|
accessibilityRole: "button",
|
|
265
|
-
style: [
|
|
422
|
+
style: [styles4.ctaButton, { backgroundColor: primary }],
|
|
266
423
|
testID: FEEDBACK_TEST_IDS.emptyListCta,
|
|
267
424
|
onPress: handlePress,
|
|
268
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
425
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles4.ctaText, { color: colors.background }], children: t(ctaTextKey) })
|
|
269
426
|
}
|
|
270
427
|
) : null
|
|
271
428
|
] });
|
|
272
429
|
};
|
|
273
430
|
var FULLSCREEN_MIN_HEIGHT = 300;
|
|
274
431
|
var CONTAINER_MIN_HEIGHT = 100;
|
|
275
|
-
var
|
|
432
|
+
var styles5 = StyleSheet.create({
|
|
276
433
|
container: {
|
|
277
434
|
flex: 1,
|
|
278
435
|
justifyContent: "center",
|
|
@@ -293,7 +450,7 @@ var LoadingFallback = ({ fullScreen = false, size = "large" }) => {
|
|
|
293
450
|
accessibilityHint: t("loadingFallback.hint"),
|
|
294
451
|
accessibilityLabel: t("loadingFallback.label"),
|
|
295
452
|
accessibilityRole: "progressbar",
|
|
296
|
-
style: [
|
|
453
|
+
style: [styles5.container, fullScreen && styles5.fullScreen, { backgroundColor: colors.background }],
|
|
297
454
|
testID: FEEDBACK_TEST_IDS.loadingFallback,
|
|
298
455
|
children: /* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size })
|
|
299
456
|
}
|
|
@@ -310,7 +467,7 @@ var TEXT_LINE_HEIGHT = 16;
|
|
|
310
467
|
var TEXT_LINE_FULL_WIDTH = "100%";
|
|
311
468
|
var TEXT_LINE_SHORT_WIDTH = "70%";
|
|
312
469
|
var CARD_HEIGHT = 120;
|
|
313
|
-
var
|
|
470
|
+
var styles6 = StyleSheet.create({
|
|
314
471
|
container: {
|
|
315
472
|
flex: 1,
|
|
316
473
|
padding: 16
|
|
@@ -344,25 +501,25 @@ var PageSkeleton = ({
|
|
|
344
501
|
const { theme, t } = useFeedbackUi();
|
|
345
502
|
const colors = theme.colors;
|
|
346
503
|
const skeletonColor = String(colors.border);
|
|
347
|
-
const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style:
|
|
504
|
+
const renderListRow = (index) => /* @__PURE__ */ jsxs(View, { style: styles6.row, children: [
|
|
348
505
|
/* @__PURE__ */ jsx(
|
|
349
506
|
Skeleton,
|
|
350
507
|
{
|
|
351
508
|
backgroundColor: skeletonColor,
|
|
352
509
|
borderRadius: AVATAR_BORDER_RADIUS,
|
|
353
510
|
height: AVATAR_SIZE,
|
|
354
|
-
style:
|
|
511
|
+
style: styles6.avatar,
|
|
355
512
|
width: AVATAR_SIZE
|
|
356
513
|
}
|
|
357
514
|
),
|
|
358
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
515
|
+
/* @__PURE__ */ jsxs(View, { style: styles6.textContainer, children: [
|
|
359
516
|
/* @__PURE__ */ jsx(
|
|
360
517
|
Skeleton,
|
|
361
518
|
{
|
|
362
519
|
backgroundColor: skeletonColor,
|
|
363
520
|
borderRadius: SKELETON_BORDER_RADIUS,
|
|
364
521
|
height: TEXT_LINE_HEIGHT,
|
|
365
|
-
style:
|
|
522
|
+
style: styles6.textLine,
|
|
366
523
|
width: TEXT_LINE_FULL_WIDTH
|
|
367
524
|
}
|
|
368
525
|
),
|
|
@@ -372,7 +529,7 @@ var PageSkeleton = ({
|
|
|
372
529
|
backgroundColor: skeletonColor,
|
|
373
530
|
borderRadius: SKELETON_BORDER_RADIUS,
|
|
374
531
|
height: TEXT_LINE_HEIGHT,
|
|
375
|
-
style:
|
|
532
|
+
style: styles6.textLine,
|
|
376
533
|
width: TEXT_LINE_SHORT_WIDTH
|
|
377
534
|
}
|
|
378
535
|
)
|
|
@@ -384,7 +541,7 @@ var PageSkeleton = ({
|
|
|
384
541
|
backgroundColor: skeletonColor,
|
|
385
542
|
borderRadius: CARD_BORDER_RADIUS,
|
|
386
543
|
height: CARD_HEIGHT,
|
|
387
|
-
style:
|
|
544
|
+
style: styles6.card
|
|
388
545
|
},
|
|
389
546
|
index
|
|
390
547
|
);
|
|
@@ -395,7 +552,7 @@ var PageSkeleton = ({
|
|
|
395
552
|
accessibilityHint: t("pageSkeleton.loadingHint"),
|
|
396
553
|
accessibilityLabel: t("pageSkeleton.loadingLabel"),
|
|
397
554
|
accessibilityState: { busy: true },
|
|
398
|
-
style: [
|
|
555
|
+
style: [styles6.container, { backgroundColor: colors.background }],
|
|
399
556
|
testID: FEEDBACK_TEST_IDS.pageSkeleton,
|
|
400
557
|
children: [
|
|
401
558
|
showHeader ? /* @__PURE__ */ jsx(
|
|
@@ -404,7 +561,7 @@ var PageSkeleton = ({
|
|
|
404
561
|
backgroundColor: skeletonColor,
|
|
405
562
|
borderRadius: SKELETON_BORDER_RADIUS,
|
|
406
563
|
height: HEADER_HEIGHT,
|
|
407
|
-
style:
|
|
564
|
+
style: styles6.header,
|
|
408
565
|
width: HEADER_WIDTH
|
|
409
566
|
}
|
|
410
567
|
) : null,
|
|
@@ -421,10 +578,11 @@ var AsyncSurface = ({
|
|
|
421
578
|
skeletonRows = DEFAULT_SKELETON_ROWS,
|
|
422
579
|
variant = "list",
|
|
423
580
|
message,
|
|
581
|
+
error,
|
|
424
582
|
children
|
|
425
583
|
}) => {
|
|
426
584
|
const { t } = useFeedbackUi();
|
|
427
|
-
if (isError) return /* @__PURE__ */ jsx(ErrorState, { message: message ?? t("common.loadFailed"), onRetry });
|
|
585
|
+
if (isError) return /* @__PURE__ */ jsx(ErrorState, { error, message: message ?? t("common.loadFailed"), onRetry });
|
|
428
586
|
if (loading) return /* @__PURE__ */ jsx(PageSkeleton, { showHeader: true, rows: skeletonRows, variant });
|
|
429
587
|
return children;
|
|
430
588
|
};
|
|
@@ -435,7 +593,7 @@ function confirmInk(theme, destructive) {
|
|
|
435
593
|
return resolveOnBrand(confirmFill(theme, destructive));
|
|
436
594
|
}
|
|
437
595
|
var DIALOG_MAX_WIDTH = 400;
|
|
438
|
-
var
|
|
596
|
+
var styles7 = StyleSheet.create({
|
|
439
597
|
overlay: {
|
|
440
598
|
flex: 1,
|
|
441
599
|
backgroundColor: MODAL_OVERLAY_COLOR,
|
|
@@ -527,17 +685,17 @@ var ConfirmDialog = ({
|
|
|
527
685
|
animationType: "fade",
|
|
528
686
|
visible,
|
|
529
687
|
onRequestClose: onCancel,
|
|
530
|
-
children: /* @__PURE__ */ jsx(View, { style:
|
|
688
|
+
children: /* @__PURE__ */ jsx(View, { style: styles7.overlay, testID: FEEDBACK_TEST_IDS.confirmDialog, children: /* @__PURE__ */ jsxs(
|
|
531
689
|
View,
|
|
532
690
|
{
|
|
533
691
|
accessibilityViewIsModal: true,
|
|
534
692
|
"aria-label": innerDialogRole === void 0 ? void 0 : title,
|
|
535
693
|
role: innerDialogRole,
|
|
536
|
-
style: [
|
|
694
|
+
style: [styles7.dialog, colorStyles.dialog],
|
|
537
695
|
children: [
|
|
538
|
-
/* @__PURE__ */ jsx(Text, { nativeID: titleId, style: [
|
|
539
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
540
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
696
|
+
/* @__PURE__ */ jsx(Text, { nativeID: titleId, style: [styles7.title, colorStyles.title], children: title }),
|
|
697
|
+
/* @__PURE__ */ jsx(Text, { style: [styles7.message, colorStyles.message], children: message }),
|
|
698
|
+
/* @__PURE__ */ jsxs(View, { style: styles7.buttonRow, children: [
|
|
541
699
|
/* @__PURE__ */ jsx(
|
|
542
700
|
TouchableOpacity,
|
|
543
701
|
{
|
|
@@ -545,13 +703,13 @@ var ConfirmDialog = ({
|
|
|
545
703
|
accessibilityLabel: resolvedCancelLabel,
|
|
546
704
|
accessibilityRole: "button",
|
|
547
705
|
style: [
|
|
548
|
-
|
|
549
|
-
|
|
706
|
+
styles7.button,
|
|
707
|
+
styles7.cancelButton,
|
|
550
708
|
colorStyles.cancelButton
|
|
551
709
|
],
|
|
552
710
|
testID: FEEDBACK_TEST_IDS.cancelConfirmButton,
|
|
553
711
|
onPress: onCancel,
|
|
554
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
712
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles7.buttonText, colorStyles.cancelButtonText], children: resolvedCancelLabel })
|
|
555
713
|
}
|
|
556
714
|
),
|
|
557
715
|
/* @__PURE__ */ jsx(
|
|
@@ -563,10 +721,10 @@ var ConfirmDialog = ({
|
|
|
563
721
|
accessibilityState: { disabled: isConfirmDisabled },
|
|
564
722
|
disabled: isConfirmDisabled,
|
|
565
723
|
style: [
|
|
566
|
-
|
|
567
|
-
|
|
724
|
+
styles7.button,
|
|
725
|
+
styles7.confirmButton,
|
|
568
726
|
colorStyles.confirmButton,
|
|
569
|
-
isConfirmDisabled &&
|
|
727
|
+
isConfirmDisabled && styles7.disabledButton
|
|
570
728
|
],
|
|
571
729
|
testID: FEEDBACK_TEST_IDS.confirmButton,
|
|
572
730
|
onPress: onConfirm,
|
|
@@ -580,7 +738,7 @@ var ConfirmDialog = ({
|
|
|
580
738
|
) : /* @__PURE__ */ jsx(
|
|
581
739
|
Text,
|
|
582
740
|
{
|
|
583
|
-
style: [
|
|
741
|
+
style: [styles7.buttonText, colorStyles.confirmButtonText],
|
|
584
742
|
children: resolvedConfirmLabel
|
|
585
743
|
}
|
|
586
744
|
)
|
|
@@ -593,13 +751,43 @@ var ConfirmDialog = ({
|
|
|
593
751
|
}
|
|
594
752
|
);
|
|
595
753
|
};
|
|
754
|
+
var APP_HEADER_HEIGHT = 64;
|
|
755
|
+
var HEADER_GAP = 8;
|
|
756
|
+
var TOAST_TOP_MOBILE = 40;
|
|
757
|
+
var TOAST_TOP_WEB = APP_HEADER_HEIGHT + HEADER_GAP;
|
|
758
|
+
var GLYPHS = {
|
|
759
|
+
success: "\u2713",
|
|
760
|
+
error: "!",
|
|
761
|
+
info: "i"
|
|
762
|
+
};
|
|
763
|
+
function scaleFor(theme, type) {
|
|
764
|
+
if (type === "error") return theme.semantic.error;
|
|
765
|
+
if (type === "success") return theme.semantic.success ?? theme.palette.primary;
|
|
766
|
+
return theme.palette.primary;
|
|
767
|
+
}
|
|
768
|
+
function readableInk(fill) {
|
|
769
|
+
if (fill === void 0 || !isHexColor(fill) || !canCarryAccessibleInk(fill)) return null;
|
|
770
|
+
return resolveOnBrand(fill);
|
|
771
|
+
}
|
|
772
|
+
function resolveToastTone(theme, type = "info") {
|
|
773
|
+
const scale2 = scaleFor(theme, type);
|
|
774
|
+
const glyph = GLYPHS[type];
|
|
775
|
+
const deep = scale2[UI_DEEP_STEP];
|
|
776
|
+
for (const fill of [scale2[UI_MAIN_STEP], deep]) {
|
|
777
|
+
const ink = readableInk(fill);
|
|
778
|
+
if (ink !== null && fill !== void 0) return { fill, ink, border: fill, glyph };
|
|
779
|
+
}
|
|
780
|
+
return { fill: theme.colors.surfaceElevated, ink: theme.colors.text, border: scale2[UI_MAIN_STEP], glyph };
|
|
781
|
+
}
|
|
782
|
+
function toastTop(isWeb, topInset) {
|
|
783
|
+
if (topInset !== void 0) return topInset;
|
|
784
|
+
return isWeb ? TOAST_TOP_WEB : TOAST_TOP_MOBILE;
|
|
785
|
+
}
|
|
596
786
|
var IS_WEB = Platform.OS === "web";
|
|
597
787
|
var WEB_FIXED_LAYER = { position: "fixed" };
|
|
598
788
|
var DEFAULT_DURATION_MS = 3e3;
|
|
599
789
|
var DEFAULT_FADE_MS = 200;
|
|
600
790
|
var DEFAULT_MAX_LENGTH = 500;
|
|
601
|
-
var TOAST_TOP_WEB = 10;
|
|
602
|
-
var TOAST_TOP_MOBILE = 40;
|
|
603
791
|
var TOAST_HORIZONTAL_MARGIN = 10;
|
|
604
792
|
var TOAST_INITIAL_TRANSLATE_Y = -6;
|
|
605
793
|
var TOAST_MAX_WIDTH = 600;
|
|
@@ -607,16 +795,20 @@ var TOAST_PADDING_HORIZONTAL = 16;
|
|
|
607
795
|
var TOAST_PADDING_VERTICAL = 10;
|
|
608
796
|
var TOAST_BORDER_RADIUS = 8;
|
|
609
797
|
var TOAST_MARGIN_VERTICAL = 6;
|
|
798
|
+
var TOAST_GLYPH_SIZE = 20;
|
|
799
|
+
var TOAST_GLYPH_FONT_SIZE = 12;
|
|
800
|
+
var TOAST_GLYPH_LINE_HEIGHT = 18;
|
|
801
|
+
var TOAST_GLYPH_GAP = 10;
|
|
802
|
+
var TOAST_GLYPH_BORDER = 1.5;
|
|
610
803
|
var C0_CONTROL_END = 31;
|
|
611
804
|
var C1_CONTROL_START = 127;
|
|
612
805
|
var C1_CONTROL_END = 159;
|
|
613
806
|
var ZERO_WIDTH_START = 8203;
|
|
614
807
|
var ZERO_WIDTH_END = 8207;
|
|
615
808
|
var BYTE_ORDER_MARK = 65279;
|
|
616
|
-
var
|
|
809
|
+
var styles8 = StyleSheet.create({
|
|
617
810
|
container: {
|
|
618
811
|
position: "absolute",
|
|
619
|
-
top: Platform.OS === "web" ? TOAST_TOP_WEB : TOAST_TOP_MOBILE,
|
|
620
812
|
left: TOAST_HORIZONTAL_MARGIN,
|
|
621
813
|
right: TOAST_HORIZONTAL_MARGIN,
|
|
622
814
|
alignItems: "center",
|
|
@@ -631,9 +823,27 @@ var styles7 = StyleSheet.create({
|
|
|
631
823
|
minWidth: "40%",
|
|
632
824
|
maxWidth: TOAST_MAX_WIDTH,
|
|
633
825
|
boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.2)",
|
|
634
|
-
elevation: 4
|
|
826
|
+
elevation: 4,
|
|
827
|
+
flexDirection: "row",
|
|
828
|
+
alignItems: "center",
|
|
829
|
+
gap: TOAST_GLYPH_GAP,
|
|
830
|
+
borderWidth: 1
|
|
831
|
+
},
|
|
832
|
+
glyph: {
|
|
833
|
+
width: TOAST_GLYPH_SIZE,
|
|
834
|
+
height: TOAST_GLYPH_SIZE,
|
|
835
|
+
borderRadius: TOAST_GLYPH_SIZE / 2,
|
|
836
|
+
borderWidth: TOAST_GLYPH_BORDER,
|
|
837
|
+
alignItems: "center",
|
|
838
|
+
justifyContent: "center"
|
|
635
839
|
},
|
|
636
|
-
|
|
840
|
+
glyphText: {
|
|
841
|
+
fontSize: TOAST_GLYPH_FONT_SIZE,
|
|
842
|
+
lineHeight: TOAST_GLYPH_LINE_HEIGHT,
|
|
843
|
+
fontWeight: "700"
|
|
844
|
+
},
|
|
845
|
+
body: { flexShrink: 1 },
|
|
846
|
+
text: { flexShrink: 1 }
|
|
637
847
|
});
|
|
638
848
|
function sanitizeToastText(input, maxLength) {
|
|
639
849
|
let stripped = "";
|
|
@@ -645,16 +855,11 @@ function sanitizeToastText(input, maxLength) {
|
|
|
645
855
|
}
|
|
646
856
|
return stripped.length > maxLength ? stripped.slice(0, maxLength) : stripped;
|
|
647
857
|
}
|
|
648
|
-
var ToastItem = ({ message, onDone,
|
|
858
|
+
var ToastItem = ({ message, onDone, tone, durationMs, fadeMs, testID }) => {
|
|
649
859
|
const opacityRef = useRef(new Animated.Value(0));
|
|
650
860
|
const translateYRef = useRef(new Animated.Value(TOAST_INITIAL_TRANSLATE_Y));
|
|
651
861
|
const opacity = opacityRef.current;
|
|
652
862
|
const translateY = translateYRef.current;
|
|
653
|
-
const backgroundColor = useMemo(() => {
|
|
654
|
-
if (message.type === "success") return colors.success;
|
|
655
|
-
if (message.type === "error") return colors.error;
|
|
656
|
-
return colors.primary;
|
|
657
|
-
}, [colors.error, colors.primary, colors.success, message.type]);
|
|
658
863
|
const handleDone = useCallback(() => {
|
|
659
864
|
onDone(message.id);
|
|
660
865
|
}, [message.id, onDone]);
|
|
@@ -673,14 +878,20 @@ var ToastItem = ({ message, onDone, colors, durationMs, fadeMs, testID }) => {
|
|
|
673
878
|
return () => clearTimeout(hideTimer);
|
|
674
879
|
}, [handleDone, opacity, translateY, durationMs, fadeMs]);
|
|
675
880
|
const isError = message.type === "error";
|
|
676
|
-
return /* @__PURE__ */
|
|
881
|
+
return /* @__PURE__ */ jsxs(
|
|
677
882
|
Animated.View,
|
|
678
883
|
{
|
|
679
884
|
accessibilityLiveRegion: isError ? "assertive" : "polite",
|
|
680
885
|
role: isError ? "alert" : "status",
|
|
681
|
-
style: [
|
|
886
|
+
style: [styles8.toast, { backgroundColor: tone.fill, borderColor: tone.border, transform: [{ translateY }], opacity }],
|
|
682
887
|
testID,
|
|
683
|
-
children:
|
|
888
|
+
children: [
|
|
889
|
+
/* @__PURE__ */ jsx(View, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: [styles8.glyph, { borderColor: tone.ink }], children: /* @__PURE__ */ jsx(Text, { style: [styles8.glyphText, { color: tone.ink }], children: tone.glyph }) }),
|
|
890
|
+
/* @__PURE__ */ jsxs(View, { style: styles8.body, children: [
|
|
891
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.text, { color: tone.ink }], children: message.text }),
|
|
892
|
+
/* @__PURE__ */ jsx(ErrorReferenceRow, { actionColor: tone.ink, color: tone.ink, testID: `${testID}-reference`, traceId: message.traceId })
|
|
893
|
+
] })
|
|
894
|
+
]
|
|
684
895
|
}
|
|
685
896
|
);
|
|
686
897
|
};
|
|
@@ -694,22 +905,22 @@ var ToastHost = ({
|
|
|
694
905
|
durationMs = DEFAULT_DURATION_MS,
|
|
695
906
|
fadeMs = DEFAULT_FADE_MS,
|
|
696
907
|
maxLength = DEFAULT_MAX_LENGTH,
|
|
697
|
-
toastTestID = FEEDBACK_TEST_IDS.notificationToast
|
|
908
|
+
toastTestID = FEEDBACK_TEST_IDS.notificationToast,
|
|
909
|
+
topInset
|
|
698
910
|
}) => {
|
|
699
911
|
const [messages, setMessages] = useState([]);
|
|
700
912
|
const { theme } = useFeedbackUi();
|
|
701
|
-
const
|
|
913
|
+
const tones = useMemo(
|
|
702
914
|
() => ({
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
text: theme.colors.surfaceElevated
|
|
915
|
+
success: resolveToastTone(theme, "success"),
|
|
916
|
+
error: resolveToastTone(theme, "error"),
|
|
917
|
+
info: resolveToastTone(theme, "info")
|
|
707
918
|
}),
|
|
708
919
|
[theme]
|
|
709
920
|
);
|
|
710
921
|
const push = useCallback(
|
|
711
922
|
(toast) => {
|
|
712
|
-
setMessages((s) => [...s, { id: nextId(), type: toast.type, text: sanitizeToastText(toast.text, maxLength) }]);
|
|
923
|
+
setMessages((s) => [...s, { id: nextId(), type: toast.type, text: sanitizeToastText(toast.text, maxLength), traceId: toast.traceId }]);
|
|
713
924
|
},
|
|
714
925
|
[maxLength]
|
|
715
926
|
);
|
|
@@ -719,14 +930,14 @@ var ToastHost = ({
|
|
|
719
930
|
useEffect(() => subscribe(push), [subscribe, push]);
|
|
720
931
|
if (messages.length === 0) return null;
|
|
721
932
|
const canPortal = IS_WEB && typeof document !== "undefined";
|
|
722
|
-
const layer = /* @__PURE__ */ jsx(View, { style: [
|
|
933
|
+
const layer = /* @__PURE__ */ jsx(View, { style: [styles8.container, { top: toastTop(IS_WEB, topInset) }, canPortal ? WEB_FIXED_LAYER : null], children: messages.map((m) => /* @__PURE__ */ jsx(
|
|
723
934
|
ToastItem,
|
|
724
935
|
{
|
|
725
|
-
colors,
|
|
726
936
|
durationMs,
|
|
727
937
|
fadeMs,
|
|
728
938
|
message: m,
|
|
729
939
|
testID: toastTestID,
|
|
940
|
+
tone: tones[m.type ?? "info"],
|
|
730
941
|
onDone: remove
|
|
731
942
|
},
|
|
732
943
|
m.id
|
|
@@ -795,7 +1006,7 @@ var SUBTITLE_FONT_SIZE = 15;
|
|
|
795
1006
|
var ATTEMPT_FONT_SIZE = 13;
|
|
796
1007
|
var CARD_PADDING = 24;
|
|
797
1008
|
var NO_ATTEMPT = 0;
|
|
798
|
-
var
|
|
1009
|
+
var styles9 = StyleSheet.create({
|
|
799
1010
|
overlay: {
|
|
800
1011
|
position: "absolute",
|
|
801
1012
|
top: 0,
|
|
@@ -852,13 +1063,13 @@ var WarmingOverlay = ({
|
|
|
852
1063
|
{
|
|
853
1064
|
accessibilityLabel: mergedLabels.accessibilityLabel,
|
|
854
1065
|
accessibilityRole: "alert",
|
|
855
|
-
style: [
|
|
1066
|
+
style: [styles9.overlay, { backgroundColor: colors.background }],
|
|
856
1067
|
testID: testIdPrefix,
|
|
857
|
-
children: /* @__PURE__ */ jsxs(View, { style:
|
|
1068
|
+
children: /* @__PURE__ */ jsxs(View, { style: styles9.card, children: [
|
|
858
1069
|
/* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size: "large" }),
|
|
859
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
860
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
861
|
-
showHint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1070
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.title, { color: colors.text }], testID: `${testIdPrefix}-title`, children: mergedLabels.title }),
|
|
1071
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.subtitle, { color: colors.textSecondary }], testID: `${testIdPrefix}-subtitle`, children: mergedLabels.subtitle }),
|
|
1072
|
+
showHint ? /* @__PURE__ */ jsx(Text, { style: [styles9.attempt, { color: colors.textSecondary }], testID: `${testIdPrefix}-attempt`, children: mergedLabels.attemptHint(snapshot2.attempt) }) : null
|
|
862
1073
|
] })
|
|
863
1074
|
}
|
|
864
1075
|
);
|
|
@@ -868,22 +1079,27 @@ var WarmingOverlay = ({
|
|
|
868
1079
|
var DEFAULT_TOAST_TYPE = "info";
|
|
869
1080
|
function createToastBus() {
|
|
870
1081
|
const listeners2 = /* @__PURE__ */ new Set();
|
|
1082
|
+
const push = (toast) => {
|
|
1083
|
+
for (const listener of [...listeners2]) listener(toast);
|
|
1084
|
+
};
|
|
871
1085
|
const emit2 = (text, type = DEFAULT_TOAST_TYPE) => {
|
|
872
|
-
|
|
1086
|
+
push({ text, type });
|
|
873
1087
|
};
|
|
874
1088
|
return {
|
|
875
|
-
subscribe(
|
|
876
|
-
listeners2.add(
|
|
1089
|
+
subscribe(push2) {
|
|
1090
|
+
listeners2.add(push2);
|
|
877
1091
|
return () => {
|
|
878
|
-
listeners2.delete(
|
|
1092
|
+
listeners2.delete(push2);
|
|
879
1093
|
};
|
|
880
1094
|
},
|
|
881
1095
|
emit: emit2,
|
|
882
1096
|
success(text) {
|
|
883
1097
|
emit2(text, "success");
|
|
884
1098
|
},
|
|
885
|
-
error(text) {
|
|
886
|
-
|
|
1099
|
+
error(text, cause) {
|
|
1100
|
+
const traceId = readTraceId(cause);
|
|
1101
|
+
if (traceId === void 0) emit2(text, "error");
|
|
1102
|
+
else push({ text, type: "error", traceId });
|
|
887
1103
|
},
|
|
888
1104
|
info(text) {
|
|
889
1105
|
emit2(text, "info");
|
|
@@ -906,7 +1122,7 @@ var BUTTON_PADDING_V3 = 12;
|
|
|
906
1122
|
var BUTTON_BORDER_RADIUS3 = 8;
|
|
907
1123
|
var BUTTON_MARGIN_TOP3 = 12;
|
|
908
1124
|
var BUTTON_FONT_SIZE3 = 16;
|
|
909
|
-
var
|
|
1125
|
+
var styles10 = StyleSheet.create({
|
|
910
1126
|
container: {
|
|
911
1127
|
flex: 1,
|
|
912
1128
|
justifyContent: "center",
|
|
@@ -974,10 +1190,10 @@ var ErrorBoundaryFallback = ({
|
|
|
974
1190
|
accessibilityHint: labels.tryAgainHint,
|
|
975
1191
|
accessibilityLabel: labels.tryAgain,
|
|
976
1192
|
accessibilityRole: "button",
|
|
977
|
-
style: [
|
|
1193
|
+
style: [styles10.button, reloadIsPrimary ? secondaryFill : primaryFill],
|
|
978
1194
|
testID: `${testIDPrefix}-retry-button`,
|
|
979
1195
|
onPress: onRetry,
|
|
980
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1196
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles10.buttonText, reloadIsPrimary ? secondaryInk : primaryInk], children: labels.tryAgain })
|
|
981
1197
|
}
|
|
982
1198
|
) : null;
|
|
983
1199
|
const reloadButton = typeof onReload === "function" ? /* @__PURE__ */ jsx(
|
|
@@ -986,10 +1202,10 @@ var ErrorBoundaryFallback = ({
|
|
|
986
1202
|
accessibilityHint: labels.reloadHint,
|
|
987
1203
|
accessibilityLabel: labels.reload,
|
|
988
1204
|
accessibilityRole: "button",
|
|
989
|
-
style: [
|
|
1205
|
+
style: [styles10.button, reloadIsPrimary ? primaryFill : secondaryFill],
|
|
990
1206
|
testID: `${testIDPrefix}-reload-button`,
|
|
991
1207
|
onPress: onReload,
|
|
992
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1208
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles10.buttonText, reloadIsPrimary ? primaryInk : secondaryInk], children: labels.reload })
|
|
993
1209
|
}
|
|
994
1210
|
) : null;
|
|
995
1211
|
return /* @__PURE__ */ jsx(
|
|
@@ -997,19 +1213,19 @@ var ErrorBoundaryFallback = ({
|
|
|
997
1213
|
{
|
|
998
1214
|
accessibilityLiveRegion: "assertive",
|
|
999
1215
|
role: "alert",
|
|
1000
|
-
style: [
|
|
1216
|
+
style: [styles10.container, { backgroundColor: theme.colors.background }],
|
|
1001
1217
|
testID: testIDPrefix,
|
|
1002
|
-
children: /* @__PURE__ */ jsxs(View, { style:
|
|
1003
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1218
|
+
children: /* @__PURE__ */ jsxs(View, { style: styles10.content, children: [
|
|
1219
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.title, { color: theme.colors.text }], children: labels.title }),
|
|
1004
1220
|
/* @__PURE__ */ jsx(ErrorState, { message: labels.message, testID: `${testIDPrefix}-message` }),
|
|
1005
1221
|
hasDetails ? /* @__PURE__ */ jsxs(
|
|
1006
1222
|
View,
|
|
1007
1223
|
{
|
|
1008
|
-
style: [
|
|
1224
|
+
style: [styles10.details, { backgroundColor: theme.colors.surface, borderColor: warningColor }],
|
|
1009
1225
|
testID: `${testIDPrefix}-details`,
|
|
1010
1226
|
children: [
|
|
1011
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1012
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1227
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.detailsTitle, { color: warningColor }], children: labels.errorDetails }),
|
|
1228
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.detailsText, { color: theme.colors.textSecondary }], children: error.message })
|
|
1013
1229
|
]
|
|
1014
1230
|
}
|
|
1015
1231
|
) : null,
|
|
@@ -1022,7 +1238,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1022
1238
|
var CONTAINER_PADDING4 = 20;
|
|
1023
1239
|
var MESSAGE_FONT_SIZE3 = 16;
|
|
1024
1240
|
var MESSAGE_MARGIN_TOP = 12;
|
|
1025
|
-
var
|
|
1241
|
+
var styles11 = StyleSheet.create({
|
|
1026
1242
|
container: {
|
|
1027
1243
|
flex: 1,
|
|
1028
1244
|
justifyContent: "center",
|
|
@@ -1045,11 +1261,11 @@ var ErrorBoundaryRecovering = ({
|
|
|
1045
1261
|
{
|
|
1046
1262
|
accessibilityLiveRegion: "polite",
|
|
1047
1263
|
role: "status",
|
|
1048
|
-
style: [
|
|
1264
|
+
style: [styles11.container, { backgroundColor: theme.colors.background }],
|
|
1049
1265
|
testID,
|
|
1050
1266
|
children: [
|
|
1051
1267
|
/* @__PURE__ */ jsx(ActivityIndicator, { color: theme.palette.primary["500"], size: "large" }),
|
|
1052
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1268
|
+
/* @__PURE__ */ jsx(Text, { style: [styles11.message, { color: theme.colors.textSecondary }], children: message })
|
|
1053
1269
|
]
|
|
1054
1270
|
}
|
|
1055
1271
|
);
|
|
@@ -1139,7 +1355,7 @@ var TRACK_MARGIN = 4;
|
|
|
1139
1355
|
var INDET_FRACTION = 0.35;
|
|
1140
1356
|
var INDET_DURATION_MS = 1300;
|
|
1141
1357
|
var LABEL_FONT_SIZE = 12;
|
|
1142
|
-
var
|
|
1358
|
+
var styles12 = StyleSheet.create({
|
|
1143
1359
|
track: { height: BAR_HEIGHT, borderRadius: RADIUS, overflow: "hidden", marginVertical: TRACK_MARGIN },
|
|
1144
1360
|
fill: { height: "100%", borderRadius: RADIUS },
|
|
1145
1361
|
label: { fontSize: LABEL_FONT_SIZE, textAlign: "right", fontVariant: ["tabular-nums"] }
|
|
@@ -1158,7 +1374,7 @@ function IndeterminateFill({ color, width, testID }) {
|
|
|
1158
1374
|
return /* @__PURE__ */ jsx(
|
|
1159
1375
|
Animated.View,
|
|
1160
1376
|
{
|
|
1161
|
-
style: [
|
|
1377
|
+
style: [styles12.fill, { backgroundColor: color, width: barWidth, transform: [{ translateX }] }],
|
|
1162
1378
|
testID
|
|
1163
1379
|
}
|
|
1164
1380
|
);
|
|
@@ -1193,13 +1409,13 @@ function ProgressBar(props) {
|
|
|
1193
1409
|
role: "progressbar",
|
|
1194
1410
|
testID,
|
|
1195
1411
|
children: [
|
|
1196
|
-
/* @__PURE__ */ jsx(View, { style: [
|
|
1197
|
-
!indeterminate && label !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1412
|
+
/* @__PURE__ */ jsx(View, { style: [styles12.track, { backgroundColor: trackColor }], onLayout, children: indeterminate ? /* @__PURE__ */ jsx(IndeterminateFill, { color, testID: fillTestID, width }) : /* @__PURE__ */ jsx(View, { style: [styles12.fill, { backgroundColor: color, width: `${safePct}%` }], testID: fillTestID }) }),
|
|
1413
|
+
!indeterminate && label !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles12.label, { color: textColor }], children: label }) : null
|
|
1198
1414
|
]
|
|
1199
1415
|
}
|
|
1200
1416
|
);
|
|
1201
1417
|
}
|
|
1202
|
-
var
|
|
1418
|
+
var styles13 = StyleSheet.create({
|
|
1203
1419
|
button: {
|
|
1204
1420
|
minHeight: MIN_TOUCH_TARGET_PX,
|
|
1205
1421
|
minWidth: MIN_TOUCH_TARGET_PX,
|
|
@@ -1222,9 +1438,9 @@ function RunCardButton({ label, hint, color, onPress, testID, disabled = false,
|
|
|
1222
1438
|
accessibilityState: { disabled, expanded },
|
|
1223
1439
|
disabled,
|
|
1224
1440
|
onPress,
|
|
1225
|
-
style: [
|
|
1441
|
+
style: [styles13.button, { borderColor: color }, disabled ? { opacity: DISABLED_OPACITY } : null],
|
|
1226
1442
|
testID,
|
|
1227
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1443
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles13.text, { color }], children: label })
|
|
1228
1444
|
}
|
|
1229
1445
|
);
|
|
1230
1446
|
}
|
|
@@ -1293,7 +1509,7 @@ function runToneColor(theme, state) {
|
|
|
1293
1509
|
return theme.colors.textSecondary;
|
|
1294
1510
|
}
|
|
1295
1511
|
var MARK = { done: "\u2713", running: "\u25CF", pending: "\u25CB", failed: "\u2715" };
|
|
1296
|
-
var
|
|
1512
|
+
var styles14 = StyleSheet.create({
|
|
1297
1513
|
row: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
|
|
1298
1514
|
chip: { borderWidth: 1, borderRadius: 6, paddingHorizontal: 10, justifyContent: "center" },
|
|
1299
1515
|
tap: { minHeight: MIN_TOUCH_TARGET_PX },
|
|
@@ -1306,14 +1522,14 @@ function chipText(group, labels) {
|
|
|
1306
1522
|
}
|
|
1307
1523
|
function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect }) {
|
|
1308
1524
|
const { theme } = useFeedbackUi();
|
|
1309
|
-
return /* @__PURE__ */ jsx(View, { style:
|
|
1525
|
+
return /* @__PURE__ */ jsx(View, { style: styles14.row, testID, children: groups.map((group) => {
|
|
1310
1526
|
const color = runToneColor(theme, group.state);
|
|
1311
1527
|
const selected = group.id === selectedId;
|
|
1312
1528
|
const a11y = labels.groupA11y(group.label, group.state, labels.formatDuration(group.durationSec));
|
|
1313
|
-
const body = /* @__PURE__ */ jsx(Text, { style: [
|
|
1314
|
-
const look = [
|
|
1529
|
+
const body = /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color }, selected || group.state === "running" ? styles14.strong : null], children: chipText(group, labels) });
|
|
1530
|
+
const look = [styles14.chip, { borderColor: color, backgroundColor: selected ? theme.colors.surfaceElevated : theme.colors.surface }];
|
|
1315
1531
|
if (onSelect === void 0) {
|
|
1316
|
-
return /* @__PURE__ */ jsx(View, { style: [look,
|
|
1532
|
+
return /* @__PURE__ */ jsx(View, { style: [look, styles14.still], accessible: true, accessibilityLabel: a11y, testID: `${testID}-${group.id}`, children: body }, group.id);
|
|
1317
1533
|
}
|
|
1318
1534
|
return /* @__PURE__ */ jsx(
|
|
1319
1535
|
Pressable,
|
|
@@ -1323,7 +1539,7 @@ function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect })
|
|
|
1323
1539
|
accessibilityHint: labels.groupHint,
|
|
1324
1540
|
accessibilityState: { selected },
|
|
1325
1541
|
onPress: () => onSelect(group.id),
|
|
1326
|
-
style: [look,
|
|
1542
|
+
style: [look, styles14.tap],
|
|
1327
1543
|
testID: `${testID}-${group.id}`,
|
|
1328
1544
|
children: body
|
|
1329
1545
|
},
|
|
@@ -1337,8 +1553,8 @@ function RunGroupSummary({ groups, labels, testID }) {
|
|
|
1337
1553
|
const open = groups.filter((g) => g.state !== "done");
|
|
1338
1554
|
const doneColor = runToneColor(theme, "done");
|
|
1339
1555
|
const doneText = labels.doneSummary(done.count, labels.formatDuration(done.durationSec));
|
|
1340
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
1341
|
-
done.count > 0 ? /* @__PURE__ */ jsx(View, { style: [
|
|
1556
|
+
return /* @__PURE__ */ jsxs(View, { style: styles14.row, testID, children: [
|
|
1557
|
+
done.count > 0 ? /* @__PURE__ */ jsx(View, { style: [styles14.chip, styles14.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsx(Text, { style: [styles14.text, { color: doneColor }], children: `${MARK.done} ${doneText}` }) }) : null,
|
|
1342
1558
|
/* @__PURE__ */ jsx(RunGroupChips, { groups: open, labels, testID: `${testID}-open` })
|
|
1343
1559
|
] });
|
|
1344
1560
|
}
|
|
@@ -1348,7 +1564,7 @@ var LABEL_SHARE = "35%";
|
|
|
1348
1564
|
var LABEL_LINES = 2;
|
|
1349
1565
|
var DURATION_WIDTH = 64;
|
|
1350
1566
|
var PERCENT = 100;
|
|
1351
|
-
var
|
|
1567
|
+
var styles15 = StyleSheet.create({
|
|
1352
1568
|
list: { gap: 6 },
|
|
1353
1569
|
row: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
1354
1570
|
stack: { gap: 4 },
|
|
@@ -1367,22 +1583,22 @@ function RunStepBars({ steps, maxBars, labels, compact, testID }) {
|
|
|
1367
1583
|
const maxSec = steps.reduce((m, s) => Math.max(m, s.durationSec), 0);
|
|
1368
1584
|
const folded = split.hiddenCount > 0;
|
|
1369
1585
|
const canFold = all && steps.length > maxBars;
|
|
1370
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
1586
|
+
return /* @__PURE__ */ jsxs(View, { style: styles15.list, testID, children: [
|
|
1371
1587
|
split.visible.map((step, i) => {
|
|
1372
1588
|
const color = runToneColor(theme, step.state);
|
|
1373
1589
|
const duration = labels.formatDuration(step.durationSec);
|
|
1374
|
-
const strong = step.state === "running" ?
|
|
1375
|
-
const name = /* @__PURE__ */ jsx(Text, { style: [compact ?
|
|
1376
|
-
const time = /* @__PURE__ */ jsx(Text, { style: [
|
|
1377
|
-
const bar = /* @__PURE__ */ jsx(View, { style: [compact ?
|
|
1590
|
+
const strong = step.state === "running" ? styles15.strong : null;
|
|
1591
|
+
const name = /* @__PURE__ */ jsx(Text, { style: [compact ? styles15.compactLabel : styles15.label, { color: theme.colors.text }, strong], numberOfLines: LABEL_LINES, testID: `${testID}-name-${String(i)}`, children: step.label });
|
|
1592
|
+
const time = /* @__PURE__ */ jsx(Text, { style: [styles15.duration, { color: theme.colors.textSecondary }, strong], children: duration });
|
|
1593
|
+
const bar = /* @__PURE__ */ jsx(View, { style: [compact ? styles15.fullTrack : styles15.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsx(View, { style: [styles15.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) });
|
|
1378
1594
|
const a11y = { accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}` };
|
|
1379
|
-
return compact ? /* @__PURE__ */ jsxs(View, { style:
|
|
1380
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1595
|
+
return compact ? /* @__PURE__ */ jsxs(View, { style: styles15.stack, ...a11y, children: [
|
|
1596
|
+
/* @__PURE__ */ jsxs(View, { style: styles15.row, children: [
|
|
1381
1597
|
name,
|
|
1382
1598
|
time
|
|
1383
1599
|
] }),
|
|
1384
1600
|
bar
|
|
1385
|
-
] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxs(View, { style:
|
|
1601
|
+
] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxs(View, { style: styles15.row, ...a11y, children: [
|
|
1386
1602
|
name,
|
|
1387
1603
|
bar,
|
|
1388
1604
|
time
|
|
@@ -1403,7 +1619,7 @@ function RunStepBars({ steps, maxBars, labels, compact, testID }) {
|
|
|
1403
1619
|
}
|
|
1404
1620
|
var LIVE_RUN_CARD_COMPACT_MAX_PX = 640;
|
|
1405
1621
|
var DEFAULT_MAX_BARS = 4;
|
|
1406
|
-
var
|
|
1622
|
+
var styles16 = StyleSheet.create({
|
|
1407
1623
|
card: { borderWidth: 1, borderRadius: 8, padding: 14, gap: 10 },
|
|
1408
1624
|
head: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10 },
|
|
1409
1625
|
titleBox: { flexGrow: 1, flexShrink: 1, flexBasis: 200, minWidth: 0, gap: 2 },
|
|
@@ -1427,18 +1643,18 @@ function LiveRunCard(props) {
|
|
|
1427
1643
|
const percent = progressPercent(progress);
|
|
1428
1644
|
const showTimings = !compact || open;
|
|
1429
1645
|
const muted = { color: theme.colors.textSecondary };
|
|
1430
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
1431
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1432
|
-
/* @__PURE__ */ jsx(View, { style: [
|
|
1433
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1434
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1435
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1646
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles16.card, { borderColor: tone, backgroundColor: theme.colors.surface }], testID, children: [
|
|
1647
|
+
/* @__PURE__ */ jsxs(View, { style: styles16.head, children: [
|
|
1648
|
+
/* @__PURE__ */ jsx(View, { style: [styles16.pill, { borderColor: tone }], children: /* @__PURE__ */ jsx(Text, { style: [styles16.pillText, { color: tone }], testID: `${testID}-status`, children: labels.status }) }),
|
|
1649
|
+
/* @__PURE__ */ jsxs(View, { style: styles16.titleBox, children: [
|
|
1650
|
+
/* @__PURE__ */ jsx(Text, { style: [styles16.title, { color: theme.colors.text }], testID: `${testID}-title`, children: title }),
|
|
1651
|
+
/* @__PURE__ */ jsx(Text, { style: [styles16.meta, muted], testID: `${testID}-meta`, children: labels.meta })
|
|
1436
1652
|
] }),
|
|
1437
1653
|
onCancel !== void 0 ? /* @__PURE__ */ jsx(RunCardButton, { label: labels.cancel, hint: labels.cancelHint, color: theme.semantic.error["500"], onPress: onCancel, disabled: cancelDisabled, testID: `${testID}-cancel` }) : null
|
|
1438
1654
|
] }),
|
|
1439
|
-
currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1655
|
+
currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsx(Text, { style: [styles16.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
|
|
1440
1656
|
percent !== null ? /* @__PURE__ */ jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
|
|
1441
|
-
percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1657
|
+
percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles16.meta, muted], testID: `${testID}-progress-text`, children: labels.progress }) : null,
|
|
1442
1658
|
compact && !open ? /* @__PURE__ */ jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
|
|
1443
1659
|
compact ? /* @__PURE__ */ jsx(RunCardButton, { label: labels.stepTimings, hint: labels.stepTimingsHint, color: theme.colors.textSecondary, onPress: () => setOpen(!open), expanded: open, testID: `${testID}-timings-toggle` }) : null,
|
|
1444
1660
|
showTimings ? /* @__PURE__ */ jsx(RunGroupChips, { groups, labels, selectedId, onSelect: setPicked, testID: `${testID}-groups` }) : null,
|
|
@@ -1446,6 +1662,6 @@ function LiveRunCard(props) {
|
|
|
1446
1662
|
] });
|
|
1447
1663
|
}
|
|
1448
1664
|
|
|
1449
|
-
export { AppErrorBoundary, AsyncSurface, ConfirmDialog, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, MODAL_OVERLAY_COLOR, PageSkeleton, ProgressBar, ToastHost, FeedbackUiProvider as UiProvider, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useFeedbackUi, useFeedbackUi as useUi };
|
|
1665
|
+
export { AppErrorBoundary, AsyncSurface, COPY_FEEDBACK_MS, ConfirmDialog, CopyStatus, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, EmptyListState, ErrorReferenceRow, ErrorState, FEEDBACK_TEST_IDS, FeedbackUiProvider, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, LoadingFallback, MODAL_OVERLAY_COLOR, PageSkeleton, ProgressBar, ToastHost, FeedbackUiProvider as UiProvider, WARMING_QUIET_PERIOD_MS, WarmingOverlay, barFraction, clampPercent, copyText, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, readTraceId, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useCopyToClipboard, useFeedbackUi, useFeedbackUi as useUi };
|
|
1450
1666
|
//# sourceMappingURL=index.mjs.map
|
|
1451
1667
|
//# sourceMappingURL=index.mjs.map
|