@dloizides/ui-feedback 1.16.0 → 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/dist/index.mjs CHANGED
@@ -1334,19 +1334,24 @@ function RunGroupSummary({ groups, labels, testID }) {
1334
1334
  ] });
1335
1335
  }
1336
1336
  var BAR_HEIGHT2 = 8;
1337
- var LABEL_BASIS = 150;
1337
+ var LABEL_MIN_WIDTH = 220;
1338
+ var LABEL_SHARE = "35%";
1339
+ var LABEL_LINES = 2;
1338
1340
  var DURATION_WIDTH = 64;
1339
1341
  var PERCENT = 100;
1340
1342
  var styles14 = StyleSheet.create({
1341
1343
  list: { gap: 6 },
1342
- row: { flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap" },
1343
- label: { fontSize: 13, flexBasis: LABEL_BASIS, flexGrow: 0, flexShrink: 1, minWidth: 0 },
1344
+ row: { flexDirection: "row", alignItems: "center", gap: 8 },
1345
+ stack: { gap: 4 },
1346
+ label: { fontSize: 13, flexBasis: LABEL_SHARE, flexGrow: 0, flexShrink: 0, minWidth: LABEL_MIN_WIDTH },
1347
+ compactLabel: { fontSize: 13, flexGrow: 1, flexShrink: 1, minWidth: 0 },
1344
1348
  track: { flexGrow: 1, flexShrink: 1, flexBasis: 80, height: BAR_HEIGHT2, borderRadius: 2, overflow: "hidden" },
1349
+ fullTrack: { height: BAR_HEIGHT2, borderRadius: 2, overflow: "hidden" },
1345
1350
  fill: { height: "100%", borderRadius: 2 },
1346
1351
  duration: { fontSize: 13, width: DURATION_WIDTH, textAlign: "right", fontVariant: ["tabular-nums"] },
1347
1352
  strong: { fontWeight: "700" }
1348
1353
  });
1349
- function RunStepBars({ steps, maxBars, labels, testID }) {
1354
+ function RunStepBars({ steps, maxBars, labels, compact, testID }) {
1350
1355
  const { theme } = useFeedbackUi();
1351
1356
  const [all, setAll] = useState(false);
1352
1357
  const split = splitShorterSteps(steps, all ? steps.length : maxBars);
@@ -1358,10 +1363,20 @@ function RunStepBars({ steps, maxBars, labels, testID }) {
1358
1363
  const color = runToneColor(theme, step.state);
1359
1364
  const duration = labels.formatDuration(step.durationSec);
1360
1365
  const strong = step.state === "running" ? styles14.strong : null;
1361
- return /* @__PURE__ */ jsxs(View, { style: styles14.row, accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}`, children: [
1362
- /* @__PURE__ */ jsx(Text, { style: [styles14.label, { color: theme.colors.text }, strong], numberOfLines: 1, children: step.label }),
1363
- /* @__PURE__ */ jsx(View, { style: [styles14.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsx(View, { style: [styles14.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) }),
1364
- /* @__PURE__ */ jsx(Text, { style: [styles14.duration, { color: theme.colors.textSecondary }, strong], children: duration })
1366
+ const name = /* @__PURE__ */ jsx(Text, { style: [compact ? styles14.compactLabel : styles14.label, { color: theme.colors.text }, strong], numberOfLines: LABEL_LINES, testID: `${testID}-name-${String(i)}`, children: step.label });
1367
+ const time = /* @__PURE__ */ jsx(Text, { style: [styles14.duration, { color: theme.colors.textSecondary }, strong], children: duration });
1368
+ const bar = /* @__PURE__ */ jsx(View, { style: [compact ? styles14.fullTrack : styles14.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsx(View, { style: [styles14.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) });
1369
+ const a11y = { accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}` };
1370
+ return compact ? /* @__PURE__ */ jsxs(View, { style: styles14.stack, ...a11y, children: [
1371
+ /* @__PURE__ */ jsxs(View, { style: styles14.row, children: [
1372
+ name,
1373
+ time
1374
+ ] }),
1375
+ bar
1376
+ ] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxs(View, { style: styles14.row, ...a11y, children: [
1377
+ name,
1378
+ bar,
1379
+ time
1365
1380
  ] }, `${step.label}-${String(i)}`);
1366
1381
  }),
1367
1382
  folded || canFold ? /* @__PURE__ */ jsx(
@@ -1415,10 +1430,10 @@ function LiveRunCard(props) {
1415
1430
  currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsx(Text, { style: [styles15.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
1416
1431
  percent !== null ? /* @__PURE__ */ jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
1417
1432
  percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles15.meta, muted], testID: `${testID}-progress-text`, children: labels.progress }) : null,
1418
- compact ? /* @__PURE__ */ jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
1433
+ compact && !open ? /* @__PURE__ */ jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
1419
1434
  compact ? /* @__PURE__ */ jsx(RunCardButton, { label: labels.stepTimings, hint: labels.stepTimingsHint, color: theme.colors.textSecondary, onPress: () => setOpen(!open), expanded: open, testID: `${testID}-timings-toggle` }) : null,
1420
1435
  showTimings ? /* @__PURE__ */ jsx(RunGroupChips, { groups, labels, selectedId, onSelect: setPicked, testID: `${testID}-groups` }) : null,
1421
- showTimings && selected !== void 0 && selected.steps.length > 0 ? /* @__PURE__ */ jsx(RunStepBars, { steps: selected.steps, maxBars, labels, testID: `${testID}-steps` }, selected.id) : null
1436
+ showTimings && selected !== void 0 && selected.steps.length > 0 ? /* @__PURE__ */ jsx(RunStepBars, { steps: selected.steps, maxBars, labels, compact, testID: `${testID}-steps` }, selected.id) : null
1422
1437
  ] });
1423
1438
  }
1424
1439