@dloizides/ui-tables 3.3.0 → 3.4.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/dist/index.js CHANGED
@@ -2053,6 +2053,70 @@ var TONE_GLYPH = {
2053
2053
  };
2054
2054
  var ledgerSectionTestID = (testID, section) => `${testID}-section-${section}`;
2055
2055
  var ledgerSortDirectionTestID = (testID) => `${testID}-sort-direction`;
2056
+
2057
+ // src/StatusLedger/SortDirection.ts
2058
+ var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
2059
+ SortDirection2["Asc"] = "asc";
2060
+ SortDirection2["Desc"] = "desc";
2061
+ return SortDirection2;
2062
+ })(SortDirection || {});
2063
+ function LedgerFilterBar({ view, labels, resultsCount, testID }) {
2064
+ const ascending = view.direction === "asc" /* Asc */;
2065
+ return /* @__PURE__ */ jsxRuntime.jsx(
2066
+ Filters,
2067
+ {
2068
+ actions: /* @__PURE__ */ jsxRuntime.jsx(
2069
+ ActionButton,
2070
+ {
2071
+ hint: labels.sortDirectionHint,
2072
+ label: ascending ? labels.sortAscending : labels.sortDescending,
2073
+ onPress: view.toggleDirection,
2074
+ testID: ledgerSortDirectionTestID(testID),
2075
+ tone: "ghost"
2076
+ }
2077
+ ),
2078
+ clearHint: labels.clearHint,
2079
+ clearLabel: labels.clear,
2080
+ fields: view.fields,
2081
+ onChange: view.setValues,
2082
+ onClear: view.clear,
2083
+ resultsCount,
2084
+ resultsLabel: labels.results,
2085
+ testID: `${testID}-filters`,
2086
+ values: view.values
2087
+ }
2088
+ );
2089
+ }
2090
+ var GAP = 12;
2091
+ var HEADING_FONT = 15;
2092
+ var HEADING_WEIGHT = "700";
2093
+ var styles2 = reactNative.StyleSheet.create({
2094
+ root: { gap: GAP },
2095
+ heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
2096
+ note: { paddingVertical: GAP }
2097
+ });
2098
+ var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
2099
+ function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger, heading }) {
2100
+ const { theme } = uiFeedback.useUi();
2101
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles2.root, testID, children: [
2102
+ heading ?? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles2.heading, { color: theme.colors.text }], children: `${title} \xB7 ${rows.length}` }),
2103
+ rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.note, { color: theme.colors.textSecondary }], children: emptyLabel }) : /* @__PURE__ */ jsxRuntime.jsx(
2104
+ DataTable,
2105
+ {
2106
+ columns,
2107
+ expandedRowKeys: expandedKeys(ledger.expandedRowKey),
2108
+ getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
2109
+ getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
2110
+ keyExtractor: ledger.keyExtractor,
2111
+ ...pickRowAction(ledger),
2112
+ renderRowDetail: ledger.renderRowDetail,
2113
+ rows,
2114
+ stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
2115
+ testID: `${testID}-table`
2116
+ }
2117
+ )
2118
+ ] });
2119
+ }
2056
2120
  var PILL_RADIUS2 = 999;
2057
2121
  var PILL_BORDER = 1;
2058
2122
  var PILL_PAD_H = 8;
@@ -2060,7 +2124,7 @@ var PILL_PAD_V = 2;
2060
2124
  var PILL_GAP = 6;
2061
2125
  var PILL_FONT = 13;
2062
2126
  var PILL_WEIGHT = "600";
2063
- var styles2 = reactNative.StyleSheet.create({
2127
+ var styles3 = reactNative.StyleSheet.create({
2064
2128
  pill: {
2065
2129
  flexDirection: "row",
2066
2130
  alignItems: "center",
@@ -2074,19 +2138,12 @@ var styles2 = reactNative.StyleSheet.create({
2074
2138
  text: { fontSize: PILL_FONT, fontWeight: PILL_WEIGHT }
2075
2139
  });
2076
2140
  function StatusPill({ label, tone, color, testID }) {
2077
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityLabel: label, accessibilityRole: "text", style: [styles2.pill, { borderColor: color }], testID, children: [
2078
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [styles2.text, { color }], children: TONE_GLYPH[tone] }),
2079
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles2.text, { color }], children: label })
2141
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityLabel: label, accessibilityRole: "text", style: [styles3.pill, { borderColor: color }], testID, children: [
2142
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { "aria-hidden": true, style: [styles3.text, { color }], children: TONE_GLYPH[tone] }),
2143
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.text, { color }], children: label })
2080
2144
  ] });
2081
2145
  }
2082
2146
 
2083
- // src/StatusLedger/SortDirection.ts
2084
- var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
2085
- SortDirection2["Asc"] = "asc";
2086
- SortDirection2["Desc"] = "desc";
2087
- return SortDirection2;
2088
- })(SortDirection || {});
2089
-
2090
2147
  // src/StatusLedger/utils/ledgerLogic.ts
2091
2148
  var BEFORE = -1;
2092
2149
  var AFTER = 1;
@@ -2199,68 +2256,17 @@ var LedgerLayout = /* @__PURE__ */ ((LedgerLayout2) => {
2199
2256
  LedgerLayout2["Feed"] = "feed";
2200
2257
  return LedgerLayout2;
2201
2258
  })(LedgerLayout || {});
2202
- var GAP = 12;
2203
- var HEADING_FONT = 15;
2204
- var HEADING_WEIGHT = "700";
2205
- var expandedKeys = (key) => key === null || key === void 0 ? void 0 : [key];
2206
- var styles3 = reactNative.StyleSheet.create({
2207
- root: { gap: GAP },
2208
- heading: { fontSize: HEADING_FONT, fontWeight: HEADING_WEIGHT },
2209
- note: { paddingVertical: GAP }
2259
+ var GAP2 = 12;
2260
+ var styles4 = reactNative.StyleSheet.create({
2261
+ root: { gap: GAP2 }
2210
2262
  });
2211
- function LedgerSection({ title, rows, columns, emptyLabel, testID, ledger }) {
2212
- const { theme } = uiFeedback.useUi();
2213
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.root, testID, children: [
2214
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles3.heading, { color: theme.colors.text }], children: `${title} \xB7 ${rows.length}` }),
2215
- rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.note, { color: theme.colors.textSecondary }], children: emptyLabel }) : /* @__PURE__ */ jsxRuntime.jsx(
2216
- DataTable,
2217
- {
2218
- columns,
2219
- expandedRowKeys: expandedKeys(ledger.expandedRowKey),
2220
- getRowAccessibilityLabel: ledger.getRowAccessibilityLabel,
2221
- getRowDetailAccessibilityLabel: ledger.getRowAccessibilityLabel,
2222
- keyExtractor: ledger.keyExtractor,
2223
- ...pickRowAction(ledger),
2224
- renderRowDetail: ledger.renderRowDetail,
2225
- rows,
2226
- stackBreakpoint: ledger.breakpoint ?? CARD_STACK_BREAKPOINT,
2227
- testID: `${testID}-table`
2228
- }
2229
- )
2230
- ] });
2231
- }
2232
2263
  function StatusLedger(props) {
2233
2264
  const { labels, layout = "auto" /* Auto */, breakpoint = CARD_STACK_BREAKPOINT, loading, testID = STATUS_LEDGER_TEST_ID } = props;
2234
2265
  const { width } = reactNative.useWindowDimensions();
2235
2266
  const view = useLedgerView(props);
2236
2267
  const feed = layout === "feed" /* Feed */ || layout === "auto" /* Auto */ && width < breakpoint;
2237
- const ascending = view.direction === "asc" /* Asc */;
2238
- const directionButton = /* @__PURE__ */ jsxRuntime.jsx(
2239
- ActionButton,
2240
- {
2241
- hint: labels.sortDirectionHint,
2242
- label: ascending ? labels.sortAscending : labels.sortDescending,
2243
- onPress: view.toggleDirection,
2244
- testID: ledgerSortDirectionTestID(testID),
2245
- tone: "ghost"
2246
- }
2247
- );
2248
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.root, testID, children: [
2249
- /* @__PURE__ */ jsxRuntime.jsx(
2250
- Filters,
2251
- {
2252
- actions: directionButton,
2253
- clearHint: labels.clearHint,
2254
- clearLabel: labels.clear,
2255
- fields: view.fields,
2256
- onChange: view.setValues,
2257
- onClear: view.clear,
2258
- resultsCount: view.visible.length,
2259
- resultsLabel: labels.results,
2260
- testID: `${testID}-filters`,
2261
- values: view.values
2262
- }
2263
- ),
2268
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles4.root, testID, children: [
2269
+ /* @__PURE__ */ jsxRuntime.jsx(LedgerFilterBar, { labels, resultsCount: view.visible.length, testID, view }),
2264
2270
  feed && !loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2265
2271
  /* @__PURE__ */ jsxRuntime.jsx(LedgerSection, { columns: view.tableColumns, emptyLabel: labels.allClear, ledger: props, rows: view.split.attention, testID: ledgerSectionTestID(testID, "attention"), title: labels.needsLook }),
2266
2272
  /* @__PURE__ */ jsxRuntime.jsx(LedgerSection, { columns: view.tableColumns, emptyLabel: labels.empty, ledger: props, rows: view.split.rest, testID: ledgerSectionTestID(testID, "rest"), title: labels.everythingElse })
@@ -2310,7 +2316,7 @@ function formatRelativeTime(value, nowMs, strings) {
2310
2316
  if (distance < MS_PER_DAY) return fill(units.hours, Math.floor(distance / MS_PER_HOUR));
2311
2317
  return fill(units.days, Math.floor(distance / MS_PER_DAY));
2312
2318
  }
2313
- var styles4 = reactNative.StyleSheet.create({
2319
+ var styles5 = reactNative.StyleSheet.create({
2314
2320
  target: { minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, justifyContent: "center" }
2315
2321
  });
2316
2322
  var defaultAbsolute = (ms) => new Date(ms).toLocaleString();
@@ -2332,13 +2338,175 @@ function RelativeTime({ value, nowMs, strings, hint, formatAbsolute = defaultAbs
2332
2338
  setShowAbsolute((current) => !current);
2333
2339
  pressRow?.();
2334
2340
  },
2335
- style: styles4.target,
2341
+ style: styles5.target,
2336
2342
  testID,
2337
2343
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: theme.colors.text }, children: showAbsolute ? absolute : relative })
2338
2344
  }
2339
2345
  );
2340
2346
  }
2341
2347
 
2348
+ // src/StatusLedger/DurationUnit.ts
2349
+ var DurationUnit = /* @__PURE__ */ ((DurationUnit2) => {
2350
+ DurationUnit2["Minute"] = "minute";
2351
+ DurationUnit2["Hour"] = "hour";
2352
+ DurationUnit2["Day"] = "day";
2353
+ return DurationUnit2;
2354
+ })(DurationUnit || {});
2355
+
2356
+ // src/StatusLedger/utils/duration.ts
2357
+ var MS_PER_SECOND2 = 1e3;
2358
+ var SECONDS_PER_MINUTE2 = 60;
2359
+ var MINUTES_PER_HOUR2 = 60;
2360
+ var HOURS_PER_DAY2 = 24;
2361
+ var MS_PER_MINUTE2 = MS_PER_SECOND2 * SECONDS_PER_MINUTE2;
2362
+ var MS_PER_HOUR2 = MS_PER_MINUTE2 * MINUTES_PER_HOUR2;
2363
+ var MS_PER_DAY2 = MS_PER_HOUR2 * HOURS_PER_DAY2;
2364
+ var TOKEN = /\{\{(\w+)\}\}/g;
2365
+ function fillTemplate(template, values) {
2366
+ return template.replace(TOKEN, (whole, key) => values[key] ?? whole);
2367
+ }
2368
+ var fillCount = (template, count) => fillTemplate(template, { n: String(count) });
2369
+ function elapsedMs(start, nowMs) {
2370
+ const ms = toEpochMs(start);
2371
+ return ms === null ? null : Math.max(0, nowMs - ms);
2372
+ }
2373
+ function formatDuration(durationMs, strings, largestUnit = "day" /* Day */) {
2374
+ if (durationMs === null) return strings.unknown;
2375
+ if (durationMs < MS_PER_MINUTE2) return strings.lessThanMinute;
2376
+ const inMinutes = largestUnit === "minute" /* Minute */ || durationMs < MS_PER_HOUR2;
2377
+ if (inMinutes) return fillCount(strings.minutes, Math.floor(durationMs / MS_PER_MINUTE2));
2378
+ const inHours = largestUnit === "hour" /* Hour */ || durationMs < MS_PER_DAY2;
2379
+ if (inHours) return fillCount(strings.hours, Math.floor(durationMs / MS_PER_HOUR2));
2380
+ return fillCount(strings.days, Math.floor(durationMs / MS_PER_DAY2));
2381
+ }
2382
+ function ageFraction(ageMs, limitMs) {
2383
+ if (ageMs === null) return 0;
2384
+ if (limitMs <= 0) return 1;
2385
+ return Math.min(1, Math.max(0, ageMs / limitMs));
2386
+ }
2387
+ var AGE_FONT = 14;
2388
+ var AGE_WEIGHT = "600";
2389
+ var styles6 = reactNative.StyleSheet.create({
2390
+ text: { fontSize: AGE_FONT, fontWeight: AGE_WEIGHT, fontVariant: ["tabular-nums"] }
2391
+ });
2392
+ function AgeLabel({ ageMs, strings, largestUnit = "day" /* Day */, color, testID }) {
2393
+ const { theme } = uiFeedback.useUi();
2394
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.text, { color: color ?? theme.colors.text }], testID, children: formatDuration(ageMs, strings, largestUnit) });
2395
+ }
2396
+ var BAR_HEIGHT = 6;
2397
+ var BAR_RADIUS = 3;
2398
+ var GAP3 = 8;
2399
+ var LABEL_FONT = 13;
2400
+ var PERCENT = 100;
2401
+ var styles7 = reactNative.StyleSheet.create({
2402
+ row: { flexDirection: "row", alignItems: "center", gap: GAP3, flexGrow: 1 },
2403
+ track: { flexGrow: 1, flexShrink: 1, height: BAR_HEIGHT, borderRadius: BAR_RADIUS, overflow: "hidden" },
2404
+ fill: { height: BAR_HEIGHT, borderRadius: BAR_RADIUS },
2405
+ label: { fontSize: LABEL_FONT, fontVariant: ["tabular-nums"] }
2406
+ });
2407
+ function AgeBar({ fraction, color, label, testID }) {
2408
+ const { theme } = uiFeedback.useUi();
2409
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.row, testID, children: [
2410
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, style: [styles7.track, { backgroundColor: theme.colors.border }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles7.fill, { width: `${Math.round(fraction * PERCENT)}%`, backgroundColor: color }] }) }),
2411
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.label, { color: theme.colors.text }], children: label })
2412
+ ] });
2413
+ }
2414
+
2415
+ // src/StatusLedger/utils/ageBands.ts
2416
+ var oldestFloorFirst = (bands) => [...bands].sort((a, b) => b.minAgeMs - a.minAgeMs);
2417
+ function assignAgeBand(ageMs, bands) {
2418
+ const ordered = oldestFloorFirst(bands);
2419
+ const youngest = ordered[ordered.length - 1];
2420
+ if (ageMs === null) return youngest;
2421
+ return ordered.find((band) => ageMs >= band.minAgeMs) ?? youngest;
2422
+ }
2423
+ function groupByAgeBand(rows, ageOf, bands) {
2424
+ return oldestFloorFirst(bands).map((band) => ({ band, rows: rows.filter((row) => assignAgeBand(ageOf(row), bands)?.key === band.key) })).filter((group) => group.rows.length > 0);
2425
+ }
2426
+ function sortOldestFirst(rows, ageOf) {
2427
+ return sortLedgerRows(rows, ageOf, "desc" /* Desc */);
2428
+ }
2429
+
2430
+ // src/WorkQueue/constants.ts
2431
+ var WORK_QUEUE_TEST_ID = "ui-work-queue";
2432
+ var AGE_COLUMN_KEY = "age";
2433
+ var AGE_MIN_WIDTH = 88;
2434
+ var AGE_BAR_MIN_WIDTH = 200;
2435
+ var EMPTY_QUEUE_NO_ROW_ACTION = "empty or loading work queue: there is no row to open";
2436
+ var workQueueBandTestID = (testID, bandKey) => `${testID}-band-${bandKey}`;
2437
+ var workQueueLedgerTestID = (testID) => `${testID}-ledger`;
2438
+ var GAP4 = 12;
2439
+ var COUNT_FONT = 13;
2440
+ var styles8 = reactNative.StyleSheet.create({
2441
+ root: { gap: GAP4 },
2442
+ heading: { flexDirection: "row", alignItems: "center", gap: GAP4 },
2443
+ count: { fontSize: COUNT_FONT }
2444
+ });
2445
+ function AgeBandQueue({ ledger, ageOf, bands, bandCountLabel, testID }) {
2446
+ const { theme } = uiFeedback.useUi();
2447
+ const view = useLedgerView(ledger);
2448
+ const toneColor = useToneColor(ledger.toneColors);
2449
+ const groups = React2.useMemo(() => groupByAgeBand(view.visible, ageOf, bands), [view.visible, ageOf, bands]);
2450
+ const { labels } = ledger;
2451
+ const nothingToGroup = ledger.loading === true || groups.length === 0;
2452
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.root, testID, children: [
2453
+ /* @__PURE__ */ jsxRuntime.jsx(LedgerFilterBar, { labels, resultsCount: view.visible.length, testID: ledger.testID, view }),
2454
+ nothingToGroup ? /* @__PURE__ */ jsxRuntime.jsx(DataTable, { columns: view.tableColumns, emptyLabel: labels.empty, keyExtractor: ledger.keyExtractor, loading: ledger.loading, rowAction: { none: EMPTY_QUEUE_NO_ROW_ACTION }, rows: [], testID: `${ledger.testID}-table` }) : groups.map(({ band, rows }) => /* @__PURE__ */ jsxRuntime.jsx(
2455
+ LedgerSection,
2456
+ {
2457
+ columns: view.tableColumns,
2458
+ emptyLabel: labels.empty,
2459
+ heading: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityRole: "header", style: styles8.heading, children: [
2460
+ /* @__PURE__ */ jsxRuntime.jsx(StatusPill, { color: toneColor(band.tone), label: band.label, tone: band.tone }),
2461
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.count, { color: theme.colors.textSecondary }], children: fillTemplate(bandCountLabel, { n: String(rows.length) }) })
2462
+ ] }),
2463
+ ledger,
2464
+ rows,
2465
+ testID: workQueueBandTestID(testID, band.key),
2466
+ title: band.label
2467
+ },
2468
+ band.key
2469
+ ))
2470
+ ] });
2471
+ }
2472
+ function AgeLabelCell({ ageMs, color, strings, largestUnit }) {
2473
+ return /* @__PURE__ */ jsxRuntime.jsx(AgeLabel, { ageMs, color, largestUnit, strings });
2474
+ }
2475
+ function AgeBarCell({ ageMs, color, strings, limitMs, ageOfLimit, largestUnit }) {
2476
+ const label = fillTemplate(ageOfLimit, { age: formatDuration(ageMs, strings, largestUnit), limit: formatDuration(limitMs, strings, largestUnit) });
2477
+ return /* @__PURE__ */ jsxRuntime.jsx(AgeBar, { color, fraction: ageFraction(ageMs, limitMs), label });
2478
+ }
2479
+ function buildAgeColumn(options) {
2480
+ const { Cell, minWidth, ageOf, bands, strings, labels, limitMs, toneColor, largestUnit } = options;
2481
+ const render = (row) => {
2482
+ const age = ageOf(row);
2483
+ const color = toneColor(assignAgeBand(age, bands)?.tone ?? "neutral" /* Neutral */);
2484
+ return /* @__PURE__ */ jsxRuntime.jsx(Cell, { ageMs: age, ageOfLimit: labels.ageOfLimit, color, largestUnit, limitMs, strings });
2485
+ };
2486
+ return { key: AGE_COLUMN_KEY, header: labels.age, minWidth, sortValue: ageOf, render };
2487
+ }
2488
+
2489
+ // src/WorkQueue/WorkQueueVariant.ts
2490
+ var WorkQueueVariant = /* @__PURE__ */ ((WorkQueueVariant2) => {
2491
+ WorkQueueVariant2["Table"] = "table";
2492
+ WorkQueueVariant2["Bands"] = "bands";
2493
+ WorkQueueVariant2["Bar"] = "bar";
2494
+ return WorkQueueVariant2;
2495
+ })(WorkQueueVariant || {});
2496
+ function WorkQueue(props) {
2497
+ const { ledger, getStartedAt, nowMs, bands, durationStrings, labels, variant = "bands" /* Bands */, limitMs, largestUnit, testID = WORK_QUEUE_TEST_ID } = props;
2498
+ const toneColor = useToneColor(ledger.toneColors);
2499
+ const ageOf = React2.useCallback((row) => elapsedMs(getStartedAt(row), nowMs), [getStartedAt, nowMs]);
2500
+ const limit = limitMs ?? Math.max(0, ...bands.map((band) => band.minAgeMs));
2501
+ const queueLedger = React2.useMemo(() => {
2502
+ const asBar = variant === "bar" /* Bar */;
2503
+ const ageColumn = buildAgeColumn({ Cell: asBar ? AgeBarCell : AgeLabelCell, minWidth: asBar ? AGE_BAR_MIN_WIDTH : AGE_MIN_WIDTH, ageOf, bands, strings: durationStrings, labels, limitMs: limit, toneColor, largestUnit });
2504
+ return { ...ledger, rows: sortOldestFirst(ledger.rows, ageOf), columns: [ageColumn, ...ledger.columns], testID: workQueueLedgerTestID(testID) };
2505
+ }, [ledger, ageOf, bands, durationStrings, labels, limit, toneColor, largestUnit, variant, testID]);
2506
+ if (variant === "bands" /* Bands */) return /* @__PURE__ */ jsxRuntime.jsx(AgeBandQueue, { ageOf, bandCountLabel: labels.bandCount, bands, ledger: queueLedger, testID });
2507
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID, children: /* @__PURE__ */ jsxRuntime.jsx(StatusLedger, { ...queueLedger }) });
2508
+ }
2509
+
2342
2510
  // src/MonthStatusGrid/MonthGridColumns.ts
2343
2511
  var MonthGridColumns = /* @__PURE__ */ ((MonthGridColumns2) => {
2344
2512
  MonthGridColumns2[MonthGridColumns2["Twelve"] = 12] = "Twelve";
@@ -2370,7 +2538,7 @@ var CELL_INNER_GAP = 4;
2370
2538
  var LABEL_SIZE = 14;
2371
2539
  var SELECTED_BORDER = 2;
2372
2540
  var COLOR_STEP = "500";
2373
- var styles5 = reactNative.StyleSheet.create({
2541
+ var styles9 = reactNative.StyleSheet.create({
2374
2542
  grid: { gap: GRID_GAP },
2375
2543
  row: { flexDirection: "row", gap: GRID_GAP },
2376
2544
  filler: { flex: 1 },
@@ -2402,16 +2570,16 @@ var GridCell = ({ cell, isSelected, onSelect, hint, testID }) => {
2402
2570
  "aria-pressed": isSelected,
2403
2571
  onPress: () => onSelect(cell.id),
2404
2572
  style: [
2405
- styles5.cell,
2573
+ styles9.cell,
2406
2574
  { backgroundColor: isSelected ? colors.background : colors.surface, borderColor: colors.border },
2407
- cell.dashed === true && styles5.dashed,
2408
- isSelected && styles5.selected,
2575
+ cell.dashed === true && styles9.dashed,
2576
+ isSelected && styles9.selected,
2409
2577
  isSelected && { borderColor: theme.palette.primary[COLOR_STEP] }
2410
2578
  ],
2411
2579
  testID,
2412
2580
  children: [
2413
2581
  cell.icon !== void 0 && cell.icon !== null ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, children: cell.icon }) : null,
2414
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.label, { color: colors.text }], children: cell.label })
2582
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.label, { color: colors.text }], children: cell.label })
2415
2583
  ]
2416
2584
  }
2417
2585
  );
@@ -2431,7 +2599,7 @@ var MonthStatusGrid = ({
2431
2599
  const fitted = fitMonthGridColumns(columns, measuredWidth ?? windowWidth, GRID_GAP);
2432
2600
  const rows = React2.useMemo(() => chunkIntoRows(cells, fitted), [cells, fitted]);
2433
2601
  const onLayout = (event) => setMeasuredWidth(event.nativeEvent.layout.width);
2434
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style: styles5.grid, testID, children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles5.row, testID: `${testID}-row`, children: [
2602
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityHint, accessibilityLabel, onLayout, role: "group", style: styles9.grid, testID, children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.row, testID: `${testID}-row`, children: [
2435
2603
  row.map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
2436
2604
  GridCell,
2437
2605
  {
@@ -2443,7 +2611,7 @@ var MonthStatusGrid = ({
2443
2611
  },
2444
2612
  cell.id
2445
2613
  )),
2446
- Array.from({ length: fitted - row.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles5.filler }, index))
2614
+ Array.from({ length: fitted - row.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles9.filler }, index))
2447
2615
  ] }, row[0]?.id)) });
2448
2616
  };
2449
2617
 
@@ -2484,7 +2652,7 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
2484
2652
  const { width } = reactNative.useWindowDimensions();
2485
2653
  const panelWidth = Math.min(PANEL_MAX_WIDTH, Math.round(width * PANEL_SCREEN_SHARE));
2486
2654
  const focusTitleOnOpen = React2.useCallback((node) => node?.focus(), []);
2487
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.root, children: [
2655
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.root, children: [
2488
2656
  /* @__PURE__ */ jsxRuntime.jsx(
2489
2657
  reactNative.Pressable,
2490
2658
  {
@@ -2500,11 +2668,11 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
2500
2668
  reactNative.View,
2501
2669
  {
2502
2670
  accessibilityViewIsModal: true,
2503
- style: [styles6.panel, { width: panelWidth, backgroundColor: theme.colors.surface, borderColor: theme.colors.border }],
2671
+ style: [styles10.panel, { width: panelWidth, backgroundColor: theme.colors.surface, borderColor: theme.colors.border }],
2504
2672
  testID,
2505
2673
  children: [
2506
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.header, children: [
2507
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ref: focusTitleOnOpen, focusable: true, style: styles6.titleBox, testID: `${testID}-title`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles6.title, { color: theme.colors.text }], children: title }) }),
2674
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.header, children: [
2675
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ref: focusTitleOnOpen, focusable: true, style: styles10.titleBox, testID: `${testID}-title`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [styles10.title, { color: theme.colors.text }], children: title }) }),
2508
2676
  /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { label: closeLabel, hint: closeHint, tone: "primary", onPress: onClose, testID: `${testID}-close` })
2509
2677
  ] }),
2510
2678
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children })
@@ -2513,7 +2681,7 @@ function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, child
2513
2681
  )
2514
2682
  ] }) });
2515
2683
  }
2516
- var styles6 = reactNative.StyleSheet.create({
2684
+ var styles10 = reactNative.StyleSheet.create({
2517
2685
  root: { flex: 1, flexDirection: "row", justifyContent: "flex-end" },
2518
2686
  panel: { height: "100%", padding: PANEL_PAD, borderLeftWidth: PANEL_BORDER },
2519
2687
  header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: HEADER_GAP, marginBottom: HEADER_BOTTOM },
@@ -2663,7 +2831,7 @@ function ReportFilters({
2663
2831
  const isCompact = compact ?? width < CARD_STACK_BREAKPOINT;
2664
2832
  const renderBar = (barTestID, barActions) => /* @__PURE__ */ jsxRuntime.jsx(Filters, { fields, values, onChange: handleChange, actions: barActions, renderSelect, testID: barTestID });
2665
2833
  if (!isCompact) return renderBar(testID, actions);
2666
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.compactRow, testID, children: [
2834
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.compactRow, testID, children: [
2667
2835
  /* @__PURE__ */ jsxRuntime.jsx(
2668
2836
  ActionButton,
2669
2837
  {
@@ -2689,7 +2857,7 @@ function ReportFilters({
2689
2857
  )
2690
2858
  ] });
2691
2859
  }
2692
- var styles7 = reactNative.StyleSheet.create({
2860
+ var styles11 = reactNative.StyleSheet.create({
2693
2861
  compactRow: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: COMPACT_GAP }
2694
2862
  });
2695
2863
  function useReportFilterQuery({
@@ -2828,12 +2996,15 @@ Object.defineProperty(exports, "suggestOptions", {
2828
2996
  enumerable: true,
2829
2997
  get: function () { return uiForms.suggestOptions; }
2830
2998
  });
2999
+ exports.AgeBar = AgeBar;
3000
+ exports.AgeLabel = AgeLabel;
2831
3001
  exports.CARD_STACK_BREAKPOINT = CARD_STACK_BREAKPOINT;
2832
3002
  exports.DEFAULT_FETCH_CONCURRENCY = DEFAULT_FETCH_CONCURRENCY;
2833
3003
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
2834
3004
  exports.DEFAULT_PAGE_SIZE_OPTIONS = DEFAULT_PAGE_SIZE_OPTIONS;
2835
3005
  exports.DEFAULT_REPORT_QUERY_KEYS = DEFAULT_REPORT_QUERY_KEYS;
2836
3006
  exports.DataTable = DataTable;
3007
+ exports.DurationUnit = DurationUnit;
2837
3008
  exports.EMPTY_REPORT_FILTERS = EMPTY_REPORT_FILTERS;
2838
3009
  exports.EXPORT_CSV_TEST_ID = EXPORT_CSV_TEST_ID;
2839
3010
  exports.ExportCsvAction = ExportCsvAction;
@@ -2864,19 +3035,28 @@ exports.StatusPill = StatusPill;
2864
3035
  exports.StatusTone = StatusTone;
2865
3036
  exports.TABLE_I18N = TABLE_I18N;
2866
3037
  exports.TABLE_TEST_IDS = TABLE_TEST_IDS;
3038
+ exports.WORK_QUEUE_TEST_ID = WORK_QUEUE_TEST_ID;
3039
+ exports.WorkQueue = WorkQueue;
3040
+ exports.WorkQueueVariant = WorkQueueVariant;
3041
+ exports.ageFraction = ageFraction;
2867
3042
  exports.applyTestID = applyTestID;
3043
+ exports.assignAgeBand = assignAgeBand;
2868
3044
  exports.buildReportFields = buildReportFields;
2869
3045
  exports.clearTestID = clearTestID;
2870
3046
  exports.countActiveReportFilters = countActiveReportFilters;
2871
3047
  exports.csvFilename = csvFilename;
2872
3048
  exports.distinctValues = distinctValues;
2873
3049
  exports.downloadCsv = downloadCsv;
3050
+ exports.elapsedMs = elapsedMs;
2874
3051
  exports.fetchAllPages = fetchAllPages;
2875
3052
  exports.fieldTestID = fieldTestID;
3053
+ exports.fillTemplate = fillTemplate;
2876
3054
  exports.filterLedgerRows = filterLedgerRows;
2877
3055
  exports.fitMonthGridColumns = fitMonthGridColumns;
3056
+ exports.formatDuration = formatDuration;
2878
3057
  exports.formatRelativeTime = formatRelativeTime;
2879
3058
  exports.fromFilterValues = fromFilterValues;
3059
+ exports.groupByAgeBand = groupByAgeBand;
2880
3060
  exports.isAttentionTone = isAttentionTone;
2881
3061
  exports.isIsoDate = isIsoDate;
2882
3062
  exports.isRangeInverted = isRangeInverted;
@@ -2898,6 +3078,7 @@ exports.rowTestID = rowTestID;
2898
3078
  exports.runCsvExport = runCsvExport;
2899
3079
  exports.selectAllTestID = selectAllTestID;
2900
3080
  exports.sortLedgerRows = sortLedgerRows;
3081
+ exports.sortOldestFirst = sortOldestFirst;
2901
3082
  exports.splitNeedsLook = splitNeedsLook;
2902
3083
  exports.toEpochMs = toEpochMs;
2903
3084
  exports.toFilterValues = toFilterValues;
@@ -2905,5 +3086,7 @@ exports.useFilterDraft = useFilterDraft;
2905
3086
  exports.usePagedRows = usePagedRows;
2906
3087
  exports.useReportDraft = useReportDraft;
2907
3088
  exports.useReportFilterQuery = useReportFilterQuery;
3089
+ exports.workQueueBandTestID = workQueueBandTestID;
3090
+ exports.workQueueLedgerTestID = workQueueLedgerTestID;
2908
3091
  //# sourceMappingURL=index.js.map
2909
3092
  //# sourceMappingURL=index.js.map