@columenlabs/lumen-ui 0.1.114 → 0.1.115

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/README.md CHANGED
@@ -78,7 +78,7 @@ Every export, its props and an example are on the [docs](https://lumen.columenla
78
78
  - Numbers use tabular figures and a true minus `−`; a gain or loss always shows a sign or arrow.
79
79
  - A page's header numbers are metric cards: `TileRow` of `Tile` (or `TileToggleGroup` when they pick what the page shows), with `fill` so they share the row, each with `spark` set to its daily history where it has one. Don't build a card of your own for this.
80
80
  - Column widths: the first column (a row's name) grows only to `--lead-col-max` (18rem, theme.css); past it the cell truncates on one line and a plain text value shows in full on hover (a rendered cell brings its own hover card). Cap any other column with the field's `maxWidth` (`'12rem'`), or lift the cap with `maxWidth: false`. In a rendered name cell, put the name in a `truncate` span so the ellipsis lands on it, not on a chip after it.
81
- - Group, sub-group and Total rows read on one line at every width, a phone's cards included: the group's name shortens in an ellipsis (full name on hover) and its roll-up figure stays on the right. The view marks them `data-rollup` and theme.css keeps them to one line, so a `mark`, `rollRender` or `groupActions` an app passes never wraps them.
81
+ - Rows never wrap. Every row (data, group, sub-group, Total) reads on one line at every width. On a phone each row is a one-line card: its name (ellipsis, full name on hover) and one value on the right, the sorted column, else the first number or date. The other values are in the row's drawer or panel. Pick which value a phone shows by sorting (Sort by) or by marking the others `hideOnPhone`.
82
82
  - Column alignment is the table's, not the cell's. Text left, numbers right, and a number column has one right edge for its header, values, dashes and Total. `UnitValue` puts the unit in a fixed slot after the number (`--unit-slot`, 2rem) and its status dot just left of the number. In a LumenView table the first `UnitValue` drawn in a column marks it (`data-units` on every cell of that column, through the `UnitColumns` context and the cell's `data-col`); theme.css then widens that column's right gutter by the slot and hangs each unit in it. So a plain `—`, `Free` or `$0.21` an app draws in the same column sits on the digits' edge, and the header sits over the digits. Don't hand-place units, dots or padding to line a column up; if a column is off, draw its numbers through `UnitValue`. Outside a LumenView table (a hover card, a tile) `UnitValue` keeps its slot inline.
83
83
  - A metered column (use against an allowance) shows one number per cell with `UnitValue` (right-aligned number, fixed muted unit slot, status dot), never `value [pct]`. Offer both readings through the field's `showAs` (Amount / % of allowance, picked per column in Edit view, saved as `shows`); default amounts for sizes (storage) and shares for capped counts. Put the other reading, the allowance and the cost formula in a hover card. Totals use `rollRender`: sum amounts with their unit; a share is the rows' total over their allowance, never a sum of percents.
84
84
  - A floating bulk-action bar over a table's selection: Apply clears the selection and the bar goes away; the toast's Undo restores the change, not the selection. Cancel keeps the selection.
@@ -440,12 +440,13 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
440
440
  // Inline chips sit on the first column, next to the row's name, not in their own.
441
441
  const inline = visible.filter((f, i) => i > 0 && chips.some((c) => c.key === f.key && c.placement === 'inline'));
442
442
  const shown = visible.filter((f) => !inline.includes(f));
443
- // On a narrow phone each row reads as a card (theme.css, `data-card`): its name and one figure
444
- // (the sorted one, else the first number or date) on the first line, the rest on the second.
445
- // Numbers and dates keep their width there; only text shortens.
443
+ // On a narrow phone each row reads as a card on ONE line (theme.css, `data-card`): its name and
444
+ // one value (the sorted one, else the first number or date, else the next column). The rest
445
+ // waits in the row's detail, never on a second line.
446
446
  const short = (f) => f.format !== 'text' || (rows[0] !== undefined && isDateText(f.value(rows[0])));
447
- const meta = (shown.find((f, i) => i > 0 && f.key === sorting[0]?.id && short(f)) ??
448
- shown.find((f, i) => i > 0 && short(f)))?.key;
447
+ const onCard = shown.filter((f, i) => i > 0 && !f.hideOnPhone);
448
+ const meta = (onCard.find((f) => f.key === sorting[0]?.id) ?? onCard.find(short) ?? onCard[0])
449
+ ?.key;
449
450
  const cardOf = (f) => f === shown[0] ? 'lead' : f.key === meta ? 'meta' : short(f) ? 'num' : 'text';
450
451
  const col = (f, ...more) => ({
451
452
  ...colProps(f, ...more),
package/dist/theme.css CHANGED
@@ -443,9 +443,11 @@
443
443
  }
444
444
 
445
445
  /* A LumenView table on a narrow phone (`data-cards`): each row is a card, so nothing runs off
446
- the right edge. Line 1: the row's name (shortens) and one figure (`data-card="meta"`); line 2:
447
- the other values, small and muted. Numbers, dates and their units keep their width; only text
448
- shortens, in an ellipsis. Group, Total and More rows span the card's width. */
446
+ the right edge, and every row is ONE line, whatever an app draws in it: the row's name (shortens
447
+ in an ellipsis), then one figure (`data-card="meta"`, the sorted one, else the first number or
448
+ date) on the right. The other values wait in the row's detail (its drawer or panel), never on a
449
+ second line. Group, fold and Total rows (`data-rollup`) read the same way. More and empty rows
450
+ are one cell across the card. */
449
451
  @media (max-width: 639px) {
450
452
  table[data-cards],
451
453
  table[data-cards] > tbody,
@@ -462,55 +464,46 @@
462
464
  }
463
465
  table[data-cards] tr {
464
466
  display: flex;
465
- flex-wrap: wrap;
466
- align-items: baseline;
467
+ flex-wrap: nowrap;
468
+ align-items: center;
467
469
  column-gap: 0.75rem;
468
- row-gap: 0.125rem;
469
470
  padding: 0.5rem var(--cell-x);
471
+ white-space: nowrap;
470
472
  }
471
473
  table[data-cards] td {
472
474
  padding: 0 !important;
473
475
  width: auto !important;
474
476
  min-width: 0;
477
+ white-space: nowrap;
475
478
  }
476
479
  table[data-cards] td[colspan] {
477
480
  flex: 1 1 100%;
478
481
  }
479
- table[data-cards] td:not([data-card]):not([colspan]) {
482
+ /* A row's panel (`row-panel`) is a box of its own under the row, not a row: it keeps its lines. */
483
+ table[data-cards] tr[data-slot="row-panel"],
484
+ table[data-cards] tr[data-slot="row-panel"] > td {
485
+ white-space: normal;
486
+ }
487
+ table[data-cards] td:not([data-card]):not([colspan]),
488
+ table[data-cards] td:is([data-card="num"], [data-card="text"]) {
480
489
  display: none;
481
490
  }
482
491
  table[data-cards] td[data-card="select"] {
483
492
  order: 0;
484
493
  flex: none;
485
- align-self: center;
486
494
  }
487
495
  table[data-cards] td[data-card="lead"] {
488
496
  order: 1;
489
497
  flex: 1 1 0;
490
498
  overflow: hidden;
499
+ text-overflow: ellipsis;
491
500
  font-weight: 500;
492
501
  }
493
502
  table[data-cards] td[data-card="meta"] {
494
503
  order: 2;
495
504
  flex: none;
496
- }
497
- table[data-cards] tr:has(> td[data-card="lead"])::after {
498
- content: "";
499
- order: 3;
500
- flex-basis: 100%;
501
- }
502
- table[data-cards] td:is([data-card="num"], [data-card="text"]) {
503
- order: 4;
504
- font-size: 0.8125rem;
505
- color: var(--muted-foreground);
506
- }
507
- table[data-cards] td[data-card="num"] {
508
- flex: none;
509
- }
510
- table[data-cards] td[data-card="text"] {
511
- flex: 0 1 auto;
505
+ max-width: 50%;
512
506
  overflow: hidden;
513
- text-overflow: ellipsis;
514
507
  }
515
508
  table[data-cards] [data-slot="unit-value-unit"] {
516
509
  position: static;
@@ -519,31 +512,7 @@
519
512
  margin-left: 0.25em;
520
513
  font-size: inherit;
521
514
  }
522
- /* Group, fold and Total rows (`data-rollup`) are one line at every width: the name shortens
523
- in an ellipsis, the row's one figure keeps its width on the right, and the rest waits in the
524
- open rows. Whatever an app draws in them (a mark, a roll-up, group actions) never wraps.
525
- The group band pins as a whole row here: a cell can't pin inside a one-line flex row. */
526
- table[data-cards] tr[data-rollup] {
527
- flex-wrap: nowrap;
528
- align-items: center;
529
- white-space: nowrap;
530
- }
531
- table[data-cards] tr[data-rollup]::after {
532
- display: none;
533
- }
534
- table[data-cards] tr[data-rollup] > td {
535
- white-space: nowrap;
536
- }
537
- table[data-cards] tr[data-rollup] > td[data-card="lead"] {
538
- flex: 1 1 0;
539
- min-width: 0;
540
- overflow: hidden;
541
- }
542
- table[data-cards]
543
- tr[data-rollup]
544
- > td:is([data-card="num"], [data-card="text"], :not([data-card])) {
545
- display: none;
546
- }
515
+ /* The group band pins as a whole row here: a cell can't pin inside a one-line flex row. */
547
516
  table[data-cards] tr[data-group] {
548
517
  position: sticky;
549
518
  top: var(--pin-top, 0px);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.114",
3
+ "version": "0.1.115",
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.114",
52
+ "@columenlabs/lumen-ui-types": "0.1.115",
53
53
  "@dnd-kit/core": "6.3.1",
54
54
  "@dnd-kit/sortable": "10.0.0",
55
55
  "@dnd-kit/utilities": "3.2.2",