@dloizides/ui-feedback 1.16.0 → 1.16.2

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.js CHANGED
@@ -64,6 +64,7 @@ var FEEDBACK_TEST_IDS = {
64
64
  errorBoundary: "error-boundary",
65
65
  progressBar: "progress-bar"
66
66
  };
67
+ var MIN_TOUCH_TARGET = 44;
67
68
  var WELL_SIZE = 56;
68
69
  var WELL_MARGIN_BOTTOM = 16;
69
70
  var WELL_TINT_OPACITY = 0.12;
@@ -466,6 +467,7 @@ var styles6 = reactNative.StyleSheet.create({
466
467
  paddingHorizontal: 20,
467
468
  borderRadius: 6,
468
469
  minWidth: 80,
470
+ minHeight: MIN_TOUCH_TARGET,
469
471
  alignItems: "center",
470
472
  justifyContent: "center"
471
473
  },
@@ -494,6 +496,8 @@ var ConfirmDialog = ({
494
496
  destructive = false
495
497
  }) => {
496
498
  const { theme, t } = useFeedbackUi();
499
+ const titleId = react.useId();
500
+ const innerDialogRole = reactNative.Platform.OS === "web" ? void 0 : "dialog";
497
501
  const colorStyles = react.useMemo(
498
502
  () => ({
499
503
  dialog: { backgroundColor: theme.colors.surfaceElevated },
@@ -517,6 +521,7 @@ var ConfirmDialog = ({
517
521
  reactNative.Modal,
518
522
  {
519
523
  transparent: true,
524
+ "aria-labelledby": titleId,
520
525
  animationType: "fade",
521
526
  visible,
522
527
  onRequestClose: onCancel,
@@ -524,11 +529,11 @@ var ConfirmDialog = ({
524
529
  reactNative.View,
525
530
  {
526
531
  accessibilityViewIsModal: true,
527
- "aria-label": title,
528
- role: "dialog",
532
+ "aria-label": innerDialogRole === void 0 ? void 0 : title,
533
+ role: innerDialogRole,
529
534
  style: [styles6.dialog, colorStyles.dialog],
530
535
  children: [
531
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.title, colorStyles.title], children: title }),
536
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { nativeID: titleId, style: [styles6.title, colorStyles.title], children: title }),
532
537
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.message, colorStyles.message], children: message }),
533
538
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.buttonRow, children: [
534
539
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1336,19 +1341,24 @@ function RunGroupSummary({ groups, labels, testID }) {
1336
1341
  ] });
1337
1342
  }
1338
1343
  var BAR_HEIGHT2 = 8;
1339
- var LABEL_BASIS = 150;
1344
+ var LABEL_MIN_WIDTH = 220;
1345
+ var LABEL_SHARE = "35%";
1346
+ var LABEL_LINES = 2;
1340
1347
  var DURATION_WIDTH = 64;
1341
1348
  var PERCENT = 100;
1342
1349
  var styles14 = reactNative.StyleSheet.create({
1343
1350
  list: { gap: 6 },
1344
- row: { flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap" },
1345
- label: { fontSize: 13, flexBasis: LABEL_BASIS, flexGrow: 0, flexShrink: 1, minWidth: 0 },
1351
+ row: { flexDirection: "row", alignItems: "center", gap: 8 },
1352
+ stack: { gap: 4 },
1353
+ label: { fontSize: 13, flexBasis: LABEL_SHARE, flexGrow: 0, flexShrink: 0, minWidth: LABEL_MIN_WIDTH },
1354
+ compactLabel: { fontSize: 13, flexGrow: 1, flexShrink: 1, minWidth: 0 },
1346
1355
  track: { flexGrow: 1, flexShrink: 1, flexBasis: 80, height: BAR_HEIGHT2, borderRadius: 2, overflow: "hidden" },
1356
+ fullTrack: { height: BAR_HEIGHT2, borderRadius: 2, overflow: "hidden" },
1347
1357
  fill: { height: "100%", borderRadius: 2 },
1348
1358
  duration: { fontSize: 13, width: DURATION_WIDTH, textAlign: "right", fontVariant: ["tabular-nums"] },
1349
1359
  strong: { fontWeight: "700" }
1350
1360
  });
1351
- function RunStepBars({ steps, maxBars, labels, testID }) {
1361
+ function RunStepBars({ steps, maxBars, labels, compact, testID }) {
1352
1362
  const { theme } = useFeedbackUi();
1353
1363
  const [all, setAll] = react.useState(false);
1354
1364
  const split = splitShorterSteps(steps, all ? steps.length : maxBars);
@@ -1360,10 +1370,20 @@ function RunStepBars({ steps, maxBars, labels, testID }) {
1360
1370
  const color = runToneColor(theme, step.state);
1361
1371
  const duration = labels.formatDuration(step.durationSec);
1362
1372
  const strong = step.state === "running" ? styles14.strong : null;
1363
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.row, accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}`, children: [
1364
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.label, { color: theme.colors.text }, strong], numberOfLines: 1, children: step.label }),
1365
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles14.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles14.fill, { backgroundColor: color, width: `${barFraction(step.durationSec, maxSec) * PERCENT}%` }] }) }),
1366
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.duration, { color: theme.colors.textSecondary }, strong], children: duration })
1373
+ 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 });
1374
+ const time = /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.duration, { color: theme.colors.textSecondary }, strong], children: duration });
1375
+ 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}%` }] }) });
1376
+ const a11y = { accessible: true, accessibilityLabel: labels.stepA11y(step.label, duration), testID: `${testID}-row-${String(i)}` };
1377
+ return compact ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.stack, ...a11y, children: [
1378
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.row, children: [
1379
+ name,
1380
+ time
1381
+ ] }),
1382
+ bar
1383
+ ] }, `${step.label}-${String(i)}`) : /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.row, ...a11y, children: [
1384
+ name,
1385
+ bar,
1386
+ time
1367
1387
  ] }, `${step.label}-${String(i)}`);
1368
1388
  }),
1369
1389
  folded || canFold ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -1417,10 +1437,10 @@ function LiveRunCard(props) {
1417
1437
  currentStep !== null && currentStep !== "" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.step, { color: theme.colors.text }], testID: `${testID}-step`, children: currentStep }) : null,
1418
1438
  percent !== null ? /* @__PURE__ */ jsxRuntime.jsx(ProgressBar, { percent, label: labels.progress, accessibilityLabel: labels.progressA11y, color: tone, testID: `${testID}-progress` }) : null,
1419
1439
  percent === null && labels.progress !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.meta, muted], testID: `${testID}-progress-text`, children: labels.progress }) : null,
1420
- compact ? /* @__PURE__ */ jsxRuntime.jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
1440
+ compact && !open ? /* @__PURE__ */ jsxRuntime.jsx(RunGroupSummary, { groups, labels, testID: `${testID}-summary` }) : null,
1421
1441
  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,
1422
1442
  showTimings ? /* @__PURE__ */ jsxRuntime.jsx(RunGroupChips, { groups, labels, selectedId, onSelect: setPicked, testID: `${testID}-groups` }) : null,
1423
- showTimings && selected !== void 0 && selected.steps.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(RunStepBars, { steps: selected.steps, maxBars, labels, testID: `${testID}-steps` }, selected.id) : null
1443
+ showTimings && selected !== void 0 && selected.steps.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(RunStepBars, { steps: selected.steps, maxBars, labels, compact, testID: `${testID}-steps` }, selected.id) : null
1424
1444
  ] });
1425
1445
  }
1426
1446