@sincpro/web-ui 2.9.0 → 2.10.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.
Files changed (36) hide show
  1. package/README.md +32 -24
  2. package/dist/components/board/Board.d.ts +2 -1
  3. package/dist/components/board/Board.js +17 -1
  4. package/dist/components/listing/ListingBar.d.ts +25 -1
  5. package/dist/components/listing/ListingBar.js +43 -14
  6. package/dist/components/listing/Pagination.d.ts +4 -1
  7. package/dist/components/listing/Pagination.js +19 -6
  8. package/dist/components/listing/modelCells.js +1 -9
  9. package/dist/components/record/ActionDock.d.ts +30 -8
  10. package/dist/components/record/ActionDock.js +17 -6
  11. package/dist/components/record/RecordHeader.js +42 -73
  12. package/dist/components/record/SmartButtons.d.ts +2 -8
  13. package/dist/components/record/SmartButtons.js +1 -6
  14. package/dist/primitives/choice/Switch.d.ts +4 -1
  15. package/dist/primitives/choice/Switch.js +2 -2
  16. package/dist/primitives/table/DataTable.d.ts +14 -0
  17. package/dist/primitives/table/DataTable.js +17 -1
  18. package/dist/primitives/table/RowActions.d.ts +5 -0
  19. package/dist/primitives/table/RowActions.js +27 -3
  20. package/dist/primitives/table/index.d.ts +1 -1
  21. package/dist/primitives/value/YesNo.d.ts +22 -0
  22. package/dist/primitives/value/YesNo.js +16 -0
  23. package/dist/primitives/value/index.d.ts +1 -0
  24. package/dist/primitives/value/index.js +1 -0
  25. package/dist/tokens.css +16 -0
  26. package/dist/views/list/List.d.ts +5 -1
  27. package/dist/views/list/List.js +6 -2
  28. package/dist/views/list/ListView.d.ts +1 -1
  29. package/dist/views/list/ListView.js +89 -33
  30. package/dist/views/list/presentations.d.ts +2 -2
  31. package/dist/views/list/presentations.js +35 -3
  32. package/dist/views/list/types.d.ts +15 -5
  33. package/dist/views/list/useReachBottom.d.ts +15 -0
  34. package/dist/views/list/useReachBottom.js +55 -0
  35. package/dist/views/record/Record.js +1 -3
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -268,12 +268,12 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
268
268
  `menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card`, `board.tile`,
269
269
  `board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
270
270
  `search.panel`, `search.suggestions`, `search.suggestion`, `search.record`, `search.advanced`,
271
- `search.keys`, `search-entry`, `search-entry.keys`, `table`, `table.pile`,
272
- `table.head`, `topbar`, `topbar.brand`, `topbar.menus`, `topbar.actions`, `topbar.user`,
271
+ `search.keys`, `search-entry`, `search-entry.keys`, `table`, `table.pile`, `yes-no`,
272
+ `table.head`, `row.ways`, `topbar`, `topbar.brand`, `topbar.menus`, `topbar.actions`, `topbar.user`,
273
273
  `frame`, `frame.bar`, `frame.sidebar`, `frame.main`, `sidebar`, `sidebar.brand`,
274
274
  `sidebar.user`, `sidebar.search`, `sidebar.nav`, `sidebar.account`, `navigation`,
275
275
  `navigation.item`, `dirty.blocked`, `dirty.bar`, `field`, `field.label`, `form.section`,
276
- `form.index`, `dock`, `dock.pill`, `dock.bare`, `pager`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
276
+ `form.index`, `dock`, `dock.pill`, `dock.bare`, `pager`, `pagination`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
277
277
  `guide.progress`, `guide.title`, `guide.body`, `guide.actions`. A part that is one of many
278
278
  carries `data-key` too (`navigation.item`). Put your rules in a cascade layer above web-ui's, or
279
279
  outside any layer.
@@ -385,25 +385,32 @@ under «8.370,57», not «6.057,1».
385
385
 
386
386
  #### The direction: the modern style (`ViewStyleProvider`)
387
387
 
388
- **Modern is where the system is going.** It is not a trial: it is how new screens are drawn,
389
- and it keeps being applied to the rest of the system and refined. `traditional` stays — same
390
- API, same data — for the applications already drawn in it. What the direction is:
391
-
392
- - **The page breathes on the ground.** No white band on top of the paper: the trail IS the
393
- page's heading (`Breadcrumb size="lg"`), and the counters and the state sit a step down,
394
- quieter.
395
- - **One floating pill holds the actions** — at the bottom, centred, under the thumb —, the
396
- same on a record, a list and a settings form. It turns into «N cambios · Descartar ·
397
- Guardar» while there are changes, and into what is done to the chosen rows while some are
398
- chosen. Never two pills at once.
399
- - **Pills are the shape of the identity**: the actions' pill, the pager (a translucent primary
400
- pill), the state as a pill of pills (`StatusBar look="segmented"`), the counters as links
401
- with their count in a pill.
402
- - **Colour means something**: the gold is the one action that moves the record forward; the
388
+ **Modern is Sincpro's own style, and where the system is going.** It is not a trial: it is how
389
+ new screens are drawn, and it keeps being iterated — small things that help, one round at a
390
+ time. `traditional` stays, for good — same API, same data —: it is how business software is
391
+ done (Odoo's way), and the applications already drawn in it keep it. The API both styles read
392
+ (settled in #68): `ViewStyleProvider` / `Record look`; `Record.Dock` (`rail` | `bottom`);
393
+ `List.Dock` (`placement`, `selectionPlacement`, the pill named by the list); `List openTargets`
394
+
395
+ - `onOpenIn`; `DataColumn.yesNo`; `Pagination look` / `Pager look`; `StatusBar look`. What the
396
+ direction is:
397
+
398
+ * **The page breathes on the ground.** No white band on top of the paper: the trail IS the
399
+ page's heading (`Breadcrumb size="lg"`), and a step down, what the record has (the
400
+ counters, boxes) and where it is at (the state).
401
+ * **One floating pill holds the actions** — at the bottom of the screen, centred, under the
402
+ thumb —: a record's, a settings form's, and a list's, named by the list it acts on
403
+ («Pedidos │ Importar · Nueva cotización») so one action is never a lone button. It turns into
404
+ «N cambios · Descartar · Guardar» while there are changes, and into what is done to the chosen
405
+ rows while some are chosen. One per screen: a collection's chosen rows take the record's
406
+ place.
407
+ * **Pills are the shape of the identity**: the actions' pill, the pager (a translucent primary
408
+ pill), the state as a pill of pills (`StatusBar look="segmented"`), the row's ways in.
409
+ * **Colour means something**: the gold is the one action that moves the record forward; the
403
410
  translucent primary, where you are; red, what undoes.
404
- - **The keyboard reaches everything**: every action can carry its shortcut, drawn for the
411
+ * **The keyboard reaches everything**: every action can carry its shortcut, drawn for the
405
412
  person's keyboard (see below).
406
- - **A number reads the same everywhere**: its column's decimals and format in the cells, the
413
+ * **A number reads the same everywhere**: its column's decimals and format in the cells, the
407
414
  groups, the footer and the report.
408
415
 
409
416
  Already in the direction: dense records in sections with an index (`FormStyleProvider
@@ -424,10 +431,11 @@ data — and the application's style decides how they are drawn, the way it choo
424
431
  actions as the bar's buttons (the primary first and gold, «⋯» with the rest), in a record
425
432
  and in a list alike.
426
433
  - **modern**: the trail is the page's heading with the pager as a translucent primary pill on
427
- its line (`Pager look="pill"`); a step down, the counters as links (`SmartButton
428
- look="link"`) and the state; the band is the ground; and the actions float in ONE pill at
429
- the bottom, centred — a record's, and a list's. `placement="top"` rests a record's pill in
430
- the rail and floats it at the top on scroll.
434
+ its line (`Pager look="pill"`); a step down, the counters (boxes) and the state; the band is
435
+ the ground; and the actions float in ONE pill at the bottom of the screen, centred — a
436
+ record's, and a list's named by the list (`List.Dock placement="bar"` keeps a list's in its
437
+ header). Two things were tried and dropped: a pill resting in the rail and floating at the
438
+ TOP, and the counters as links.
431
439
 
432
440
  **The state.** `StatusBar look`: `track` (Odoo's — the traditional style's), `segmented` (a
433
441
  pill of pills, the actions' shape — the modern style's), `steps`, `progress` and `pill` (one chip that unfolds the stages). Each
@@ -118,7 +118,8 @@ export type BoardStatProps = {
118
118
  change?: MetricProps["change"];
119
119
  /** The last periods, oldest first: drawn as a sparkline beside the figure. */
120
120
  trend?: readonly (number | null)[];
121
- /** The ONE figure the board leads with: the hero step (≥ 48 px). At most one per board. */
121
+ /** The ONE figure the board leads with: the hero step (≥ 48 px) in a tile that holds it
122
+ * (≥ 20 rem), the figure step in a narrower one. At most one per board. */
122
123
  hero?: boolean;
123
124
  /**
124
125
  * The STATE of the reading, never decoration: a share of clean mail under its floor is
@@ -89,7 +89,23 @@ export function BoardStat({ label, value, icon, hint, detail, change, trend, her
89
89
  ? value.toLocaleString(copy.locale)
90
90
  : value;
91
91
  const shade = tone === undefined ? "" : TONE[tone].tile;
92
- return (_jsxs("section", { "aria-label": label, ...(loading ? { "aria-busy": true } : {}), "data-ui": "board.stat", ...(tone === undefined ? {} : { "data-tone": tone }), className: `flex min-w-0 flex-col gap-3 p-5 ${TILE} ${shade} ${span === 2 ? "@xl:col-span-2" : ""}`, children: [_jsx(TileHeading, { title: label, icon: icon, hint: hint, tone: tone, size: "label" }), state.status === "failed" ? (_jsx(Failure, { heading: fillCopy(copy.board.tileFailed, { title: label }), state: state })) : (_jsxs("div", { className: "flex min-w-0 items-end justify-between gap-4", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [loading ? (_jsx("span", { "aria-hidden": true, className: `inline-block w-24 animate-reveal-late rounded-control bg-ink/8 ${hero ? "h-(--text-hero)" : "h-(--text-figure)"}` })) : (_jsx("span", { "data-ui": "board.stat.value", className: `min-w-0 truncate font-semibold text-ink ${hero ? "text-hero" : "text-figure"} ${missing ? "text-muted" : ""}`, children: figure })), loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null, loading || (detail === undefined && change === undefined) ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5", children: [change === undefined ? null : (_jsx(MetricChange, { change: change, format: percent.format })), detail === undefined ? null : (_jsx("span", { className: "min-w-0 truncate text-micro text-muted", children: detail }))] }))] }), loading || trend === undefined ? null : (_jsx("div", { className: "w-2/5 max-w-40 shrink-0 pb-1", children: _jsx(Sparkline, { values: trend, label: label }) }))] }))] }));
92
+ return (_jsxs("section", { "aria-label": label, ...(loading ? { "aria-busy": true } : {}), "data-ui": "board.stat", ...(tone === undefined ? {} : { "data-tone": tone }),
93
+ /* Its own container: the lead figure's step is the tile's width, not the window's. */
94
+ className: `@container flex min-w-0 flex-col gap-3 p-5 ${TILE} ${shade} ${span === 2 ? "@xl:col-span-2" : ""}`, children: [_jsx(TileHeading, { title: label, icon: icon, hint: hint, tone: tone, size: "label" }), state.status === "failed" ? (_jsx(Failure, { heading: fillCopy(copy.board.tileFailed, { title: label }), state: state })) : (
95
+ /* The figure first: when it and its trend do not fit side by side the trend goes under
96
+ it (wraps), and the lead figure (`hero`) takes its big step only in a tile that holds
97
+ it (≥ 20 rem) — the number the tile exists for is never the part that is cut. Only a
98
+ figure wider than its tile alone truncates. */
99
+ _jsxs("div", { className: "flex min-w-0 flex-wrap items-end justify-between gap-x-4 gap-y-2", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [loading ? (_jsx("span", { "aria-hidden": true, className: `inline-block w-24 animate-reveal-late rounded-control bg-ink/8 ${hero ? "h-(--text-figure) @xs:h-(--text-hero)" : "h-(--text-figure)"}` })) : (_jsx("span", { "data-ui": "board.stat.value",
100
+ /* Sized to fit its tile (`figure-fit`): a long figure steps down instead of
101
+ being cut. The title step is the floor — past it, «…» and the whole figure
102
+ in the title, the last resort for a tile narrower than any number. */
103
+ title: typeof figure === "string" ? figure : undefined, style: {
104
+ ...(typeof figure === "string"
105
+ ? { "--figure-length": figure.length }
106
+ : {}),
107
+ ...(hero ? { "--figure-step": "var(--text-hero)" } : {}),
108
+ }, className: `figure-fit min-w-0 truncate font-semibold text-ink ${missing ? "text-muted" : ""}`, children: figure })), loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null, loading || (detail === undefined && change === undefined) ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5", children: [change === undefined ? null : (_jsx(MetricChange, { change: change, format: percent.format })), detail === undefined ? null : (_jsx("span", { className: "min-w-0 truncate text-micro text-muted", children: detail }))] }))] }), loading || trend === undefined ? null : (_jsx("div", { className: "w-2/5 max-w-40 shrink-0 pb-1", children: _jsx(Sparkline, { values: trend, label: label }) }))] }))] }));
93
109
  }
94
110
  /**
95
111
  * The row of a board's stat tiles: as wide as the grid under it, every tile the same width —
@@ -1,4 +1,5 @@
1
1
  import type { Surface } from "../../foundations/types.js";
2
+ import type { ViewStyle } from "../../foundations/viewStyle.js";
2
3
  import type { ReactNode } from "react";
3
4
  /** THE BAR — two rows, two questions.
4
5
  *
@@ -34,6 +35,26 @@ import type { ReactNode } from "react";
34
35
  * The actions on the left do NOT go away: «Nuevo» stays available with three
35
36
  * rows selected, because selecting is not entering a mode.
36
37
  *
38
+ * ── The modern style: the trail is the heading ──────────────────────
39
+ *
40
+ * ┌──────────────────────────────────────────────────────────────────┐
41
+ * │ Ventas › Andina › Pedidos ( 1–12 / 12 ‹ › ) │
42
+ * │ what it is made of 🔍 search… [sort][cols] [▤▦] │
43
+ * └──────────────────────────────────────────────────────────────────┘
44
+ * ( Pedidos │ Importar · Exportar ▾ · + Nueva cotización ) ← floats
45
+ *
46
+ * As a record in the modern style, WHERE I AM is the page's heading: the trail at the
47
+ * title's size (`Breadcrumb size="lg"`), its last crumb the list's name — so the title is
48
+ * not said twice —, and the page range at the other end, as the record's pager pill. Its
49
+ * counters are not here: beside the trail they read as more crumbs; the list draws them as
50
+ * mini stats under the bar (`List.Metrics`). The second row is how I look at the set: what
51
+ * it is made of (the description), the search centred, sort, columns and the faces. The
52
+ * list's actions float at the bottom of the screen in a pill named by the list
53
+ * (`List.Dock`), which turns into what is done to the chosen rows while some are chosen;
54
+ * given `placement="bar"`, or drawn by hand, they take the start of the second row and the
55
+ * description goes on demand (`Hint`) beside the heading. Without crumbs the title is the
56
+ * heading. Compact keeps the one bar below.
57
+ *
37
58
  * ── Inside a record it is ONE line (`inline`) ────────────────────────
38
59
  *
39
60
  * ┌───────────────────────────────────────────────────────────────┐
@@ -65,7 +86,10 @@ import type { ReactNode } from "react";
65
86
  * The count is a live region: typing in the search changes it, and somebody
66
87
  * who cannot see the rows thin out hears how many are left. With
67
88
  * `pagination` the page range replaces it — it already says how many. */
68
- export declare function ListingBar({ actions, title, description, counters, selection, search, pagination, views, crumbs, surface, inline, count, }: {
89
+ export declare function ListingBar({ actions, title, description, counters, selection, search, pagination, views, crumbs, surface, inline, count, look, }: {
90
+ /** How the bar is drawn: `modern` makes the trail the heading and puts the search on the
91
+ * row of the controls (see the header). The list passes its view style. */
92
+ look?: ViewStyle;
69
93
  /** What starts something new. It stays visible even when there is a selection. */
70
94
  actions?: ReactNode;
71
95
  title?: string;
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
4
  import { byDensity, useDensity } from "../../foundations/density.js";
5
5
  import { SurfaceProvider, useSurface } from "../../foundations/surface.js";
6
6
  import { Line } from "../../primitives/block/Line.js";
7
+ import { Hint } from "../../primitives/hint/Hint.js";
7
8
  import { X } from "lucide-react";
8
9
  /** THE BAR — two rows, two questions.
9
10
  *
@@ -39,6 +40,26 @@ import { X } from "lucide-react";
39
40
  * The actions on the left do NOT go away: «Nuevo» stays available with three
40
41
  * rows selected, because selecting is not entering a mode.
41
42
  *
43
+ * ── The modern style: the trail is the heading ──────────────────────
44
+ *
45
+ * ┌──────────────────────────────────────────────────────────────────┐
46
+ * │ Ventas › Andina › Pedidos ( 1–12 / 12 ‹ › ) │
47
+ * │ what it is made of 🔍 search… [sort][cols] [▤▦] │
48
+ * └──────────────────────────────────────────────────────────────────┘
49
+ * ( Pedidos │ Importar · Exportar ▾ · + Nueva cotización ) ← floats
50
+ *
51
+ * As a record in the modern style, WHERE I AM is the page's heading: the trail at the
52
+ * title's size (`Breadcrumb size="lg"`), its last crumb the list's name — so the title is
53
+ * not said twice —, and the page range at the other end, as the record's pager pill. Its
54
+ * counters are not here: beside the trail they read as more crumbs; the list draws them as
55
+ * mini stats under the bar (`List.Metrics`). The second row is how I look at the set: what
56
+ * it is made of (the description), the search centred, sort, columns and the faces. The
57
+ * list's actions float at the bottom of the screen in a pill named by the list
58
+ * (`List.Dock`), which turns into what is done to the chosen rows while some are chosen;
59
+ * given `placement="bar"`, or drawn by hand, they take the start of the second row and the
60
+ * description goes on demand (`Hint`) beside the heading. Without crumbs the title is the
61
+ * heading. Compact keeps the one bar below.
62
+ *
42
63
  * ── Inside a record it is ONE line (`inline`) ────────────────────────
43
64
  *
44
65
  * ┌───────────────────────────────────────────────────────────────┐
@@ -70,7 +91,7 @@ import { X } from "lucide-react";
70
91
  * The count is a live region: typing in the search changes it, and somebody
71
92
  * who cannot see the rows thin out hears how many are left. With
72
93
  * `pagination` the page range replaces it — it already says how many. */
73
- export function ListingBar({ actions, title, description, counters, selection, search, pagination, views, crumbs, surface, inline = false, count, }) {
94
+ export function ListingBar({ actions, title, description, counters, selection, search, pagination, views, crumbs, surface, inline = false, count, look = "traditional", }) {
74
95
  const selecting = selection !== undefined && selection.count > 0;
75
96
  const d = useDensity();
76
97
  const copy = useUiCopy();
@@ -116,22 +137,30 @@ export function ListingBar({ actions, title, description, counters, selection, s
116
137
  just outside this box: pressing the funnel opened a panel nobody
117
138
  saw. `clip` is the only value that leaves the other axis `visible`. */
118
139
  center: center === null ? null : (_jsx("div", { className: "flex w-full min-w-0 items-center overflow-x-clip overflow-y-visible", children: center })), end: pagination }));
140
+ /* The list's name. No `truncate`: it may wrap onto two lines — a list that cannot be
141
+ named in full is indistinguishable from the one next to it. `title` and semibold: it is
142
+ the entry point of the screen; at `lead` it was smaller than the metrics under it, so the
143
+ largest thing on a list page was a number (measured 1.46:1 over the body, below the ~1.5
144
+ an eye needs to find where to start). */
145
+ const heading = title === undefined ? null : (_jsx("h2", { className: `text-title leading-tight font-semibold ${isChrome ? "text-chrome-ink" : "text-ink"}`, children: title }));
146
+ /* What the list is made of: its counters and its sentence. Under the title in the
147
+ traditional bar; at the start of the controls' row in the modern one. */
148
+ const about = description === undefined && counters === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-0.5", children: [counters?.map((c) => (_jsxs("span", { className: "flex items-baseline gap-1", children: [_jsx("span", { className: `text-meta font-medium tabular-nums ${isChrome ? "text-chrome-ink" : "text-ink"}`, children: typeof c.value === "number" ? c.value.toLocaleString(copy.locale) : c.value }), _jsx("span", { className: `text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: c.label })] }, c.label))), description === undefined ? null : (_jsx("span", { className: `min-w-0 text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: description }))] }));
119
149
  const bottomRow = actions === undefined && !withIdentity && views === undefined ? null : (
120
150
  /* On a narrow list (a phone, a drawer) the name and its counters take the whole first
121
151
  line and the action and the controls go below: squeezed between them, the
122
152
  description wrapped one word per line. */
123
- _jsxs("div", { className: `flex min-w-0 flex-wrap items-center gap-y-2 ${byDensity(d, "gap-x-4", "gap-x-2")}`, children: [actions === undefined ? null : (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: actions })), !withIdentity ? null : (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col @max-2xl:order-first @max-2xl:basis-full", children: [title === undefined ? null : (
124
- /* No `truncate`: the title may wrap onto two lines. A list that
125
- cannot be named in full is indistinguishable from the one next
126
- to it. */
127
- /* `title` and semibold: the name of the list is the entry point of the
128
- screen. At `lead` it was smaller than the metrics under it, so the
129
- largest thing on a list page was a number (measured: 1.46:1 over the
130
- body, below the ~1.5 an eye needs to find where to start). */
131
- _jsx("h2", { className: `text-title leading-tight font-semibold ${isChrome ? "text-chrome-ink" : "text-ink"}`, children: title })), description === undefined && counters === undefined ? null : (_jsxs("div", { className: "mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-0.5", children: [counters?.map((c) => (_jsxs("span", { className: "flex items-baseline gap-1", children: [_jsx("span", { className: `text-meta font-medium tabular-nums ${isChrome ? "text-chrome-ink" : "text-ink"}`, children: typeof c.value === "number"
132
- ? c.value.toLocaleString(copy.locale)
133
- : c.value }), _jsx("span", { className: `text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: c.label })] }, c.label))), description === undefined ? null : (_jsx("span", { className: `min-w-0 text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: description }))] }))] })), views === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: views }))] }));
134
- const bar = (_jsxs("div", { className: `flex min-w-0 flex-col ${byDensity(d, "gap-2", "gap-1.5")}`, children: [!isChrome && bottomRow !== null ? (_jsx("div", { className: "border-b border-line pb-2", children: topRow })) : (topRow), bottomRow] }));
153
+ _jsxs("div", { className: `flex min-w-0 flex-wrap items-center gap-y-2 ${byDensity(d, "gap-x-4", "gap-x-2")}`, children: [actions === undefined ? null : (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: actions })), !withIdentity ? null : (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col @max-2xl:order-first @max-2xl:basis-full", children: [heading, about === null ? null : _jsx("div", { className: "mt-0.5", children: about })] })), views === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: views }))] }));
154
+ /* THE MODERN BAR — see «The modern style» above. Only with room for an identity:
155
+ compact (a drawer, a phone) keeps the one bar. */
156
+ const modern = look === "modern" && withIdentity;
157
+ const modernBar = !modern ? null : (_jsxs("div", { className: `flex min-w-0 flex-col ${byDensity(d, "gap-2", "gap-1.5")}`, children: [_jsx(Line, { start: _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [crumbs === undefined ? (heading) : (_jsxs(_Fragment, { children: [title === undefined ? null : _jsx("h2", { className: "sr-only", children: title }), crumbs] })), description === undefined || actions === undefined ? null : (_jsx(Hint, { children: description }))] }), end: pagination }), _jsx(Line, { asks: "var(--container-crumb)", centerAsks: center === null ? "auto" : "var(--container-search)", gap: byDensity(d, "gap-x-4 gap-y-2", "gap-x-2 gap-y-1.5"), start: actions !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: actions })) : description === undefined ? null : (
158
+ /* What the list is made of, beside the search — the side the actions leave when
159
+ they float. Not the title: the trail's last crumb already says it. */
160
+ _jsx("p", { className: `line-clamp-2 min-w-0 text-micro ${isChrome ? "text-chrome-muted" : "text-muted"}`, children: description })), center: center === null ? null : (
161
+ /* `overflow-x-clip`: the same reason as the traditional top row's. */
162
+ _jsx("div", { className: "flex w-full min-w-0 items-center overflow-x-clip overflow-y-visible", children: center })), end: views === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: views })) })] }));
163
+ const bar = modernBar ?? (_jsxs("div", { className: `flex min-w-0 flex-col ${byDensity(d, "gap-2", "gap-1.5")}`, children: [!isChrome && bottomRow !== null ? (_jsx("div", { className: "border-b border-line pb-2", children: topRow })) : (topRow), bottomRow] }));
135
164
  /* On the canvas the bar is a light control band: white, a hairline below, the same
136
165
  padding as the dark one — a list inside an application whose bar is already dark keeps
137
166
  ONE dark band per screen. Without its own band the bar sat flush on the page and its
@@ -22,7 +22,7 @@ import type { Surface } from "../../foundations/types.js";
22
22
  * once. In a tool where somebody compares a hundred and eighty invoices,
23
23
  * leaving it fixed at 25 forces paginating over something that is not a
24
24
  * product decision. */
25
- export declare function Pagination({ from, to, total, pageSize, pageSizes, onPageSizeChange, onPrev, onNext, surface, }: {
25
+ export declare function Pagination({ from, to, total, pageSize, pageSizes, onPageSizeChange, onPrev, onNext, surface, look: ownLook, }: {
26
26
  from: number;
27
27
  to: number;
28
28
  total: number;
@@ -33,4 +33,7 @@ export declare function Pagination({ from, to, total, pageSize, pageSizes, onPag
33
33
  onNext?: () => void;
34
34
  /** By default it inherits it from the surface that wraps it. */
35
35
  surface?: Surface;
36
+ /** `plain`: quiet, the range and two arrows. `pill`: the position stands out — the record's
37
+ * pager's translucent primary pill. Absent, the view style's: `modern` → `pill`. */
38
+ look?: "plain" | "pill";
36
39
  }): import("react").JSX.Element;
@@ -4,6 +4,7 @@ import { PAGE_SIZES } from "./pages.js";
4
4
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
5
5
  import { byDensity, useDensity } from "../../foundations/density.js";
6
6
  import { bySurface, useSurface } from "../../foundations/surface.js";
7
+ import { useViewStyle } from "../../foundations/viewStyle.js";
7
8
  import { ChevronLeft, ChevronRight } from "lucide-react";
8
9
  import { useId, useState } from "react";
9
10
  /* ---------------------------------------------------------------- *
@@ -32,16 +33,26 @@ import { useId, useState } from "react";
32
33
  * once. In a tool where somebody compares a hundred and eighty invoices,
33
34
  * leaving it fixed at 25 forces paginating over something that is not a
34
35
  * product decision. */
35
- export function Pagination({ from, to, total, pageSize, pageSizes = PAGE_SIZES, onPageSizeChange, onPrev, onNext, surface, }) {
36
+ export function Pagination({ from, to, total, pageSize, pageSizes = PAGE_SIZES, onPageSizeChange, onPrev, onNext, surface, look: ownLook, }) {
36
37
  const d = useDensity();
37
38
  const copy = useUiCopy();
38
39
  const activeSurface = useSurface(surface);
39
40
  const [editing, setEditing] = useState(false);
40
41
  const [draft, setDraft] = useState("");
41
42
  const listId = useId();
42
- const faint = bySurface(activeSurface, "text-muted", "text-chrome-muted");
43
- const strong = bySurface(activeSurface, "text-ink", "text-chrome-ink");
44
- const arrow = `inline-flex size-(--size-control-sm) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) disabled:opacity-30 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${bySurface(activeSurface, "text-muted not-disabled:hover:bg-ink/6 not-disabled:hover:text-ink", "text-chrome-muted not-disabled:hover:bg-chrome-ink/12 not-disabled:hover:text-chrome-ink")}`;
43
+ /* The modern style's position is the record's pager's: one translucent primary pill, so a
44
+ list and a record say «where I am in the set» the same way. */
45
+ const style = useViewStyle();
46
+ const pill = (ownLook ?? (style === "modern" ? "pill" : "plain")) === "pill";
47
+ const faint = pill
48
+ ? bySurface(activeSurface, "text-primary", "text-chrome-link")
49
+ : bySurface(activeSurface, "text-muted", "text-chrome-muted");
50
+ const strong = pill
51
+ ? bySurface(activeSurface, "text-primary", "text-chrome-link")
52
+ : bySurface(activeSurface, "text-ink", "text-chrome-ink");
53
+ const arrow = `inline-flex size-(--size-control-sm) items-center justify-center rounded-pill transition-colors duration-(--duration-instant) disabled:opacity-30 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary ${pill
54
+ ? bySurface(activeSurface, "text-primary not-disabled:hover:bg-primary/15", "text-chrome-link not-disabled:hover:bg-chrome-link/20")
55
+ : bySurface(activeSurface, "text-muted not-disabled:hover:bg-ink/6 not-disabled:hover:text-ink", "text-chrome-muted not-disabled:hover:bg-chrome-ink/12 not-disabled:hover:text-chrome-ink")}`;
45
56
  const canEdit = pageSize !== undefined && onPageSizeChange !== undefined && d === "comfortable";
46
57
  const sizes = pageSize !== undefined && !pageSizes.includes(pageSize)
47
58
  ? [...pageSizes, pageSize]
@@ -55,14 +66,16 @@ export function Pagination({ from, to, total, pageSize, pageSizes = PAGE_SIZES,
55
66
  onPageSizeChange?.(Math.floor(next));
56
67
  setEditing(false);
57
68
  }
58
- return (_jsxs("div", { className: `flex shrink-0 items-center ${byDensity(d, "gap-1", "gap-0.5")}`, children: [editing && canEdit ? (_jsxs(_Fragment, { children: [_jsx("input", { autoFocus: true, type: "number", min: 1, step: 1, list: listId, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: () => commitSize(draft), onKeyDown: (e) => {
69
+ return (_jsxs("div", { "data-ui": "pagination", "data-look": pill ? "pill" : "plain", className: `flex shrink-0 items-center ${byDensity(d, "gap-1", "gap-0.5")} ${pill
70
+ ? `rounded-pill border p-0.5 pl-2.5 ${bySurface(activeSurface, "border-primary/20 bg-primary/8", "border-chrome-link/30 bg-chrome-link/12")}`
71
+ : ""}`, children: [editing && canEdit ? (_jsxs(_Fragment, { children: [_jsx("input", { autoFocus: true, type: "number", min: 1, step: 1, list: listId, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: () => commitSize(draft), onKeyDown: (e) => {
59
72
  if (e.key === "Enter") {
60
73
  e.preventDefault();
61
74
  commitSize(draft);
62
75
  }
63
76
  if (e.key === "Escape")
64
77
  setEditing(false);
65
- }, "aria-label": copy.pager.size, className: `h-(--size-control-sm) w-24 rounded-control border px-1.5 text-micro tabular-nums focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary ${bySurface(activeSurface, "border-line-strong bg-surface text-ink", "border-chrome-ink/45 bg-chrome-ink/8 text-chrome-ink")}` }), _jsx("datalist", { id: listId, children: sizes.map((n) => (_jsx("option", { value: n }, n))) })] })) : (_jsxs("span", { className: `text-micro tabular-nums whitespace-nowrap ${faint}`, children: [canEdit ? (_jsxs("button", { type: "button", onClick: () => {
78
+ }, "aria-label": copy.pager.size, className: `h-(--size-control-sm) w-24 rounded-control border px-1.5 text-micro tabular-nums focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary ${bySurface(activeSurface, "border-line-strong bg-surface text-ink", "border-chrome-ink/45 bg-chrome-ink/8 text-chrome-ink")}` }), _jsx("datalist", { id: listId, children: sizes.map((n) => (_jsx("option", { value: n }, n))) })] })) : (_jsxs("span", { className: `tabular-nums whitespace-nowrap ${pill ? "text-meta font-semibold" : "text-micro"} ${faint}`, children: [canEdit ? (_jsxs("button", { type: "button", onClick: () => {
66
79
  setDraft(String(pageSize));
67
80
  setEditing(true);
68
81
  }, title: fillCopy(copy.pager.sizeHint, { size: pageSize ?? 0 }), className: `rounded-control underline decoration-dotted underline-offset-4 transition-colors duration-(--duration-instant) ${strong} ${bySurface(activeSurface, "decoration-line-strong hover:decoration-primary", "decoration-chrome-ink/40 hover:decoration-chrome-link")} focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary`, children: [from.toLocaleString(copy.locale), "\u2013", to.toLocaleString(copy.locale)] })) : (_jsxs("span", { className: strong, children: [from.toLocaleString(copy.locale), "\u2013", to.toLocaleString(copy.locale)] })), _jsx("span", { className: "mx-1", children: "/" }), total.toLocaleString(copy.locale)] })), _jsxs("span", { className: "flex items-center", children: [_jsx("button", { type: "button", onClick: onPrev, disabled: from <= 1, "aria-label": copy.pager.prev, title: copy.pager.prev, className: arrow, children: _jsx(ChevronLeft, { className: "size-(--size-icon-md)", strokeWidth: 2 }) }), _jsx("button", { type: "button", onClick: onNext, disabled: to >= total, "aria-label": copy.pager.next, title: copy.pager.next, className: arrow, children: _jsx(ChevronRight, { className: "size-(--size-icon-md)", strokeWidth: 2 }) })] })] }));
@@ -5,7 +5,7 @@ import { emailHref, telHref, urlHref, urlLabel, } from "../../primitives/field/c
5
5
  import { formatDuration } from "../../primitives/field/duration.js";
6
6
  import { DateValue } from "../../primitives/value/DateValue.js";
7
7
  import { Numeric } from "../../primitives/value/Value.js";
8
- import { Check } from "lucide-react";
8
+ import { YesNo } from "../../primitives/value/YesNo.js";
9
9
  const LINK = "block truncate rounded-mark text-primary underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary";
10
10
  function Plain({ text }) {
11
11
  return (_jsx("span", { className: "block truncate text-muted", title: text, children: text }));
@@ -19,14 +19,6 @@ function Link({ text, href, label, external = false, }) {
19
19
  /* The row opens its record on a click; writing to its email must not ALSO open it. */
20
20
  onClick: (event) => event.stopPropagation(), ...(external ? { target: "_blank", rel: "noopener noreferrer" } : {}), children: [label ?? text, external ? _jsxs("span", { className: "sr-only", children: [" (", copy.field.newTab, ")"] }) : null] }));
21
21
  }
22
- /** A yes/no in words: a check alone is not read by everyone the same way, and «no» needs
23
- * no icon — an empty mark next to every false row would only add noise to the column. */
24
- function YesNo({ value }) {
25
- const copy = useUiCopy();
26
- if (!value)
27
- return _jsx("span", { className: "text-muted", children: copy.table.no });
28
- return (_jsxs("span", { className: "inline-flex items-center gap-1 text-ink", children: [_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm) text-good", strokeWidth: 2.5 }), copy.table.yes] }));
29
- }
30
22
  /** One cell of a model column. `value` is what `readModelValue` read — never `null` here. */
31
23
  export function ModelCell({ kind, value, }) {
32
24
  const text = String(value);
@@ -1,9 +1,10 @@
1
1
  import { type DirtyState } from "./DirtyActions.js";
2
2
  import { type DockAction } from "./dock.js";
3
- import type { ReactNode } from "react";
4
- /** Where the dock floats. `top` and `bottom` stick to that edge of what scrolls; `inline`
5
- * draws only the pill — its host places it (`Record.Dock` does). */
6
- export type DockPlacement = "top" | "bottom" | "inline";
3
+ import { type ReactNode, type Ref } from "react";
4
+ /** Where the dock goes. `bottom` floats it, stuck to the bottom of what scrolls; `inline` draws
5
+ * only the pill — its host places it (`Record.Dock` does). A pill resting in the rail and
6
+ * floating at the TOP on scroll was tried and dropped: the actions float at the bottom. */
7
+ export type DockPlacement = "bottom" | "inline";
7
8
  /** The pill's band: the dark one (the settings bar's), a light card — or `bare`: no pill at
8
9
  * all, the actions as the rail's buttons (the record's `traditional` style draws them so). */
9
10
  export type DockLook = "chrome" | "canvas" | "bare";
@@ -25,12 +26,33 @@ export interface ActionDockProps {
25
26
  * on the pill's band: write it with `useSurface()` colours. */
26
27
  lead?: ReactNode;
27
28
  }
28
- /** Where a record's actions go: as the rail's buttons, or floating — resting in the rail and
29
- * detaching on scroll (`top`), or at the bottom of the screen (`bottom`). Absent, the record's
30
- * style decides: `traditional` → `rail`, `modern` → `bottom`. */
31
- export type RecordDockPlacement = "rail" | "top" | "bottom";
29
+ /** Where a record's actions go: as the rail's buttons, or floating at the bottom of the screen.
30
+ * Absent, the record's style decides: `traditional` → `rail`, `modern` → `bottom`. */
31
+ export type RecordDockPlacement = "rail" | "bottom";
32
32
  /** What `Record.Dock` takes: the dock's, with the record's placements. */
33
33
  export type RecordDockProps = Omit<ActionDockProps, "dirty" | "saved" | "placement"> & {
34
34
  placement?: RecordDockPlacement;
35
35
  };
36
36
  export declare function ActionDock({ actions, visible, dirty, saved, placement, align, look, label, lead, }: ActionDockProps): import("react").JSX.Element;
37
+ /**
38
+ * The band a floating pill sits in. Sticky to the edge of what scrolls, as the settings bar: no
39
+ * padding to keep in sync with its height, and at the end of the page it settles in its place in
40
+ * the flow. Only the pill takes the pointer — the band around it lets the page be pressed through.
41
+ * The dock draws its own; the record's place (`DockHost`) draws an empty one for a pill to come.
42
+ */
43
+ export declare function DockBand({ align, ref, children, }: {
44
+ align?: "center" | "end";
45
+ ref?: Ref<HTMLDivElement>;
46
+ children?: ReactNode;
47
+ }): import("react").JSX.Element;
48
+ export type DockHost = {
49
+ /** The band the taking pill is drawn into; `null` until the record has drawn it. */
50
+ target: HTMLElement | null;
51
+ /** The record is saying Save / Discard: its place is not given away. */
52
+ dirty: boolean;
53
+ /** Takes the place; the returned function gives it back. */
54
+ take: () => () => void;
55
+ };
56
+ export declare const DockHostContext: import("react").Context<DockHost | null>;
57
+ /** The floating place of the record this is inside, if it has one. */
58
+ export declare function useDockHost(): DockHost | null;
@@ -5,11 +5,11 @@ import { dockOption, dockPlan, dockShortcuts, moreGroups, } from "./dock.js";
5
5
  import { useUiCopy } from "../../foundations/copy.js";
6
6
  import { keysLabel } from "../../foundations/keys.js";
7
7
  import { useKeyboardPlatform, useKeysHint, useShortcuts, } from "../../foundations/shortcut.js";
8
- import { stickyTop } from "../../foundations/sticky.js";
9
8
  import { SurfaceProvider, useSurface } from "../../foundations/surface.js";
10
9
  import { Button } from "../../primitives/button/Button.js";
11
10
  import { Menu } from "../../primitives/menu/Menu.js";
12
11
  import { MoreHorizontal } from "lucide-react";
12
+ import { createContext, use } from "react";
13
13
  const PILL = { "--ui-button-radius": "var(--radius-pill)" };
14
14
  /** One action as a button, its shortcut in its title and in `aria-keyshortcuts`. */
15
15
  function DockButton({ action, role, size, surface, }) {
@@ -44,15 +44,26 @@ function Pill({ actions, visible, dirty, saved, look, label, lead, }) {
44
44
  ? "border border-chrome-edge bg-chrome"
45
45
  : "border border-line bg-surface"}`, children: dirty !== undefined ? (_jsx(DirtyActions, { ...dirty, floating: true })) : (_jsxs(_Fragment, { children: [lead, plan.shown.map((action) => action.items === undefined ? (_jsx(DockButton, { action: action, role: "ghost", surface: look }, action.id)) : (_jsx(Menu, { role: "ghost", surface: look, label: action.label, ...(action.icon === undefined ? {} : { icon: action.icon }), groups: [{ options: action.items.map((one) => dockOption(one, label_)) }] }, action.id))), more.length === 0 ? null : (_jsx(Menu, { label: copy.dock.more, icon: MoreHorizontal, iconOnly: true, chevron: false, variant: "text", surface: look, align: "end", groups: more })), plan.primary === undefined ? null : (_jsx(DockButton, { action: plan.primary, role: "primary", surface: look })), _jsx(SavedMark, { saved: saved === true })] })) }) }));
46
46
  }
47
- export function ActionDock({ actions, visible = 2, dirty, saved, placement = "top", align = "center", look = "chrome", label, lead, }) {
47
+ export function ActionDock({ actions, visible = 2, dirty, saved, placement = "bottom", align = "center", look = "chrome", label, lead, }) {
48
48
  /* The combinations run while the dock is on screen; while there are changes Save answers
49
49
  Mod+S itself. */
50
50
  useShortcuts(dockShortcuts(actions, dirty !== undefined));
51
51
  const pill = look === "bare" ? (_jsx(Bare, { actions: actions, visible: visible, ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }) })) : (_jsx(Pill, { actions: actions, visible: visible, look: look, ...(lead === undefined ? {} : { lead }), ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }) }));
52
52
  if (placement === "inline")
53
53
  return pill;
54
- /* Sticky to the edge of what scrolls, as the settings bar: no padding to keep in sync with
55
- its height, and at the end of the page it settles in its place in the flow. Only the pill
56
- takes the pointer — the band around it lets the page be pressed through. */
57
- return (_jsx("div", { "data-ui": "dock", "data-placement": placement, ...(placement === "top" ? { style: stickyTop } : {}), className: `pointer-events-none sticky z-20 flex px-3 ${placement === "top" ? "py-2" : "bottom-0 mt-auto pt-3 safe-bottom"} ${align === "end" ? "justify-end" : "justify-center"}`, children: pill }));
54
+ return _jsx(DockBand, { align: align, children: pill });
55
+ }
56
+ /**
57
+ * The band a floating pill sits in. Sticky to the edge of what scrolls, as the settings bar: no
58
+ * padding to keep in sync with its height, and at the end of the page it settles in its place in
59
+ * the flow. Only the pill takes the pointer — the band around it lets the page be pressed through.
60
+ * The dock draws its own; the record's place (`DockHost`) draws an empty one for a pill to come.
61
+ */
62
+ export function DockBand({ align = "center", ref, children, }) {
63
+ return (_jsx("div", { ref: ref, "data-ui": "dock", "data-placement": "bottom", className: `pointer-events-none sticky bottom-0 z-20 mt-auto flex px-3 pt-3 safe-bottom ${align === "end" ? "justify-end" : "justify-center"}`, children: children }));
64
+ }
65
+ export const DockHostContext = createContext(null);
66
+ /** The floating place of the record this is inside, if it has one. */
67
+ export function useDockHost() {
68
+ return use(DockHostContext);
58
69
  }