@dloizides/ui-feedback 1.15.2 → 1.16.1
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 +235 -215
- package/dist/index.d.mts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +255 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +248 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -560,4 +560,88 @@ declare function ProgressBar(props: ProgressBarProps): React.ReactElement;
|
|
|
560
560
|
/** Clamps a possibly missing or non-finite percent into the 0-100 range. */
|
|
561
561
|
declare function clampPercent(value: number | null | undefined): number;
|
|
562
562
|
|
|
563
|
-
|
|
563
|
+
type RunStepState = 'done' | 'running' | 'pending' | 'failed';
|
|
564
|
+
interface RunStep {
|
|
565
|
+
label: string;
|
|
566
|
+
durationSec: number;
|
|
567
|
+
state: RunStepState;
|
|
568
|
+
}
|
|
569
|
+
interface RunGroup {
|
|
570
|
+
id: string;
|
|
571
|
+
label: string;
|
|
572
|
+
state: RunStepState;
|
|
573
|
+
durationSec: number;
|
|
574
|
+
steps: RunStep[];
|
|
575
|
+
}
|
|
576
|
+
interface FlatRunStep extends RunStep {
|
|
577
|
+
groupId: string;
|
|
578
|
+
groupLabel: string;
|
|
579
|
+
}
|
|
580
|
+
interface StepSplit {
|
|
581
|
+
visible: RunStep[];
|
|
582
|
+
hiddenCount: number;
|
|
583
|
+
}
|
|
584
|
+
interface DoneSummary {
|
|
585
|
+
count: number;
|
|
586
|
+
durationSec: number;
|
|
587
|
+
}
|
|
588
|
+
/** Folds flat steps into groups in first-seen order: sums each group's time, drops 0s done rows, worst state wins. */
|
|
589
|
+
declare function mergeRunSteps(flat: readonly FlatRunStep[]): RunGroup[];
|
|
590
|
+
/** Keeps the `keep` longest steps (and any running one) in their original order; counts the rest. */
|
|
591
|
+
declare function splitShorterSteps(steps: readonly RunStep[], keep: number): StepSplit;
|
|
592
|
+
/** The group whose steps show first: the running one, else a failed one, else the last. */
|
|
593
|
+
declare function defaultGroupId(groups: readonly RunGroup[]): string | null;
|
|
594
|
+
/** How many groups finished and their total time, for the compact one-chip summary. */
|
|
595
|
+
declare function summariseDoneGroups(groups: readonly RunGroup[]): DoneSummary;
|
|
596
|
+
/** A step bar's width as a 0-1 fraction of the longest step; a non-zero step never draws invisibly thin. */
|
|
597
|
+
declare function barFraction(durationSec: number, maxSec: number): number;
|
|
598
|
+
/** 0-100 from done/total, or null when the total is unknown. */
|
|
599
|
+
declare function progressPercent(progress: {
|
|
600
|
+
done: number;
|
|
601
|
+
total: number;
|
|
602
|
+
} | null | undefined): number | null;
|
|
603
|
+
|
|
604
|
+
interface LiveRunCardLabels {
|
|
605
|
+
status: string;
|
|
606
|
+
meta: string;
|
|
607
|
+
progress?: string;
|
|
608
|
+
progressA11y: string;
|
|
609
|
+
cancel: string;
|
|
610
|
+
cancelHint: string;
|
|
611
|
+
stepTimings: string;
|
|
612
|
+
stepTimingsHint: string;
|
|
613
|
+
groupHint: string;
|
|
614
|
+
moreStepsHint: string;
|
|
615
|
+
fewerSteps: string;
|
|
616
|
+
formatDuration: (sec: number) => string;
|
|
617
|
+
moreSteps: (count: number) => string;
|
|
618
|
+
doneSummary: (count: number, duration: string) => string;
|
|
619
|
+
groupA11y: (label: string, state: RunStepState, duration: string) => string;
|
|
620
|
+
stepA11y: (label: string, duration: string) => string;
|
|
621
|
+
}
|
|
622
|
+
interface LiveRunCardProps {
|
|
623
|
+
title: string;
|
|
624
|
+
status?: RunStepState;
|
|
625
|
+
currentStep?: string | null;
|
|
626
|
+
progress?: {
|
|
627
|
+
done: number;
|
|
628
|
+
total: number;
|
|
629
|
+
} | null;
|
|
630
|
+
groups: readonly RunGroup[];
|
|
631
|
+
labels: LiveRunCardLabels;
|
|
632
|
+
onCancel?: () => void;
|
|
633
|
+
cancelDisabled?: boolean;
|
|
634
|
+
compact?: boolean;
|
|
635
|
+
maxBars?: number;
|
|
636
|
+
testID?: string;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/** Below this window width the card renders compact: summary chips, step timings behind a toggle. */
|
|
640
|
+
declare const LIVE_RUN_CARD_COMPACT_MAX_PX = 640;
|
|
641
|
+
/** Presentational card for one active run: status, progress, per-group chips and step-time bars. */
|
|
642
|
+
declare function LiveRunCard(props: LiveRunCardProps): React.ReactElement;
|
|
643
|
+
|
|
644
|
+
/** The theme colour for a step or group state; falls back to primary/text when a semantic scale is absent. */
|
|
645
|
+
declare function runToneColor(theme: FeedbackTheme, state: RunStepState): string;
|
|
646
|
+
|
|
647
|
+
export { AppErrorBoundary, type AppErrorBoundaryProps, AsyncSurface, type AsyncSurfaceProps, ConfirmDialog, type ConfirmDialogProps, DEFAULT_ERROR_BOUNDARY_LABELS, DISABLED_OPACITY, type DoneSummary, EmptyListState, type EmptyListStateProps, type ErrorBoundaryLabels, type ErrorFallbackState, ErrorState, type ErrorStateAction, type ErrorStateProps, FEEDBACK_TEST_IDS, type FeedbackColorScale, type FeedbackNavigate, type FeedbackTheme, type FeedbackThemeColors, type FeedbackThemePalette, type FeedbackThemeSemantic, type FeedbackTranslate, FeedbackUiProvider, type FeedbackUiProviderProps, type FeedbackUiValue, type FlatRunStep, LIVE_RUN_CARD_COMPACT_MAX_PX, LiveRunCard, type LiveRunCardLabels, type LiveRunCardProps, LoadingFallback, type LoadingFallbackProps, MODAL_OVERLAY_COLOR, PageSkeleton, type PageSkeletonProps, ProgressBar, type ProgressBarProps, type RunGroup, type RunStep, type RunStepState, type StepSplit, type ToastBus, ToastHost, type ToastHostProps, type ToastInput, type ToastPush, type ToastType, type FeedbackColorScale as UiColorScale, type FeedbackNavigate as UiNavigate, FeedbackUiProvider as UiProvider, type FeedbackUiProviderProps as UiProviderProps, type FeedbackTheme as UiTheme, type FeedbackThemeColors as UiThemeColors, type FeedbackThemePalette as UiThemePalette, type FeedbackThemeSemantic as UiThemeSemantic, type FeedbackTranslate as UiTranslate, type FeedbackUiValue as UiValue, WARMING_QUIET_PERIOD_MS, type WarmingInfo, WarmingOverlay, type WarmingOverlayLabels, type WarmingOverlayProps, type WarmingSnapshot, barFraction, clampPercent, createToastBus, defaultGroupId, getWarmingSnapshot, mergeRunSteps, notifyWarming, progressPercent, runToneColor, settleWarming, splitShorterSteps, subscribeWarming, summariseDoneGroups, useFeedbackUi, useFeedbackUi as useUi };
|
package/dist/index.js
CHANGED
|
@@ -1192,6 +1192,252 @@ function ProgressBar(props) {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
);
|
|
1194
1194
|
}
|
|
1195
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1196
|
+
button: {
|
|
1197
|
+
minHeight: a11y.MIN_TOUCH_TARGET_PX,
|
|
1198
|
+
minWidth: a11y.MIN_TOUCH_TARGET_PX,
|
|
1199
|
+
paddingHorizontal: 14,
|
|
1200
|
+
borderRadius: 6,
|
|
1201
|
+
borderWidth: 1,
|
|
1202
|
+
justifyContent: "center",
|
|
1203
|
+
alignItems: "center",
|
|
1204
|
+
alignSelf: "flex-start"
|
|
1205
|
+
},
|
|
1206
|
+
text: { fontSize: 14, fontWeight: "600" }
|
|
1207
|
+
});
|
|
1208
|
+
function RunCardButton({ label, hint, color, onPress, testID, disabled = false, expanded }) {
|
|
1209
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1210
|
+
reactNative.Pressable,
|
|
1211
|
+
{
|
|
1212
|
+
accessibilityRole: "button",
|
|
1213
|
+
accessibilityLabel: label,
|
|
1214
|
+
accessibilityHint: hint,
|
|
1215
|
+
accessibilityState: { disabled, expanded },
|
|
1216
|
+
disabled,
|
|
1217
|
+
onPress,
|
|
1218
|
+
style: [styles12.button, { borderColor: color }, disabled ? { opacity: DISABLED_OPACITY } : null],
|
|
1219
|
+
testID,
|
|
1220
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.text, { color }], children: label })
|
|
1221
|
+
}
|
|
1222
|
+
);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// src/LiveRunCard/runGroups.ts
|
|
1226
|
+
var STATE_RANK = { done: 0, pending: 1, running: 2, failed: 3 };
|
|
1227
|
+
var MIN_BAR_FRACTION = 0.02;
|
|
1228
|
+
var NONE = 0;
|
|
1229
|
+
function isEmptyDoneMarker(step) {
|
|
1230
|
+
return step.state === "done" && step.durationSec <= NONE;
|
|
1231
|
+
}
|
|
1232
|
+
function mergeRunSteps(flat) {
|
|
1233
|
+
const groups = [];
|
|
1234
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1235
|
+
for (const s of flat) {
|
|
1236
|
+
let group = byId.get(s.groupId);
|
|
1237
|
+
if (group === void 0) {
|
|
1238
|
+
group = { id: s.groupId, label: s.groupLabel, state: "done", durationSec: NONE, steps: [] };
|
|
1239
|
+
byId.set(s.groupId, group);
|
|
1240
|
+
groups.push(group);
|
|
1241
|
+
}
|
|
1242
|
+
const durationSec = Math.max(NONE, s.durationSec);
|
|
1243
|
+
group.durationSec += durationSec;
|
|
1244
|
+
if (STATE_RANK[s.state] > STATE_RANK[group.state]) group.state = s.state;
|
|
1245
|
+
if (!isEmptyDoneMarker(s)) group.steps.push({ label: s.label, durationSec, state: s.state });
|
|
1246
|
+
}
|
|
1247
|
+
return groups;
|
|
1248
|
+
}
|
|
1249
|
+
function splitShorterSteps(steps, keep) {
|
|
1250
|
+
if (steps.length <= keep) return { visible: [...steps], hiddenCount: NONE };
|
|
1251
|
+
const ranked = steps.map((step, index) => ({ step, index })).sort((a, b) => b.step.durationSec - a.step.durationSec || a.index - b.index);
|
|
1252
|
+
const kept = new Set(ranked.slice(0, keep).map((r) => r.index));
|
|
1253
|
+
steps.forEach((step, index) => {
|
|
1254
|
+
if (step.state === "running") kept.add(index);
|
|
1255
|
+
});
|
|
1256
|
+
const visible = steps.filter((_, index) => kept.has(index));
|
|
1257
|
+
return { visible, hiddenCount: steps.length - visible.length };
|
|
1258
|
+
}
|
|
1259
|
+
function defaultGroupId(groups) {
|
|
1260
|
+
const active = groups.find((g) => g.state === "running") ?? groups.find((g) => g.state === "failed");
|
|
1261
|
+
if (active !== void 0) return active.id;
|
|
1262
|
+
return groups.at(-1)?.id ?? null;
|
|
1263
|
+
}
|
|
1264
|
+
function summariseDoneGroups(groups) {
|
|
1265
|
+
const done = groups.filter((g) => g.state === "done");
|
|
1266
|
+
return { count: done.length, durationSec: done.reduce((sum, g) => sum + g.durationSec, NONE) };
|
|
1267
|
+
}
|
|
1268
|
+
function barFraction(durationSec, maxSec) {
|
|
1269
|
+
if (maxSec <= NONE || durationSec <= NONE) return NONE;
|
|
1270
|
+
return Math.min(1, Math.max(MIN_BAR_FRACTION, durationSec / maxSec));
|
|
1271
|
+
}
|
|
1272
|
+
function progressPercent(progress) {
|
|
1273
|
+
if (!progress || progress.total <= NONE) return null;
|
|
1274
|
+
return Math.max(NONE, progress.done) / progress.total * 100;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
// src/LiveRunCard/runTone.ts
|
|
1278
|
+
function scale(theme, name) {
|
|
1279
|
+
const found = theme.semantic[name];
|
|
1280
|
+
return found?.["500"];
|
|
1281
|
+
}
|
|
1282
|
+
function runToneColor(theme, state) {
|
|
1283
|
+
if (state === "failed") return theme.semantic.error["500"];
|
|
1284
|
+
if (state === "running") return scale(theme, "warning") ?? theme.palette.primary["500"];
|
|
1285
|
+
if (state === "done") return scale(theme, "success") ?? theme.colors.text;
|
|
1286
|
+
return theme.colors.textSecondary;
|
|
1287
|
+
}
|
|
1288
|
+
var MARK = { done: "\u2713", running: "\u25CF", pending: "\u25CB", failed: "\u2715" };
|
|
1289
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1290
|
+
row: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
|
|
1291
|
+
chip: { borderWidth: 1, borderRadius: 6, paddingHorizontal: 10, justifyContent: "center" },
|
|
1292
|
+
tap: { minHeight: a11y.MIN_TOUCH_TARGET_PX },
|
|
1293
|
+
still: { paddingVertical: 4 },
|
|
1294
|
+
text: { fontSize: 13, fontVariant: ["tabular-nums"] },
|
|
1295
|
+
strong: { fontWeight: "700" }
|
|
1296
|
+
});
|
|
1297
|
+
function chipText(group, labels) {
|
|
1298
|
+
return `${MARK[group.state]} ${group.label} ${labels.formatDuration(group.durationSec)}`;
|
|
1299
|
+
}
|
|
1300
|
+
function RunGroupChips({ groups, labels, testID, selectedId = null, onSelect }) {
|
|
1301
|
+
const { theme } = useFeedbackUi();
|
|
1302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles13.row, testID, children: groups.map((group) => {
|
|
1303
|
+
const color = runToneColor(theme, group.state);
|
|
1304
|
+
const selected = group.id === selectedId;
|
|
1305
|
+
const a11y = labels.groupA11y(group.label, group.state, labels.formatDuration(group.durationSec));
|
|
1306
|
+
const body = /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.text, { color }, selected || group.state === "running" ? styles13.strong : null], children: chipText(group, labels) });
|
|
1307
|
+
const look = [styles13.chip, { borderColor: color, backgroundColor: selected ? theme.colors.surfaceElevated : theme.colors.surface }];
|
|
1308
|
+
if (onSelect === void 0) {
|
|
1309
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [look, styles13.still], accessible: true, accessibilityLabel: a11y, testID: `${testID}-${group.id}`, children: body }, group.id);
|
|
1310
|
+
}
|
|
1311
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1312
|
+
reactNative.Pressable,
|
|
1313
|
+
{
|
|
1314
|
+
accessibilityRole: "button",
|
|
1315
|
+
accessibilityLabel: a11y,
|
|
1316
|
+
accessibilityHint: labels.groupHint,
|
|
1317
|
+
accessibilityState: { selected },
|
|
1318
|
+
onPress: () => onSelect(group.id),
|
|
1319
|
+
style: [look, styles13.tap],
|
|
1320
|
+
testID: `${testID}-${group.id}`,
|
|
1321
|
+
children: body
|
|
1322
|
+
},
|
|
1323
|
+
group.id
|
|
1324
|
+
);
|
|
1325
|
+
}) });
|
|
1326
|
+
}
|
|
1327
|
+
function RunGroupSummary({ groups, labels, testID }) {
|
|
1328
|
+
const { theme } = useFeedbackUi();
|
|
1329
|
+
const done = summariseDoneGroups(groups);
|
|
1330
|
+
const open = groups.filter((g) => g.state !== "done");
|
|
1331
|
+
const doneColor = runToneColor(theme, "done");
|
|
1332
|
+
const doneText = labels.doneSummary(done.count, labels.formatDuration(done.durationSec));
|
|
1333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.row, testID, children: [
|
|
1334
|
+
done.count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles13.chip, styles13.still, { borderColor: doneColor }], accessible: true, accessibilityLabel: doneText, testID: `${testID}-done`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.text, { color: doneColor }], children: `${MARK.done} ${doneText}` }) }) : null,
|
|
1335
|
+
/* @__PURE__ */ jsxRuntime.jsx(RunGroupChips, { groups: open, labels, testID: `${testID}-open` })
|
|
1336
|
+
] });
|
|
1337
|
+
}
|
|
1338
|
+
var BAR_HEIGHT2 = 8;
|
|
1339
|
+
var LABEL_MIN_WIDTH = 220;
|
|
1340
|
+
var LABEL_SHARE = "35%";
|
|
1341
|
+
var LABEL_LINES = 2;
|
|
1342
|
+
var DURATION_WIDTH = 64;
|
|
1343
|
+
var PERCENT = 100;
|
|
1344
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1345
|
+
list: { gap: 6 },
|
|
1346
|
+
row: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
1347
|
+
stack: { gap: 4 },
|
|
1348
|
+
label: { fontSize: 13, flexBasis: LABEL_SHARE, flexGrow: 0, flexShrink: 0, minWidth: LABEL_MIN_WIDTH },
|
|
1349
|
+
compactLabel: { fontSize: 13, flexGrow: 1, flexShrink: 1, minWidth: 0 },
|
|
1350
|
+
track: { flexGrow: 1, flexShrink: 1, flexBasis: 80, height: BAR_HEIGHT2, borderRadius: 2, overflow: "hidden" },
|
|
1351
|
+
fullTrack: { height: BAR_HEIGHT2, borderRadius: 2, overflow: "hidden" },
|
|
1352
|
+
fill: { height: "100%", borderRadius: 2 },
|
|
1353
|
+
duration: { fontSize: 13, width: DURATION_WIDTH, textAlign: "right", fontVariant: ["tabular-nums"] },
|
|
1354
|
+
strong: { fontWeight: "700" }
|
|
1355
|
+
});
|
|
1356
|
+
function RunStepBars({ steps, maxBars, labels, compact, testID }) {
|
|
1357
|
+
const { theme } = useFeedbackUi();
|
|
1358
|
+
const [all, setAll] = react.useState(false);
|
|
1359
|
+
const split = splitShorterSteps(steps, all ? steps.length : maxBars);
|
|
1360
|
+
const maxSec = steps.reduce((m, s) => Math.max(m, s.durationSec), 0);
|
|
1361
|
+
const folded = split.hiddenCount > 0;
|
|
1362
|
+
const canFold = all && steps.length > maxBars;
|
|
1363
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.list, testID, children: [
|
|
1364
|
+
split.visible.map((step, i) => {
|
|
1365
|
+
const color = runToneColor(theme, step.state);
|
|
1366
|
+
const duration = labels.formatDuration(step.durationSec);
|
|
1367
|
+
const strong = step.state === "running" ? styles14.strong : null;
|
|
1368
|
+
const name = /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [compact ? styles14.compactLabel : styles14.label, { color: theme.colors.text }, strong], numberOfLines: LABEL_LINES, testID: `${testID}-name-${String(i)}`, children: step.label });
|
|
1369
|
+
const time = /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.duration, { color: theme.colors.textSecondary }, strong], children: duration });
|
|
1370
|
+
const bar = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [compact ? styles14.fullTrack : styles14.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles14.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) });
|
|
1371
|
+
const a11y = { accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}` };
|
|
1372
|
+
return compact ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.stack, ...a11y, children: [
|
|
1373
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.row, children: [
|
|
1374
|
+
name,
|
|
1375
|
+
time
|
|
1376
|
+
] }),
|
|
1377
|
+
bar
|
|
1378
|
+
] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.row, ...a11y, children: [
|
|
1379
|
+
name,
|
|
1380
|
+
bar,
|
|
1381
|
+
time
|
|
1382
|
+
] }, `${step.label}-${String(i)}`);
|
|
1383
|
+
}),
|
|
1384
|
+
folded || canFold ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1385
|
+
RunCardButton,
|
|
1386
|
+
{
|
|
1387
|
+
label: folded ? labels.moreSteps(split.hiddenCount) : labels.fewerSteps,
|
|
1388
|
+
hint: labels.moreStepsHint,
|
|
1389
|
+
color: theme.colors.textSecondary,
|
|
1390
|
+
onPress: () => setAll(!all),
|
|
1391
|
+
expanded: all,
|
|
1392
|
+
testID: `${testID}-more`
|
|
1393
|
+
}
|
|
1394
|
+
) : null
|
|
1395
|
+
] });
|
|
1396
|
+
}
|
|
1397
|
+
var LIVE_RUN_CARD_COMPACT_MAX_PX = 640;
|
|
1398
|
+
var DEFAULT_MAX_BARS = 4;
|
|
1399
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1400
|
+
card: { borderWidth: 1, borderRadius: 8, padding: 14, gap: 10 },
|
|
1401
|
+
head: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10 },
|
|
1402
|
+
titleBox: { flexGrow: 1, flexShrink: 1, flexBasis: 200, minWidth: 0, gap: 2 },
|
|
1403
|
+
pill: { borderWidth: 1, borderRadius: 999, paddingHorizontal: 10, paddingVertical: 2, alignSelf: "flex-start" },
|
|
1404
|
+
pillText: { fontSize: 12, fontWeight: "700" },
|
|
1405
|
+
title: { fontSize: 16, fontWeight: "700" },
|
|
1406
|
+
meta: { fontSize: 13 },
|
|
1407
|
+
step: { fontSize: 14, fontWeight: "600" }
|
|
1408
|
+
});
|
|
1409
|
+
function LiveRunCard(props) {
|
|
1410
|
+
const { title, status = "running", currentStep = null, progress = null, groups, labels, onCancel, cancelDisabled = false } = props;
|
|
1411
|
+
const { maxBars = DEFAULT_MAX_BARS, testID = "live-run-card" } = props;
|
|
1412
|
+
const { theme } = useFeedbackUi();
|
|
1413
|
+
const { width } = reactNative.useWindowDimensions();
|
|
1414
|
+
const compact = props.compact ?? width < LIVE_RUN_CARD_COMPACT_MAX_PX;
|
|
1415
|
+
const [picked, setPicked] = react.useState(null);
|
|
1416
|
+
const [open, setOpen] = react.useState(false);
|
|
1417
|
+
const selectedId = groups.some((g) => g.id === picked) ? picked : defaultGroupId(groups);
|
|
1418
|
+
const selected = groups.find((g) => g.id === selectedId);
|
|
1419
|
+
const tone = runToneColor(theme, status);
|
|
1420
|
+
const percent = progressPercent(progress);
|
|
1421
|
+
const showTimings = !compact || open;
|
|
1422
|
+
const muted = { color: theme.colors.textSecondary };
|
|
1423
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles15.card, { borderColor: tone, backgroundColor: theme.colors.surface }], testID, children: [
|
|
1424
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.head, children: [
|
|
1425
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles15.pill, { borderColor: tone }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.pillText, { color: tone }], testID: `${testID}-status`, children: labels.status }) }),
|
|
1426
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.titleBox, children: [
|
|
1427
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.title, { color: theme.colors.text }], testID: `${testID}-title`, children: title }),
|
|
1428
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.meta, muted], testID: `${testID}-meta`, children: labels.meta })
|
|
1429
|
+
] }),
|
|
1430
|
+
onCancel !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(RunCardButton, { label: labels.cancel, hint: labels.cancelHint, color: theme.semantic.error["500"], onPress: onCancel, disabled: cancelDisabled, testID: `${testID}-cancel` }) : null
|
|
1431
|
+
] }),
|
|
1432
|
+
currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
|
|
1433
|
+
percent !== null ? /* @__PURE__ */ jsxRuntime.jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
|
|
1434
|
+
percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.meta, muted], testID: `${testID}-progress-text`, children: labels.progress }) : null,
|
|
1435
|
+
compact && !open ? /* @__PURE__ */ jsxRuntime.jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
|
|
1436
|
+
compact ? /* @__PURE__ */ jsxRuntime.jsx(RunCardButton, { label: labels.stepTimings, hint: labels.stepTimingsHint, color: theme.colors.textSecondary, onPress: () => setOpen(!open), expanded: open, testID: `${testID}-timings-toggle` }) : null,
|
|
1437
|
+
showTimings ? /* @__PURE__ */ jsxRuntime.jsx(RunGroupChips, { groups, labels, selectedId, onSelect: setPicked, testID: `${testID}-groups` }) : null,
|
|
1438
|
+
showTimings && selected !== void 0 && selected.steps.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(RunStepBars, { steps: selected.steps, maxBars, labels, compact, testID: `${testID}-steps` }, selected.id) : null
|
|
1439
|
+
] });
|
|
1440
|
+
}
|
|
1195
1441
|
|
|
1196
1442
|
exports.AppErrorBoundary = AppErrorBoundary;
|
|
1197
1443
|
exports.AsyncSurface = AsyncSurface;
|
|
@@ -1202,6 +1448,8 @@ exports.EmptyListState = EmptyListState;
|
|
|
1202
1448
|
exports.ErrorState = ErrorState;
|
|
1203
1449
|
exports.FEEDBACK_TEST_IDS = FEEDBACK_TEST_IDS;
|
|
1204
1450
|
exports.FeedbackUiProvider = FeedbackUiProvider;
|
|
1451
|
+
exports.LIVE_RUN_CARD_COMPACT_MAX_PX = LIVE_RUN_CARD_COMPACT_MAX_PX;
|
|
1452
|
+
exports.LiveRunCard = LiveRunCard;
|
|
1205
1453
|
exports.LoadingFallback = LoadingFallback;
|
|
1206
1454
|
exports.MODAL_OVERLAY_COLOR = MODAL_OVERLAY_COLOR;
|
|
1207
1455
|
exports.PageSkeleton = PageSkeleton;
|
|
@@ -1210,12 +1458,19 @@ exports.ToastHost = ToastHost;
|
|
|
1210
1458
|
exports.UiProvider = FeedbackUiProvider;
|
|
1211
1459
|
exports.WARMING_QUIET_PERIOD_MS = WARMING_QUIET_PERIOD_MS;
|
|
1212
1460
|
exports.WarmingOverlay = WarmingOverlay;
|
|
1461
|
+
exports.barFraction = barFraction;
|
|
1213
1462
|
exports.clampPercent = clampPercent;
|
|
1214
1463
|
exports.createToastBus = createToastBus;
|
|
1464
|
+
exports.defaultGroupId = defaultGroupId;
|
|
1215
1465
|
exports.getWarmingSnapshot = getWarmingSnapshot;
|
|
1466
|
+
exports.mergeRunSteps = mergeRunSteps;
|
|
1216
1467
|
exports.notifyWarming = notifyWarming;
|
|
1468
|
+
exports.progressPercent = progressPercent;
|
|
1469
|
+
exports.runToneColor = runToneColor;
|
|
1217
1470
|
exports.settleWarming = settleWarming;
|
|
1471
|
+
exports.splitShorterSteps = splitShorterSteps;
|
|
1218
1472
|
exports.subscribeWarming = subscribeWarming;
|
|
1473
|
+
exports.summariseDoneGroups = summariseDoneGroups;
|
|
1219
1474
|
exports.useFeedbackUi = useFeedbackUi;
|
|
1220
1475
|
exports.useUi = useFeedbackUi;
|
|
1221
1476
|
//# sourceMappingURL=index.js.map
|