@columenlabs/lumen-ui 0.1.162 → 0.1.164

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/info-tip.js CHANGED
@@ -21,7 +21,9 @@ export function InfoTip({ children, label = 'More about this', side = 'top', cla
21
21
  onPointerEnter: (e) => e.pointerType === 'mouse' && later(true, 150),
22
22
  onPointerLeave: (e) => e.pointerType === 'mouse' && later(false, 200),
23
23
  };
24
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": label, className: cn('inline-flex size-4 shrink-0 items-center justify-center rounded-full align-middle text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring', className), onFocus: () => later(true, 0), onBlur: () => later(false, 100), ...hover, children: _jsx(InfoIcon, { className: "size-3.5" }) }) }), _jsx(PopoverContent, { side: side, className: "w-72 text-muted-foreground text-xs leading-relaxed",
24
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": label, className: cn(
25
+ // A 16px icon with a 24px hit area (WCAG 2.2 target size on a phone).
26
+ "relative inline-flex size-4 shrink-0 items-center justify-center rounded-full align-middle text-muted-foreground outline-none after:absolute after:-inset-1 after:content-[''] hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", className), onFocus: () => later(true, 0), onBlur: () => later(false, 100), ...hover, children: _jsx(InfoIcon, { className: "size-3.5" }) }) }), _jsx(PopoverContent, { side: side, className: "w-72 text-muted-foreground text-xs leading-relaxed",
25
27
  // Focus stays on the (i): the tip is read, not worked in.
26
28
  onOpenAutoFocus: (e) => e.preventDefault(), onCloseAutoFocus: (e) => e.preventDefault(), ...hover, children: children })] }));
27
29
  }
@@ -388,14 +388,6 @@ function pathOf(domain, f) {
388
388
  }
389
389
  /** Every header carries its colour (`colorOf`), text and a 2px rule. */
390
390
  const ruleOf = (color) => color ? { boxShadow: `inset 0 -2px 0 ${color}` } : undefined;
391
- /** The width a table has to fit in: its box, or inside a page's view scroller the view's width. */
392
- function roomOf(el) {
393
- const view = el.closest('[data-slot=view-scroll]');
394
- if (!view)
395
- return el.clientWidth;
396
- const cs = getComputedStyle(view);
397
- return view.clientWidth - Number.parseFloat(cs.paddingLeft) - Number.parseFloat(cs.paddingRight);
398
- }
399
391
  const alignOf = (format) => (format === 'text' ? 'text-left' : 'text-right');
400
392
  /** A column's cell classes: its alignment, and hidden on phones where the field says so. */
401
393
  /** An ISO date, alone or with a time after it: `2026-10-14`, `2026-10-14 16:17`. */
@@ -495,21 +487,12 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
495
487
  const onCard = shown.filter((f, i) => i > 0 && !f.hideOnPhone);
496
488
  const meta = (onCard.find((f) => f.key === sorting[0]?.id) ?? onCard.find(short) ?? onCard[0])
497
489
  ?.key;
498
- // Too narrow for every column (a docked drawer beside it, a small window), the table drops its
499
- // lowest-`priority` columns, right to left, until it fits, instead of scrolling sideways; never
500
- // its name or sorted column. More room brings them back. A phone keeps its own cards.
501
- const rank = (f) => (f.priority ?? 0) - (f.hideOnPhone ? 1 : 0);
502
- const dropOrder = shown
503
- .slice(1)
504
- .map((f, i) => ({ f, i }))
505
- .filter(({ f }) => f.key !== sorting[0]?.id)
506
- .sort((a, b) => rank(a.f) - rank(b.f) || b.i - a.i)
507
- .map(({ f }) => f.key);
508
- const [drop, setDrop] = useState(0);
509
- const dropped = new Set(isMobile || fit ? [] : dropOrder.slice(0, drop));
490
+ // Every column the person chose is always drawn. Too narrow for them all (a docked drawer beside
491
+ // it, a small window, an open sidebar), the table scrolls sideways; it never drops a column to
492
+ // fit, and the name column stops at its cap (`--lead-col-max`) so it can't take the room.
510
493
  const cardOf = (f) => f === shown[0] ? 'lead' : f.key === meta ? 'meta' : short(f) ? 'num' : 'text';
511
494
  const col = (f, ...more) => ({
512
- ...colProps(f, ...more, f && dropped.has(f.key) && 'hidden'),
495
+ ...colProps(f, ...more),
513
496
  'data-card': f ? cardOf(f) : undefined,
514
497
  'data-card-unit': f?.cardUnit,
515
498
  });
@@ -828,39 +811,6 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
828
811
  };
829
812
  const box = useRef(null);
830
813
  useFloatingHead(box, !inView);
831
- // Before paint: one more column drops while the table is wider than its room: its box, and in a
832
- // page's view scroller the view's width (theme.css `--view-w`).
833
- useLayoutEffect(() => {
834
- const el = box.current;
835
- const t = el?.querySelector('table');
836
- if (!el || !t || isMobile || fit || drop >= dropOrder.length)
837
- return;
838
- if (t.offsetWidth > roomOf(el) + 1)
839
- setDrop((d) => d + 1);
840
- });
841
- // Every column comes back to be measured again on a new set of columns or more room.
842
- const dropKey = dropOrder.join('\u0000');
843
- const lastDropKey = useRef(dropKey);
844
- if (lastDropKey.current !== dropKey) {
845
- lastDropKey.current = dropKey;
846
- if (drop)
847
- setDrop(0);
848
- }
849
- useEffect(() => {
850
- const el = box.current;
851
- if (!el)
852
- return;
853
- const view = el.closest('[data-slot=view-scroll]');
854
- let room = roomOf(el);
855
- const watch = new ResizeObserver(() => {
856
- const now = roomOf(el);
857
- if (now > room + 1)
858
- setDrop(0);
859
- room = now;
860
- });
861
- watch.observe(view ?? el);
862
- return () => watch.disconnect();
863
- }, []);
864
814
  return (_jsxs("div", { ref: box, className: cn(inView ? IN_VIEW : 'overflow-x-auto overflow-y-hidden [--pin-top:0px]', fit && FIT), children: [cardSort, _jsx(UnitColumns.Provider, { value: markUnits, children: _jsxs(Table, { "data-cards": "", children: [_jsx(TableHeader, { children: table.getHeaderGroups().map((hg) => (_jsxs(TableRow, { children: [selection && (_jsx(TableHead, { className: cn('w-8 pr-0', PINNED_HEAD), children: _jsx(Checkbox, { checked: allOn ? true : someOn ? 'indeterminate' : false, onCheckedChange: (on) => toggle(allKeys, on === true), "aria-label": "Select every row" }) })), hg.headers.map((h, i) => (_jsxs(TableHead, { ...col(shown[i], PINNED_HEAD), style: ruleOf(colorOf(domain, shown[i])), onPointerDown: pressStart, onPointerUp: pressEnd, onPointerLeave: pressEnd, onPointerCancel: pressEnd, onContextMenu: (e) => {
865
815
  if (press.current)
866
816
  e.preventDefault();
@@ -140,9 +140,8 @@ export interface ViewField<T> {
140
140
  /** Left out on phones, where the table has no room for it (a returns table's longer windows). */
141
141
  hideOnPhone?: boolean;
142
142
  /**
143
- * Where a table has too little room (a docked drawer beside it), its columns drop until it fits:
144
- * the lowest `priority` first (default 0; `hideOnPhone` ones count one lower), right to left.
145
- * The name and the sorted column never drop.
143
+ * @deprecated Ignored: a table no longer drops columns to fit. Too narrow for every column, it
144
+ * scrolls sideways. Kept so an app that sets it still type-checks.
146
145
  */
147
146
  priority?: number;
148
147
  /** Left out of a table when no row in it has a value (none, empty or 0): an Attachments column on mail with none. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.162",
3
+ "version": "0.1.164",
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.162",
52
+ "@columenlabs/lumen-ui-types": "0.1.164",
53
53
  "@dnd-kit/core": "6.3.1",
54
54
  "@dnd-kit/sortable": "10.0.0",
55
55
  "@dnd-kit/utilities": "3.2.2",