@columenlabs/lumen-ui 0.1.166 → 0.1.168

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.
@@ -725,7 +725,8 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
725
725
  n = down ? n.nextElementSibling : n.previousElementSibling;
726
726
  if (!(n instanceof HTMLElement))
727
727
  return;
728
- n.focus();
728
+ n.focus({ preventScroll: true });
729
+ revealRow(n);
729
730
  const next = openKey === null ? undefined : sorted.find((x) => keyOf(x.original) === n.dataset.row);
730
731
  if (next && onDetails)
731
732
  onDetails(next.original);
@@ -737,7 +738,8 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
737
738
  if (openKey === null)
738
739
  return;
739
740
  const el = box.current?.querySelector(`tr[data-row="${CSS.escape(openKey)}"]`);
740
- el?.scrollIntoView({ block: 'nearest' });
741
+ if (el)
742
+ revealRow(el);
741
743
  }, [openKey, pageKeys, page?.index]);
742
744
  // The whole row opens the details drawer.
743
745
  const dataRow = (r) => (_jsxs(Fragment, { children: [_jsxs(TableRow, { "data-row": domain.rowKey(r.original), "data-state": tapped?.(r.original) ? 'selected' : undefined, "aria-selected": openKey === null ? undefined : openKey === keyOf(r.original), className: cn('group/row', onDetails && 'cursor-pointer'), tabIndex: onDetails ? 0 : undefined, onClick: onDetails ? () => onDetails(r.original) : undefined, onKeyDown: onDetails
@@ -883,3 +885,17 @@ function GroupMark({ field, value }) {
883
885
  return _jsx(ColorDot, { color: color });
884
886
  return _jsx(field.icon, {});
885
887
  }
888
+ /** Scrolls a row into view up and down only: a table wider than its box keeps its sideways scroll,
889
+ * so the name column never slides out of view when a row opens or the keys step. */
890
+ function revealRow(row) {
891
+ const kept = [];
892
+ for (let e = row.parentElement; e; e = e.parentElement)
893
+ if (e.scrollLeft)
894
+ kept.push([e, e.scrollLeft]);
895
+ row.scrollIntoView({ block: 'nearest', inline: 'nearest' });
896
+ for (let e = row.parentElement; e; e = e.parentElement) {
897
+ const was = kept.find(([k]) => k === e)?.[1] ?? 0;
898
+ if (e.scrollLeft !== was)
899
+ e.scrollLeft = was;
900
+ }
901
+ }
@@ -93,8 +93,8 @@ export function LumenCard({ domain, tile: t, rows, fields, drawn, loading, style
93
93
  const tone = meterTone(meter, share, bands ?? (meter ? kitBands(meter) : undefined));
94
94
  const of = target ? (_jsx(ViewValueCell, { value: target, format: figs.main.format, amount: figs.main.amount })) : null;
95
95
  if (style === 'progress_circle')
96
- return (_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx(ProgressRing, { value: share, tone: tone }), _jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("span", { className: "num truncate text-xl leading-7 font-semibold", children: _jsx(FigureText, { f: figs.main }) }), _jsx("span", { className: "num truncate text-xs text-muted-foreground", children: of ? _jsxs(_Fragment, { children: ["of ", of] }) : 'Set a target in Edit widget' })] })] }));
97
- return (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("span", { className: cn('num truncate text-2xl leading-8 font-semibold', t.sign && typeof v === 'number' && (v > 0 ? 'text-gain' : v < 0 ? 'text-loss' : '')), children: _jsx(FigureText, { f: figs.main }) }), style === 'progress_bar' && (_jsxs("div", { className: "flex flex-col gap-1 pt-1", children: [_jsx(Progress, { value: share ?? 0, className: cn('h-2', tone && TONE_BAR[tone]), "aria-label": "Progress to target" }), _jsx("span", { className: "num text-xs text-muted-foreground", children: of ? (_jsxs(_Fragment, { children: [share === null ? '—' : `${share.toFixed(0)}%`, " of ", of] })) : ('Set a target in Edit widget') })] })), figs.lines.map((l, i) => (_jsx("span", { className: "num line-clamp-2 text-xs text-muted-foreground", children: _jsx(FigureText, { f: l }) }, i)))] }));
96
+ return (_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx(ProgressRing, { value: share, tone: tone }), _jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("span", { className: "num truncate text-xl leading-7 font-semibold", children: _jsx(FigureText, { f: figs.main }) }), _jsx("span", { className: "truncate text-xs text-muted-foreground tabular-nums", children: of ? _jsxs(_Fragment, { children: ["of ", of] }) : 'Set a target in Edit widget' })] })] }));
97
+ return (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("span", { className: cn('num truncate text-2xl leading-8 font-semibold', t.sign && typeof v === 'number' && (v > 0 ? 'text-gain' : v < 0 ? 'text-loss' : '')), children: _jsx(FigureText, { f: figs.main }) }), style === 'progress_bar' && (_jsxs("div", { className: "flex flex-col gap-1 pt-1", children: [_jsx(Progress, { value: share ?? 0, className: cn('h-2', tone && TONE_BAR[tone]), "aria-label": "Progress to target" }), _jsx("span", { className: "text-xs text-muted-foreground tabular-nums", children: of ? (_jsxs(_Fragment, { children: [share === null ? '—' : `${share.toFixed(0)}%`, " of ", of] })) : ('Set a target in Edit widget') })] })), figs.lines.map((l, i) => (_jsx("span", { className: "line-clamp-2 text-xs text-muted-foreground tabular-nums", children: _jsx(FigureText, { f: l }) }, i)))] }));
98
98
  }
99
99
  /** A meter's bands from the app's `meterLevels` or `healthLevels`, in %. */
100
100
  const kitBands = (meter) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.166",
3
+ "version": "0.1.168",
4
4
  "description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  "@codemirror/lang-javascript": "6.2.5",
50
50
  "@codemirror/lang-json": "6.0.2",
51
51
  "@codemirror/lang-sql": "6.10.0",
52
- "@columenlabs/lumen-ui-types": "0.1.166",
52
+ "@columenlabs/lumen-ui-types": "0.1.168",
53
53
  "@dnd-kit/core": "6.3.1",
54
54
  "@dnd-kit/sortable": "10.0.0",
55
55
  "@dnd-kit/utilities": "3.2.2",