@columenlabs/lumen-ui 0.1.27 → 0.1.28

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.
@@ -37,7 +37,8 @@ export interface CoverageData {
37
37
  current?: string;
38
38
  }
39
39
  export type CoverageBlock = 'day' | 'week' | 'month' | 'quarter' | 'year';
40
- export type CoverageSummary = 'complete' | 'first' | 'last' | 'rows';
40
+ /** `rows`: what is in hand; `counts`: in hand / expected (`9,212 / 9,712`). */
41
+ export type CoverageSummary = 'complete' | 'first' | 'last' | 'rows' | 'counts';
41
42
  /** A backfill pick: each row with the months its picked blocks cover. */
42
43
  export type CoveragePick = {
43
44
  row: string;
@@ -139,13 +139,17 @@ const SUMMARY_HEAD = {
139
139
  first: 'First',
140
140
  last: 'Last',
141
141
  rows: '',
142
+ counts: '',
142
143
  };
143
144
  const SUMMARY_WIDTH = {
144
145
  complete: '5rem',
145
146
  first: '6.5rem',
146
147
  last: '6.5rem',
147
148
  rows: '5rem',
149
+ counts: '9rem',
148
150
  };
151
+ /** In hand / expected; a row with nothing expected shows only what it has. */
152
+ const fmtCounts = (have, expected) => expected > 0 ? `${fmtInt(have)} / ${fmtInt(expected)}` : fmtInt(have);
149
153
  /** A grid-shaped skeleton: label column plus empty cells, so nothing jumps when data lands. */
150
154
  function GridSkeleton({ rows = 8 }) {
151
155
  return (_jsx("div", { "aria-busy": "true", "aria-label": "Loading", className: "flex flex-col gap-[5px] py-1", children: Array.from({ length: rows }, (_, i) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-4 w-16 shrink-0" }), _jsx(Skeleton, { className: "h-[18px] flex-1" })] }, i))) }));
@@ -192,7 +196,9 @@ const MapRow = memo(function MapRow({ r, cols, marks, picks, total, look, }) {
192
196
  ? (r.first ?? '—')
193
197
  : s === 'last'
194
198
  ? (r.last ?? '—')
195
- : fmtInt(total.have) }, s)))] }));
199
+ : s === 'counts'
200
+ ? fmtCounts(total.have, total.expected)
201
+ : fmtInt(total.have) }, s)))] }));
196
202
  }, (a, b) => a.sig === b.sig && sameNode(a.r.badge, b.r.badge));
197
203
  export function LumenCoverageMap({ source, title, icon = Grid3x3Icon, rows: rowSpec, layout = 'grid', block: initialBlock = 'month', zoom, window = 'all', unit = 'sessions', summary = ['complete', 'last'], select, selectable = () => true, onQueue, drilled = null, onDrill, groupBy = false, hint, pageSize: initialPageSize, pager, tools, filter, filterCount, empty, lazy = false, }) {
198
204
  const { data, load: raw, ref } = useLumenSource(source, { lazy });
@@ -319,7 +325,7 @@ export function LumenCoverageMap({ source, title, icon = Grid3x3Icon, rows: rowS
319
325
  const grid = {
320
326
  gridTemplateColumns: `${mobile ? '2.75rem' : '4rem'} repeat(12, minmax(${mobile ? '14px' : '18px'}, 1fr)) ${sumCols}`,
321
327
  };
322
- body = (_jsxs("div", { className: "grid items-center gap-[3px]", style: grid, onClick: onCellClick, children: [_jsx("span", { className: "text-xs text-muted-foreground", children: "Year" }), MON.map((m, i) => (_jsx("span", { className: "text-xs text-muted-foreground", children: mobile ? (i % 3 === 0 ? m : '') : m }, m))), sums.map((s) => (_jsx("span", { className: "pl-3 text-right text-xs text-muted-foreground", children: s === 'rows' ? rowsHead : SUMMARY_HEAD[s] }, s))), years.map((y) => {
328
+ body = (_jsxs("div", { className: "grid items-center gap-[3px]", style: grid, onClick: onCellClick, children: [_jsx("span", { className: "text-xs text-muted-foreground", children: "Year" }), MON.map((m, i) => (_jsx("span", { className: "text-xs text-muted-foreground", children: mobile ? (i % 3 === 0 ? m : '') : m }, m))), sums.map((s) => (_jsx("span", { className: "pl-3 text-right text-xs text-muted-foreground", children: s === 'rows' || s === 'counts' ? rowsHead : SUMMARY_HEAD[s] }, s))), years.map((y) => {
323
329
  let have = 0;
324
330
  let expected = 0;
325
331
  return [
@@ -334,7 +340,13 @@ export function LumenCoverageMap({ source, title, icon = Grid3x3Icon, rows: rowS
334
340
  expected += c.expected;
335
341
  return (_jsx(CoverageCell, { level: c.level, label: `${row} · ${blockName(key)}`, tip: `${row}|${key}`, picked: drilled === key, pickable: select === 'drill', disabled: select !== 'drill', className: mobile ? 'h-4' : 'h-5' }, key));
336
342
  }),
337
- ...sums.map((s) => (_jsx("span", { className: cn('num pl-3 text-right text-xs', s !== 'complete' && 'text-muted-foreground'), children: s === 'complete' ? fmtPct(have, expected) : s === 'rows' ? fmtInt(have) : '' }, `${y}-${s}`))),
343
+ ...sums.map((s) => (_jsx("span", { className: cn('num pl-3 text-right text-xs', s !== 'complete' && 'text-muted-foreground'), children: s === 'complete'
344
+ ? fmtPct(have, expected)
345
+ : s === 'rows'
346
+ ? fmtInt(have)
347
+ : s === 'counts'
348
+ ? fmtCounts(have, expected)
349
+ : '' }, `${y}-${s}`))),
338
350
  ];
339
351
  })] }));
340
352
  }
@@ -363,7 +375,7 @@ export function LumenCoverageMap({ source, title, icon = Grid3x3Icon, rows: rowS
363
375
  }
364
376
  const look = { mobile, groupBy, select, sums, drilled, link: rowSpec.link };
365
377
  let group;
366
- body = (_jsxs("div", { className: "grid min-w-min items-center gap-[3px]", style: grid, onClick: onCellClick, children: [_jsx("span", { className: "sticky left-0 z-1 bg-card text-xs text-muted-foreground", children: mobile ? '' : rowSpec.title }), cols.map((k) => (_jsx("span", { className: "num h-4 overflow-visible text-[11px] whitespace-nowrap text-muted-foreground", children: headLabel(k, block, cols.length) }, k))), sums.map((s) => (_jsx("span", { className: "pl-3 text-right text-xs text-muted-foreground", children: s === 'rows' ? rowsHead : SUMMARY_HEAD[s] }, s))), rowList.flatMap((r) => {
378
+ body = (_jsxs("div", { className: "grid min-w-min items-center gap-[3px]", style: grid, onClick: onCellClick, children: [_jsx("span", { className: "sticky left-0 z-1 bg-card text-xs text-muted-foreground", children: mobile ? '' : rowSpec.title }), cols.map((k) => (_jsx("span", { className: "num h-4 overflow-visible text-[11px] whitespace-nowrap text-muted-foreground", children: headLabel(k, block, cols.length) }, k))), sums.map((s) => (_jsx("span", { className: "pl-3 text-right text-xs text-muted-foreground", children: s === 'rows' || s === 'counts' ? rowsHead : SUMMARY_HEAD[s] }, s))), rowList.flatMap((r) => {
367
379
  const out = [];
368
380
  const shut = groupBy && folds.has(foldKey + (r.group ?? ''));
369
381
  if (groupBy && r.group !== group) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "@codemirror/lang-javascript": "6.2.5",
42
42
  "@codemirror/lang-json": "6.0.2",
43
43
  "@codemirror/lang-sql": "6.10.0",
44
- "@columenlabs/lumen-ui-types": "0.1.27",
44
+ "@columenlabs/lumen-ui-types": "0.1.28",
45
45
  "@dnd-kit/core": "6.3.1",
46
46
  "@dnd-kit/sortable": "10.0.0",
47
47
  "@dnd-kit/utilities": "3.2.2",