@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
@@ -1,17 +1,16 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { ActionDock, } from "./ActionDock.js";
3
+ import { ActionDock, DockBand, DockHostContext, } from "./ActionDock.js";
4
4
  import { Breadcrumb } from "./Breadcrumb.js";
5
5
  import { DirtyActions, DirtyBar, SavedMark, useJustSaved, } from "./DirtyActions.js";
6
6
  import { isPrimary, ThumbBar, thumbPlan } from "./ThumbBar.js";
7
7
  import { byDensity, useDensity } from "../../foundations/density.js";
8
8
  import { useFormStyle } from "../../foundations/form.js";
9
- import { stickyTop, useStickyLayer } from "../../foundations/sticky.js";
10
9
  import { SurfaceProvider } from "../../foundations/surface.js";
11
10
  import { useViewStyle } from "../../foundations/viewStyle.js";
12
11
  import { Line } from "../../primitives/block/Line.js";
13
12
  import { Tag } from "../../primitives/tag/Tag.js";
14
- import { useEffect, useRef, useState } from "react";
13
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
15
14
  export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface = "canvas", smart, aspects, dirty, activity, activityLayout = "auto", width = "reading", ribbon, blocking, indicator, paper: onPaper, dock, look, children, }) {
16
15
  const d = useDensity();
17
16
  /* The «settings» and «sections» form styles (`FormStyleProvider`): Save and Discard float
@@ -26,9 +25,26 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
26
25
  draw both. Floating, the pill holds the actions AND Save / Discard: the rail keeps the
27
26
  rest. */
28
27
  const modern = useViewStyle(look) === "modern";
29
- const dockWhere = dock === undefined ? undefined : (dock.placement ?? (modern ? "bottom" : "rail"));
30
- const docked = dockWhere === "top" || dockWhere === "bottom";
28
+ /* In compact (a peek) there is no rail to hold them: the dock floats at the bottom of the
29
+ drawer in either style. Dropping them with the rail left a previewed record with no
30
+ actions — and, edited, with no way to save. */
31
+ const asked = dock?.placement ?? (modern ? "bottom" : "rail");
32
+ const dockWhere = dock === undefined ? undefined : d === "compact" && asked === "rail" ? "bottom" : asked;
33
+ const docked = dockWhere === "bottom";
31
34
  const railDirty = floating || docked ? undefined : dirty;
35
+ /* ONE PILL PER SCREEN (see `DockHost`): floating at the bottom, the record's pill is the
36
+ screen's place for one, and a collection inside it takes that place while it has rows
37
+ chosen. `taken` counts the takers; the band they draw into is `slot`. */
38
+ const hosting = dockWhere === "bottom";
39
+ const [taken, setTaken] = useState(0);
40
+ const [slot, setSlot] = useState(null);
41
+ const take = useCallback(() => {
42
+ setTaken((n) => n + 1);
43
+ return () => setTaken((n) => n - 1);
44
+ }, []);
45
+ const changed = dirty !== undefined;
46
+ const host = useMemo(() => (hosting ? { target: slot, dirty: changed, take } : null), [hosting, slot, changed, take]);
47
+ const given = hosting && taken > 0 && !changed;
32
48
  const railActions_ = docked ? undefined : dock !== undefined ? (_jsx(ActionDock, { ...dock, look: "bare", placement: "inline" })) : (actions);
33
49
  /* Save is gone the moment it has saved, and the focus that was on it fell to the page —
34
50
  a keyboard was left at the top of the document. It comes back to the record's name:
@@ -49,8 +65,11 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
49
65
  railDirty !== undefined;
50
66
  /* In compact the rail goes away ENTIRELY, and it is not for room: in a
51
67
  preview, the breadcrumbs and the pager belong to the surface that opened it
52
- —the list behind is still there— and the actions are already in the
53
- drawer's header. A rail inside another rail is two bars saying where I am.
68
+ —the list behind is still there—. A rail inside another rail is two bars
69
+ saying where I am. What the rail held for the RECORD does not go with it:
70
+ its actions as data (`Record.Dock`) float at the bottom of the drawer, and
71
+ Save / Discard too (`DirtyBar`). Actions drawn by hand (`Record.Actions`)
72
+ are the application's to place, in the drawer's own strip (`Peek actions`).
54
73
 
55
74
  The state does survive: it moves to the sheet, below the title. It is the
56
75
  only thing in the rail that belongs to the RECORD and not to my position in
@@ -99,44 +118,6 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
99
118
  : beside
100
119
  ? "mx-auto w-full max-w-(--container-record)"
101
120
  : "mx-auto w-full max-w-(--container-sheet)";
102
- /* THE DOCK AT THE TOP. At rest it is the RAIL's: in its second row, where the actions were,
103
- with the state at the other end — a band of its own between the rail and the paper was a
104
- fourth band before the record, and read as empty space. When the rail scrolls away, the pill
105
- FLOATS: it detaches and stays at the top of the page, under whatever already sticks.
106
- Floating it is one more layer of the sticky stack —a table header sticks under it, not
107
- behind it— over a veil of the ground, so what scrolls passes under the pill instead of
108
- peeking between it and the header. Without a rail (a dialog, compact) it floats from the
109
- start, in the flow. */
110
- const dockTop = dockWhere === "top";
111
- const inRail = dockTop && withRail;
112
- const anchor = useRef(null);
113
- const [detached, setDetached] = useState(false);
114
- useEffect(() => {
115
- const node = anchor.current;
116
- if (!inRail || node === null || typeof IntersectionObserver === "undefined") {
117
- setDetached(false);
118
- return;
119
- }
120
- /* Detached once the rail's pill is wholly ABOVE the view — not below it, at the bottom of a
121
- short window, where it is about to be scrolled to. */
122
- const observer = new IntersectionObserver(([entry]) => {
123
- if (entry === undefined)
124
- return;
125
- const top = entry.rootBounds?.top ?? 0;
126
- setDetached(!entry.isIntersecting && entry.boundingClientRect.bottom <= top);
127
- });
128
- observer.observe(node);
129
- return () => observer.disconnect();
130
- }, [inRail]);
131
- const floats = dockTop && (!inRail || detached);
132
- const dockLayer = useStickyLayer();
133
- const justify = dock?.align === "end" ? "justify-end" : "justify-center";
134
- const dockPill = dock === undefined ? null : (_jsx(ActionDock, { ...dock, ...(dirty === undefined ? {} : { dirty }), saved: saved, placement: "inline" }));
135
- const topDock = !dockTop ? null : inRail ? (
136
- /* Takes no room: it only holds the pill while the rail's is out of sight. */
137
- _jsx("div", { style: stickyTop, className: `pointer-events-none sticky z-20 h-0 ${paper ? column : ""}`, children: _jsx("div", { ref: dockLayer.ref, className: `absolute inset-x-0 top-0 flex ${justify} pt-2 pb-3 ${detached
138
- ? "bg-linear-to-b from-ground from-75% to-transparent transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:-translate-y-1 starting:opacity-0"
139
- : ""}`, children: detached ? dockPill : null }) })) : (_jsx("div", { ref: dockLayer.ref, style: dockLayer.self, className: `pointer-events-none sticky z-20 -mt-1 flex bg-linear-to-b from-ground from-75% to-transparent pb-3 ${paper ? column : ""} ${justify}`, children: dockPill }));
140
121
  const identity = (_jsxs("div", { className: `flex flex-col ${byDensity(d, "gap-2.5 px-4 pt-3.5", "gap-2 px-0 pt-0")}`, children: [withRail || (smart === undefined && indicator === undefined) ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [smart, indicator] })), _jsxs("div", { className: "flex min-w-0 flex-wrap items-start gap-x-5 gap-y-2", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [Icon === undefined || d === "compact" ? null : (_jsx("span", { className: "mt-1 flex size-9 shrink-0 items-center justify-center rounded-box bg-ink/5 text-muted", children: _jsx(Icon, { className: "size-(--size-icon-lg)", strokeWidth: 1.75 }) })), _jsxs("div", { className: "flex min-w-0 flex-col", children: [kicker === undefined || !withIdentity ? null : (_jsx("span", { className: "text-micro font-medium text-muted", children: kicker })), _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1", children: [!withIdentity ? null : (
141
122
  /* `display`, not `title`: the record's name is the entry point of the
142
123
  screen. At the title size (19 px over a 13 px body, 1.46:1) nothing on
@@ -145,7 +126,7 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
145
126
  /* The line is the sheet's mouth. In comfortable it walks to the
146
127
  edges; the current tab sits on it and opens into the page below. */
147
128
  _jsx("div", { className: `border-b border-line-strong ${byDensity(d, "-mx-4 px-4", "")}`, children: aspects }))] }));
148
- return (_jsxs(_Fragment, { children: [withRail ? (_jsx(SurfaceProvider, { value: railSurface, children: _jsx("div", { className: "@container/record", children: _jsx("div", { className: modern
129
+ return (_jsxs(DockHostContext, { value: host, children: [withRail ? (_jsx(SurfaceProvider, { value: railSurface, children: _jsx("div", { className: "@container/record", children: _jsx("div", { className: modern
149
130
  ? /* Modern: the rail is the page's heading on the ground, not a white strip. */
150
131
  "bg-ground px-3 pt-4 pb-1"
151
132
  : `px-3 py-2.5 ${railSurface === "chrome"
@@ -153,18 +134,12 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
153
134
  : "border-b border-line bg-surface"}`, children: _jsx("div", { className: `flex flex-col gap-2 ${paper ? column : ""}`, children: modern ? (_jsxs(_Fragment, { children: [_jsx(Line, { start: crumbs === undefined || crumbs.length === 0 ? null : (_jsx(Breadcrumb, { crumbs: crumbs, surface: railSurface, size: "lg" })), end: pager }), smart === undefined &&
154
135
  indicator === undefined &&
155
136
  status === undefined &&
156
- !inRail &&
157
137
  railActions_ === undefined &&
158
- railDirty === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2", children: [railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: _jsx(DirtyActions, { ...railDirty }) })) : railActions_ === undefined ? null : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [railActions_, _jsx(SavedMark, { saved: saved })] })), smart === undefined && indicator === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [smart, indicator] })), inRail ? (_jsx("div", { ref: anchor, className: `flex flex-1 items-center ${dock?.align === "end" ? "justify-end" : "justify-center"}`, ...(detached ? { inert: true, "aria-hidden": true } : {}), children: dockPill })) : null, status === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 flex-col items-end gap-1.5", children: status }))] }))] })) : (_jsxs(_Fragment, { children: [_jsx(Line, { start: crumbs === undefined || crumbs.length === 0 ? null : (_jsx(Breadcrumb, { crumbs: crumbs, surface: railSurface })), center:
138
+ railDirty === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2", children: [railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: _jsx(DirtyActions, { ...railDirty }) })) : railActions_ === undefined ? null : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [railActions_, _jsx(SavedMark, { saved: saved })] })), smart === undefined && indicator === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [smart, indicator] })), status === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 flex-col items-end gap-1.5", children: status }))] }))] })) : (_jsxs(_Fragment, { children: [_jsx(Line, { start: crumbs === undefined || crumbs.length === 0 ? null : (_jsx(Breadcrumb, { crumbs: crumbs, surface: railSurface })), center:
159
139
  /* The notices' indicator rides with the counters: both are about the
160
140
  record and both open something; neither is my position in front of
161
141
  it. The line wraps on a phone, so it is never pushed out of reach. */
162
- smart === undefined && indicator === undefined ? undefined : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-center gap-2", children: [smart, indicator] })),
163
- /* With the dock in the rail the pager goes down to its second row, beside
164
- the state: row 2 has room on the right, and row 1 —crumbs and seven
165
- counters— pushed it to a line of its own. */
166
- end: inRail ? undefined : pager }), !inRail &&
167
- railActions_ === undefined &&
142
+ smart === undefined && indicator === undefined ? undefined : (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center justify-center gap-2", children: [smart, indicator] })), end: pager }), railActions_ === undefined &&
168
143
  status === undefined &&
169
144
  railDirty === undefined &&
170
145
  (!saved || floating || docked) ? null : (
@@ -172,17 +147,9 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
172
147
  left edge, the history and the state stuck to the right one. No
173
148
  `flex-wrap`: wrapping split the row in two and the state ended up
174
149
  below the actions, which is another hierarchy. */
175
- _jsxs("div", { className: `flex min-w-0 gap-x-4 ${inRail ? "items-center" : "items-start"}`, children: [inRail && dock?.align !== "end" ? (_jsx("div", { "aria-hidden": true, className: "min-w-0 flex-1 basis-0" })) : null, inRail ? (
176
- /* The dock at rest. While it floats this copy is out of sight, and out
177
- of reach too — one toolbar at a time for a keyboard and a reader. */
178
- _jsx("div", { ref: anchor, className: `flex shrink-0 items-center ${dock?.align === "end" ? "ml-auto" : ""}`, ...(detached ? { inert: true, "aria-hidden": true } : {}), children: dockPill })) : railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5 @max-handheld/record:hidden", children: _jsx(DirtyActions, { ...railDirty }) })) : railActions_ === undefined ? (floating || docked ? null : (_jsx(SavedMark, { saved: saved }))) : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [primaries.length === 0
150
+ _jsxs("div", { className: "flex min-w-0 items-start gap-x-4", children: [railDirty !== undefined ? (_jsx("div", { className: "flex shrink-0 items-center gap-1.5 @max-handheld/record:hidden", children: _jsx(DirtyActions, { ...railDirty }) })) : railActions_ === undefined ? (floating || docked ? null : (_jsx(SavedMark, { saved: saved }))) : (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [primaries.length === 0
179
151
  ? railActions_
180
- : railActions.map((node) => isPrimary(node) ? (_jsx("span", { "data-thumb-moves": "", className: "contents @max-handheld/record:hidden", children: node }, node.key)) : (node)), floating ? null : _jsx(SavedMark, { saved: saved })] })), status === undefined && !(inRail && pager !== undefined) ? (inRail && dock?.align !== "end" ? (_jsx("div", { "aria-hidden": true, className: "min-w-0 flex-1 basis-0" })) : null) : (_jsxs("div", {
181
- /* Centred, the state's side never shrinks below what it holds: a
182
- pill grown by «Guardado» pushes the spacer, not over the state. */
183
- className: `flex items-center justify-end gap-x-3 ${inRail && dock?.align !== "end"
184
- ? "flex-1 basis-0"
185
- : "ml-auto min-w-0"}`, children: [status === undefined ? null : (_jsx("div", { className: "flex min-w-0 flex-col items-end gap-1.5", children: status })), inRail ? pager : null] }))] }))] })) }) }) }) })) : null, paper ? (
152
+ : railActions.map((node) => isPrimary(node) ? (_jsx("span", { "data-thumb-moves": "", className: "contents @max-handheld/record:hidden", children: node }, node.key)) : (node)), floating ? null : _jsx(SavedMark, { saved: saved })] })), status === undefined ? null : (_jsx("div", { className: "ml-auto flex min-w-0 flex-col items-end gap-1.5", children: status }))] }))] })) }) }) }) })) : null, paper ? (
186
153
  /* ==================================================================== *
187
154
  * THE PAGE — [sheet | Actividad], on the ground.
188
155
  *
@@ -209,15 +176,17 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
209
176
  * a scroll container and the line table header would stick inside it, not under
210
177
  * the application bar.
211
178
  * ==================================================================== */
212
- _jsxs("div", { className: "bg-ground px-3 pt-3 pb-3", children: [topDock, _jsx("div", { className: "@container/page", ...(floats ? { style: dockLayer.below } : {}), children: _jsxs("div", { className: `flex min-w-0 flex-col gap-3 ${column} ${beside
213
- ? `@beside/page:flex-row @beside/page:items-stretch @beside/page:justify-center ${floating ? "@beside/page:gap-4" : "@beside/page:gap-0"}`
214
- : ""}`, children: [_jsxs("div", { className: `flex min-w-0 flex-1 flex-col gap-3 ${beside && width === "reading"
215
- ? "mx-auto w-full max-w-(--container-sheet) @beside/page:mx-0"
216
- : ""}`, children: [blocking, _jsxs("div", { className: `relative flex min-w-0 flex-col overflow-clip ${floating ? "" : "rounded-box border border-line bg-surface"} ${beside && !floating ? "@beside/page:rounded-r-none" : ""}`, children: [ribbon, identity, children] }), activity !== undefined && activityLayout === "below" ? activity : null] }), beside ? (
217
- /* After the sheet: the record first, what is around it second — in the
218
- reading order and on screen. */
219
- _jsx("div", { className: "mx-auto w-full max-w-(--container-sheet) min-w-0 @beside/page:mx-0 @beside/page:flex @beside/page:w-auto @beside/page:max-w-none @beside/page:shrink-0", children: activity })) : null] }) })] })) : (
179
+ _jsx("div", { className: "bg-ground px-3 pt-3 pb-3", children: _jsx("div", { className: "@container/page", children: _jsxs("div", { className: `flex min-w-0 flex-col gap-3 ${column} ${beside
180
+ ? `@beside/page:flex-row @beside/page:items-stretch @beside/page:justify-center ${floating ? "@beside/page:gap-4" : "@beside/page:gap-0"}`
181
+ : ""}`, children: [_jsxs("div", { className: `flex min-w-0 flex-1 flex-col gap-3 ${beside && width === "reading"
182
+ ? "mx-auto w-full max-w-(--container-sheet) @beside/page:mx-0"
183
+ : ""}`, children: [blocking, _jsxs("div", { className: `relative flex min-w-0 flex-col overflow-clip ${floating ? "" : "rounded-box border border-line bg-surface"} ${beside && !floating ? "@beside/page:rounded-r-none" : ""}`, children: [ribbon, identity, children] }), activity !== undefined && activityLayout === "below" ? activity : null] }), beside ? (
184
+ /* After the sheet: the record first, what is around it second — in the
185
+ reading order and on screen. */
186
+ _jsx("div", { className: "mx-auto w-full max-w-(--container-sheet) min-w-0 @beside/page:mx-0 @beside/page:flex @beside/page:w-auto @beside/page:max-w-none @beside/page:shrink-0", children: activity })) : null] }) }) })) : (
220
187
  /* No paper (a modal, a drawer): one surface, no ground beside
221
188
  it — the band first, the record, and the activity below. */
222
- _jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-clip bg-surface", children: [topDock, ribbon, blocking === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pt-3.5", "pb-2"), children: blocking })), identity, children, activity === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pb-4", "pb-2"), children: activity }))] })), thumb === null ? null : (_jsx(ThumbBar, { mode: thumb, dirty: railDirty, primaries: primaries })), floating && !docked ? _jsx(DirtyBar, { dirty: dirty, saved: saved }) : null, dock === undefined || dockWhere !== "bottom" ? null : (_jsx(ActionDock, { ...dock, ...(dirty === undefined ? {} : { dirty }), saved: saved, placement: "bottom" }))] }));
189
+ _jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-clip bg-surface", children: [ribbon, blocking === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pt-3.5", "pb-2"), children: blocking })), identity, children, activity === undefined ? null : (_jsx("div", { className: byDensity(d, "px-4 pb-4", "pb-2"), children: activity }))] })), thumb === null ? null : (_jsx(ThumbBar, { mode: thumb, dirty: railDirty, primaries: primaries })), (floating || d === "compact") && !docked ? (_jsx(DirtyBar, { dirty: dirty, saved: saved })) : null, dock === undefined || !hosting ? null : given ? (
190
+ /* Given away: an empty band where the taker draws its pill. */
191
+ _jsx(DockBand, { ref: setSlot })) : (_jsx(ActionDock, { ...dock, ...(dirty === undefined ? {} : { dirty }), saved: saved, placement: "bottom" }))] }));
223
192
  }
@@ -1,5 +1,5 @@
1
1
  import type { Surface } from "../../foundations/types.js";
2
- import { type LucideIcon } from "lucide-react";
2
+ import type { LucideIcon } from "lucide-react";
3
3
  import { type ReactNode } from "react";
4
4
  /** What hangs off this record, with its number, and can be pressed.
5
5
  *
@@ -10,7 +10,7 @@ import { type ReactNode } from "react";
10
10
  * **`—` is not `0`.** «I don't know yet» and «there is none» are two different
11
11
  * answers, and confusing them makes somebody decide on data that has not
12
12
  * arrived yet. */
13
- export declare function SmartButton({ icon: Icon, count, label, onClick, disabled, surface, layout, look, }: {
13
+ export declare function SmartButton({ icon: Icon, count, label, onClick, disabled, surface, layout, }: {
14
14
  icon: LucideIcon;
15
15
  count?: number;
16
16
  label: string;
@@ -29,12 +29,6 @@ export declare function SmartButton({ icon: Icon, count, label, onClick, disable
29
29
  * «something looks off».
30
30
  */
31
31
  layout?: "stacked" | "inline";
32
- /**
33
- * `box` (the default): a bordered box, the rail's. `link`: it reads as what it is — a way
34
- * to ANOTHER place: the count in a primary pill, the label, and a «›» that says it leads
35
- * somewhere; at zero it goes quiet and loses the «›». The record's modern style.
36
- */
37
- look?: "box" | "link";
38
32
  }): import("react").JSX.Element;
39
33
  export declare function SmartButtons({ children }: {
40
34
  children: ReactNode;
@@ -2,7 +2,6 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useUiCopy } from "../../foundations/copy.js";
4
4
  import { bySurface, useSurface } from "../../foundations/surface.js";
5
- import { ChevronRight } from "lucide-react";
6
5
  import { Children, createContext, useContext } from "react";
7
6
  /* ---------------------------------------------------------------- *
8
7
  * THE SMART BUTTONS
@@ -19,15 +18,11 @@ const SmartGroup = createContext(false);
19
18
  * **`—` is not `0`.** «I don't know yet» and «there is none» are two different
20
19
  * answers, and confusing them makes somebody decide on data that has not
21
20
  * arrived yet. */
22
- export function SmartButton({ icon: Icon, count, label, onClick, disabled = false, surface, layout = "stacked", look = "box", }) {
21
+ export function SmartButton({ icon: Icon, count, label, onClick, disabled = false, surface, layout = "stacked", }) {
23
22
  const copy = useUiCopy();
24
23
  const activeSurface = useSurface(surface);
25
24
  const grouped = useContext(SmartGroup);
26
25
  const empty = count === 0;
27
- if (look === "link") {
28
- const off = disabled || onClick === undefined;
29
- return (_jsxs("button", { type: "button", onClick: onClick, disabled: off, "data-ui": "smart", "data-look": "link", className: "group inline-flex h-(--size-control-sm) shrink-0 items-center gap-1.5 rounded-pill px-2 text-left text-meta transition-colors duration-(--duration-instant) not-disabled:hover:bg-primary/8 disabled:cursor-default focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", children: [_jsx(Icon, { className: `size-(--size-icon-sm) shrink-0 ${empty ? "text-muted/60" : "text-primary"}`, strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: `rounded-pill px-1.5 text-micro font-semibold tabular-nums ${empty ? "bg-ink/6 text-muted" : "bg-primary/12 text-primary"}`, children: count === undefined ? "—" : count.toLocaleString(copy.locale) }), _jsx("span", { className: empty ? "text-muted" : "text-ink", children: label }), empty || off ? null : (_jsx(ChevronRight, { className: "size-(--size-icon-sm) shrink-0 text-muted transition-colors duration-(--duration-instant) group-hover:text-primary", strokeWidth: 2, "aria-hidden": true }))] }));
30
- }
31
26
  const isInline = layout === "inline";
32
27
  return (_jsxs("button", { type: "button", onClick: onClick, disabled: disabled || onClick === undefined, className: `flex shrink-0 items-center gap-2 text-left transition-[background-color,border-color,box-shadow] duration-(--duration-instant) disabled:cursor-default disabled:opacity-60 focus-visible:outline-2 focus-visible:outline-primary ${grouped
33
28
  ? `not-disabled:hover:bg-chrome-ink/10 focus-visible:-outline-offset-2 ${isInline ? "h-(--size-control-sm) px-2.5" : "px-2.5 py-1"}`
@@ -10,5 +10,8 @@ export type SwitchProps = {
10
10
  describedBy?: string;
11
11
  /** Forces the mode. By default it inherits the form's: in read mode it draws the answer. */
12
12
  mode?: FormMode;
13
+ /** Its name when there is no `Field` and no sentence beside it — a switch in a table cell,
14
+ * named by its column. */
15
+ label?: string;
13
16
  };
14
- export declare function Switch({ checked, onChange, children, disabled, id: ownId, describedBy: ownDescribedBy, mode, }: SwitchProps): import("react").JSX.Element;
17
+ export declare function Switch({ checked, onChange, children, disabled, id: ownId, describedBy: ownDescribedBy, mode, label, }: SwitchProps): import("react").JSX.Element;
@@ -43,7 +43,7 @@ const thumb = tv({
43
43
  },
44
44
  },
45
45
  });
46
- export function Switch({ checked, onChange, children, disabled = false, id: ownId, describedBy: ownDescribedBy, mode, }) {
46
+ export function Switch({ checked, onChange, children, disabled = false, id: ownId, describedBy: ownDescribedBy, mode, label, }) {
47
47
  const { id, labelledBy, describedBy } = useFieldIds({
48
48
  id: ownId,
49
49
  describedBy: ownDescribedBy,
@@ -58,7 +58,7 @@ export function Switch({ checked, onChange, children, disabled = false, id: ownI
58
58
  if (useFormMode(mode) === "read") {
59
59
  return (_jsxs("span", { className: "flex min-h-(--size-control-md) items-center gap-1.5 text-meta text-ink", children: [checked ? (_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm) text-good", strokeWidth: 2.5 })) : (_jsx(Minus, { "aria-hidden": true, className: "size-(--size-icon-sm) text-muted", strokeWidth: 2.5 })), children] }));
60
60
  }
61
- return (_jsx(AriaSwitch, { id: id, "aria-labelledby": named, "aria-describedby": describedBy, isSelected: checked, onChange: (next) => onChange?.(next), isDisabled: disabled,
61
+ return (_jsx(AriaSwitch, { id: id, "aria-labelledby": named, ...(named === undefined && label !== undefined ? { "aria-label": label } : {}), "aria-describedby": describedBy, isSelected: checked, onChange: (next) => onChange?.(next), isDisabled: disabled,
62
62
  /* The height of a control, so a switch alone in a field lines up with a text input in
63
63
  the next column. */
64
64
  className: "group inline-flex min-h-(--size-control-md) min-w-0 cursor-pointer items-center gap-2.5 text-meta text-ink disabled:cursor-not-allowed disabled:opacity-45", children: (state) => (_jsxs(_Fragment, { children: [_jsx("span", { className: track(state), children: _jsx("span", { className: thumb(state) }) }), children === undefined ? null : (_jsx("span", { id: textId, className: "min-w-0", children: children }))] })) }));
@@ -2,6 +2,7 @@ import { type Pile } from "../../foundations/grouping.js";
2
2
  import type { Tone } from "../../foundations/types.js";
3
3
  import { type RowAction } from "./RowActions.js";
4
4
  import type { SortState } from "./sorting.js";
5
+ import { type YesNoLook } from "../value/YesNo.js";
5
6
  import { type ReactNode } from "react";
6
7
  /** How a column is aggregated when its rows are pulled together into a group.
7
8
  *
@@ -115,7 +116,20 @@ export interface DataColumn<T> {
115
116
  * A function copies what it returns for the row instead; `false` removes it from this
116
117
  * column — a column of tags or of buttons has nothing worth pasting. */
117
118
  copy?: false | ((row: T) => string);
119
+ /** A yes/no column (its `value` a boolean): how it reads — `check`, `icon`, `word` (the
120
+ * default, see `YesNo`) — or, with `onToggle`, a `checkbox` or a `switch` that changes it
121
+ * from the list without opening the record. */
122
+ yesNo?: YesNoColumn<T>;
118
123
  }
124
+ /** How a yes/no column reads, and whether it is changed from the list. */
125
+ export type YesNoColumn<T> = {
126
+ look?: YesNoLook | "checkbox" | "switch";
127
+ /** Changes the row's value. Without it a checkbox or a switch reads as `check`: a control
128
+ * that cannot be pressed is a promise the cell does not keep. */
129
+ onToggle?: (row: T, next: boolean) => void;
130
+ /** Which rows can be changed — a closed course's enrolment cannot. All of them by default. */
131
+ when?: (row: T) => boolean;
132
+ };
119
133
  /** Writing a new record in the list. See the file's header. */
120
134
  export type DataTableCreate<T> = {
121
135
  /** The record being written, or `null` when there is none. */
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { currentCopyLocale, fillCopy, useUiCopy, } from "../../foundations/copy.js";
4
4
  import { FieldBoundary } from "../../foundations/form.js";
5
5
  import { pathKey, pileFoot, pileItems, } from "../../foundations/grouping.js";
6
+ import { Switch } from "../choice/Switch.js";
6
7
  import { CellCopy } from "./CellCopy.js";
7
8
  import { CellEditor } from "./CellEditor.js";
8
9
  import { EditRow, firstControl } from "./EditableTable.js";
@@ -10,6 +11,7 @@ import { PileFootLine } from "./PileFootLine.js";
10
11
  import { RowActions } from "./RowActions.js";
11
12
  import { useRowWindow } from "./rowWindow.js";
12
13
  import { SelectBox, Table, Td, Th, THead, Tr } from "./Table.js";
14
+ import { YesNo } from "../value/YesNo.js";
13
15
  import { aggregationFns, columnGroupingFeature, createColumnHelper, createExpandedRowModel, createGroupedRowModel, createSortedRowModel, rowAggregationFeature, rowExpandingFeature, rowSortingFeature, sortFns, tableFeatures, useTable, } from "@tanstack/react-table";
14
16
  import { ChevronRight, Plus } from "lucide-react";
15
17
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -98,14 +100,28 @@ function raw(copy, v) {
98
100
  return v ? copy.table.yes : copy.table.no;
99
101
  return v;
100
102
  }
103
+ /** A boolean drawn by its column's `yesNo`: read, or a control that changes it in place. The
104
+ * control's press stays in the cell — the row opens its record on a click. */
105
+ function drawYesNo(column, row, value) {
106
+ const look = column.yesNo?.look ?? "word";
107
+ const toggle = column.yesNo?.onToggle;
108
+ const can = toggle !== undefined && column.yesNo?.when?.(row) !== false;
109
+ if (look !== "checkbox" && look !== "switch")
110
+ return _jsx(YesNo, { value: value, look: look });
111
+ if (!can)
112
+ return _jsx(YesNo, { value: value, look: "check" });
113
+ return (_jsx("span", { className: "inline-flex", onClick: (event) => event.stopPropagation(), children: look === "checkbox" ? (_jsx(SelectBox, { label: column.header, checked: value, onChange: (next) => toggle(row, next) })) : (_jsx(Switch, { label: column.header, checked: value, onChange: (next) => toggle(row, next) })) }));
114
+ }
101
115
  /** What a cell draws: its `cell`; without one, how it READS (`text`); only then the raw
102
- * value — which is the sort key, «posted» and not «publicada». */
116
+ * value — which is the sort key, «posted» and not «publicada». A boolean reads as yes / no. */
103
117
  function drawCell(copy, column, row) {
104
118
  if (column.cell !== undefined)
105
119
  return column.cell(row);
106
120
  if (column.text !== undefined)
107
121
  return column.text(row);
108
122
  const value = column.value(row);
123
+ if (typeof value === "boolean")
124
+ return drawYesNo(column, row, value);
109
125
  /* A number is written the way the column writes its numbers — the same way its footer and
110
126
  its piles write them —, so a cell, its pile and the total never disagree on decimals. */
111
127
  const format = typeof value === "number" ? columnFormat(column, copy.locale) : undefined;
@@ -7,6 +7,11 @@ export interface RowAction {
7
7
  tone?: "normal" | "action" | "danger";
8
8
  disabled?: boolean;
9
9
  onSelect: () => void;
10
+ /** A way INTO the record (look, open, open in…) and not something done to it: always one
11
+ * press away, first, and in the modern style grouped in the navigation pill. */
12
+ way?: boolean;
13
+ /** Its choices: the action is a menu (`icon` its trigger) — «Abrir en…» with the places. */
14
+ menu?: readonly Pick<RowAction, "id" | "label" | "icon" | "onSelect">[];
10
15
  }
11
16
  export declare function RowActions({ actions,
12
17
  /** How many stay visible before the rest fall into the `⋯`. */
@@ -1,26 +1,50 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useUiCopy } from "../../foundations/copy.js";
4
+ import { useViewStyle } from "../../foundations/viewStyle.js";
4
5
  import { IconButton } from "../button/Button.js";
5
6
  import { Menu } from "../menu/Menu.js";
6
7
  import { useRowWash } from "./Table.js";
7
8
  import { MoreHorizontal } from "lucide-react";
9
+ /* ── The ways in, in the modern style ─────────────────────────────────
10
+ *
11
+ * Grey icons at the row's end read as decoration, and an application added its own beside the
12
+ * name — three sets, unaligned. In the modern style the ways in are ONE pill, the pager's
13
+ * translucent primary (navigation has that colour across the system: where I am, where I go),
14
+ * always at the same place at the row's end; what is done to the record follows, quiet. */
15
+ function WayButton({ way, pill }) {
16
+ if (way.menu !== undefined) {
17
+ const byId = new Map(way.menu.map((m) => [m.id, m]));
18
+ return (_jsx(Menu, { label: way.label, title: way.label, icon: way.icon, iconOnly: true, chevron: false, variant: "text", size: "sm", align: "end", groups: [
19
+ { options: way.menu.map((m) => ({ id: m.id, label: m.label, icon: m.icon })) },
20
+ ], onSelect: (id) => byId.get(id)?.onSelect() }));
21
+ }
22
+ return (_jsx(IconButton, { icon: way.icon, label: way.label, size: "sm", ...(pill
23
+ ? { tone: "action" }
24
+ : way.tone === undefined
25
+ ? {}
26
+ : { tone: way.tone }), ...(way.disabled === undefined ? {} : { disabled: way.disabled }), onClick: way.onSelect }));
27
+ }
8
28
  export function RowActions({ actions,
9
29
  /** How many stay visible before the rest fall into the `⋯`. */
10
30
  inline = 2, }) {
11
31
  const copy = useUiCopy();
12
32
  const wash = useRowWash();
33
+ const pill = useViewStyle() === "modern";
13
34
  if (actions.length === 0)
14
35
  return _jsx("td", { className: `w-0 border-b border-line ${wash}` });
36
+ /* The ways in are never folded into ⋯: each is one press away. The rest share `inline`. */
37
+ const ways = actions.filter((a) => a.way === true);
38
+ const done = actions.filter((a) => a.way !== true);
15
39
  /* With only one left over there is no `⋯`: a menu with a single item is one
16
40
  extra click to reach the same button. */
17
- const inlineActions = actions.length <= inline + 1 ? actions : actions.slice(0, inline);
18
- const overflow = actions.slice(inlineActions.length);
41
+ const inlineActions = done.length <= inline + 1 ? done : done.slice(0, inline);
42
+ const overflow = done.slice(inlineActions.length);
19
43
  const byId = new Map(actions.map((a) => [a.id, a]));
20
44
  return (
21
45
  /* The row's hairline runs under its actions too: without it the separators stopped one
22
46
  column short and the actions read as outside the table. */
23
- _jsx("td", { className: `w-0 border-b border-line py-1 pr-2 pl-1 align-middle whitespace-nowrap last:rounded-r-control ${wash}`, children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: [inlineActions.map((a) => (_jsx(IconButton, { icon: a.icon, label: a.label, size: "sm", ...(a.tone === undefined ? {} : { tone: a.tone }), ...(a.disabled === undefined ? {} : { disabled: a.disabled }), onClick: a.onSelect }, a.id))), overflow.length === 0 ? null : (_jsx(Menu, { label: copy.selection.more, icon: MoreHorizontal, iconOnly: true, chevron: false, align: "end", groups: [
47
+ _jsx("td", { className: `w-0 border-b border-line py-1 pr-2 pl-1 align-middle whitespace-nowrap last:rounded-r-control ${wash}`, children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: [ways.length === 0 ? null : (_jsx("span", { "data-ui": "row.ways", "data-look": pill ? "pill" : "plain", className: `flex items-center gap-0.5 ${pill ? "rounded-pill border border-primary/20 bg-primary/8 p-0.5" : ""}`, children: ways.map((way) => (_jsx(WayButton, { way: way, pill: pill }, way.id))) })), inlineActions.map((a) => (_jsx(IconButton, { icon: a.icon, label: a.label, size: "sm", ...(a.tone === undefined ? {} : { tone: a.tone }), ...(a.disabled === undefined ? {} : { disabled: a.disabled }), onClick: a.onSelect }, a.id))), overflow.length === 0 ? null : (_jsx(Menu, { label: copy.selection.more, icon: MoreHorizontal, iconOnly: true, chevron: false, align: "end", groups: [
24
48
  {
25
49
  options: overflow.map((a) => ({
26
50
  id: a.id,
@@ -1,4 +1,4 @@
1
- export { type Aggregate, type DataColumn, DataTable, type DataTableCreate, type GroupColumn, } from "./DataTable.js";
1
+ export { type Aggregate, type DataColumn, DataTable, type DataTableCreate, type GroupColumn, type YesNoColumn, } from "./DataTable.js";
2
2
  export { EditableTable, type EditAdd, type EditBands, type EditCellState, type EditColumn, type EditFlag, type EditLayout, type EditRowState, sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget, } from "./EditableTable.js";
3
3
  export { PileFootLine } from "./PileFootLine.js";
4
4
  export { PivotTable, type PivotTableProps, } from "./PivotTable.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A yes / no, READ: how a boolean looks where it is shown and not changed — a cell, a fact, a
3
+ * card.
4
+ *
5
+ * Context: a column of booleans drew «Sí» / «No» as plain text in one place, a bare ✓ and
6
+ * nothing in another, «✓ Sí» / «No» in a third. Each is right for some column, so they are
7
+ * LOOKS of one piece, chosen per column:
8
+ *
9
+ * check ✓ for yes, nothing for no — a column scanned for its yeses («Publicado»).
10
+ * icon a green ✓ and a quiet ✕ — both answers matter and are read at a glance.
11
+ * word «✓ Sí» / «No» — a check alone is not read by everyone the same way.
12
+ *
13
+ * Color never alone: the green ✓ has a shape that is not the ✕'s, and every look says «Sí» or
14
+ * «No» to a screen reader, the empty «no» of `check` included — an empty cell is not an answer.
15
+ * To CHANGE it from where it is shown, a column draws a checkbox or a switch instead (the
16
+ * table's `yesNo.onToggle`).
17
+ */
18
+ export type YesNoLook = "check" | "icon" | "word";
19
+ export declare function YesNo({ value, look }: {
20
+ value: boolean;
21
+ look?: YesNoLook;
22
+ }): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { Check, X } from "lucide-react";
5
+ export function YesNo({ value, look = "word" }) {
6
+ const copy = useUiCopy();
7
+ const said = value ? copy.table.yes : copy.table.no;
8
+ if (look === "icon") {
9
+ return (_jsxs("span", { "data-ui": "yes-no", "data-value": value ? "yes" : "no", className: `inline-flex size-5 shrink-0 items-center justify-center rounded-pill ${value ? "bg-good/12 text-good" : "bg-ink/6 text-muted"}`, children: [value ? (_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2.75 })) : (_jsx(X, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2.5 })), _jsx("span", { className: "sr-only", children: said })] }));
10
+ }
11
+ if (look === "check") {
12
+ return value ? (_jsxs("span", { "data-ui": "yes-no", "data-value": "yes", className: "inline-flex text-good", children: [_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2.5 }), _jsx("span", { className: "sr-only", children: said })] })) : (_jsx("span", { "data-ui": "yes-no", "data-value": "no", className: "sr-only", children: said }));
13
+ }
14
+ /* `word`: «no» needs no icon — an empty mark next to every false row would only add noise. */
15
+ return value ? (_jsxs("span", { "data-ui": "yes-no", "data-value": "yes", 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 }), said] })) : (_jsx("span", { "data-ui": "yes-no", "data-value": "no", className: "text-muted", children: said }));
16
+ }
@@ -10,3 +10,4 @@ export { isRichTextEmpty, richTextPlain, RichTextValue, sanitizeRichText, } from
10
10
  export { type Rounding, type RoundingMethod, roundTo, } from "./rounding.js";
11
11
  export { Totals, type TotalsCredit, type TotalsDeduction, type TotalsFact, type TotalsProps, type TotalsRow, } from "./Totals.js";
12
12
  export { Cell, formatCount, formatDistance, formatNumber, formatWith, KeyValue, Numeric, } from "./Value.js";
13
+ export { YesNo, type YesNoLook } from "./YesNo.js";
@@ -12,3 +12,4 @@ export { isRichTextEmpty, richTextPlain, RichTextValue, sanitizeRichText, } from
12
12
  export { roundTo, } from "./rounding.js";
13
13
  export { Totals, } from "./Totals.js";
14
14
  export { Cell, formatCount, formatDistance, formatNumber, formatWith, KeyValue, Numeric, } from "./Value.js";
15
+ export { YesNo } from "./YesNo.js";
package/dist/tokens.css CHANGED
@@ -1487,6 +1487,22 @@
1487
1487
  * whose tap the system takes for a swipe home. It needs `viewport-fit=cover` in the
1488
1488
  * page to measure anything; without it the inset is 0 and this is plain `pb-3`.
1489
1489
  * ------------------------------------------------------------------ */
1490
+ /* A board's figure FITS its tile (#68): never cut, never past the tile's edge. Its size is the
1491
+ tile's width over the figure's length — between the title step and its own step (the
1492
+ figure's, or the hero's for the lead one) —, so «15» stays big and «Bs 1.234.567,89» steps
1493
+ down until it fits. CSS only, nothing measured: the length is the figure's characters
1494
+ (`--figure-length`, written by the component), the width the tile's (`cqi` — the tile is its
1495
+ own container), and a character of the figure's face is about 0.62 of its size wide. */
1496
+ @utility figure-fit {
1497
+ font-size: clamp(
1498
+ var(--text-title),
1499
+ calc(100cqi / (var(--figure-length, 8) * 0.62)),
1500
+ var(--figure-step, var(--text-figure))
1501
+ );
1502
+ line-height: var(--text-figure--line-height);
1503
+ letter-spacing: var(--text-figure--letter-spacing);
1504
+ }
1505
+
1490
1506
  @utility safe-bottom {
1491
1507
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
1492
1508
  }
@@ -3,6 +3,7 @@ import type { ListIdentity } from "../../components/listing/ListingBar.js";
3
3
  import type { SortField } from "../../components/listing/SortMenu.js";
4
4
  import type { ViewIcon } from "../../components/listing/ViewSwitcher.js";
5
5
  import type { Surface } from "../../foundations/types.js";
6
+ import type { OpenTarget } from "../../foundations/types.js";
6
7
  import type { DataColumn, DataTableCreate } from "../../primitives/table/DataTable.js";
7
8
  import type { RowAction } from "../../primitives/table/RowActions.js";
8
9
  import type { SortState } from "../../primitives/table/sorting.js";
@@ -110,6 +111,9 @@ export type ListProps<T extends object> = {
110
111
  onOpen?: (item: T) => void;
111
112
  onPeek?: (item: T) => void;
112
113
  isPeeked?: (item: T) => boolean;
114
+ /** «Abrir en…» in the row's ways: the other places its record opens (see `ListViewProps`). */
115
+ openTargets?: readonly OpenTarget[];
116
+ onOpenIn?: (item: T, to: OpenTarget) => void;
113
117
  /** What a press on the row's body does when both ways in exist. `peek` (the default) looks
114
118
  * without leaving the list; `open` goes to the record — a workspace whose rule is «a row
115
119
  * opens the page» (the composer's) says `open`, and 👁 stays for the look. */
@@ -140,7 +144,7 @@ export type ListProps<T extends object> = {
140
144
  empty?: ListEmpty;
141
145
  children?: ReactNode;
142
146
  };
143
- export declare function List<T extends object>({ items, keyOf, embedded, surface, group, selection: selectWith, sort, onSortChange, sortable, present, onPresentChange, onOpen: openWith, onPeek: peekWith, isPeeked, readOnly, rowClick, onChoose, state, filtered, empty, children, }: ListProps<T>): import("react").JSX.Element;
147
+ export declare function List<T extends object>({ items, keyOf, embedded, surface, group, selection: selectWith, sort, onSortChange, sortable, present, onPresentChange, onOpen: openWith, onPeek: peekWith, isPeeked, openTargets, onOpenIn, readOnly, rowClick, onChoose, state, filtered, empty, children, }: ListProps<T>): import("react").JSX.Element;
144
148
  export declare namespace List {
145
149
  var Bar: ((props: BarProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"bar">;
146
150
  var Crumbs: ((props: CrumbsProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"crumbs">;
@@ -85,7 +85,7 @@ function facesOf(nodes) {
85
85
  }
86
86
  return faces;
87
87
  }
88
- export function List({ items, keyOf, embedded, surface, group, selection: selectWith, sort, onSortChange, sortable, present, onPresentChange, onOpen: openWith, onPeek: peekWith, isPeeked, readOnly = false, rowClick, onChoose, state, filtered, empty, children, }) {
88
+ export function List({ items, keyOf, embedded, surface, group, selection: selectWith, sort, onSortChange, sortable, present, onPresentChange, onOpen: openWith, onPeek: peekWith, isPeeked, openTargets, onOpenIn, readOnly = false, rowClick, onChoose, state, filtered, empty, children, }) {
89
89
  const top = flatten(children);
90
90
  const onOpen = readOnly ? undefined : openWith;
91
91
  const onPeek = readOnly ? undefined : peekWith;
@@ -150,7 +150,11 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
150
150
  : { onVisibleColumnIdsChange: table.onVisibleColumnIdsChange }),
151
151
  }), ...(board?.card === undefined ? {} : { card: board.card }), ...(board?.stages === undefined ? {} : { boardStages: board.stages }), ...(sheet?.columns === undefined || sheet.cell === undefined
152
152
  ? {}
153
- : { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(chart === undefined ? {} : { chart }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined ? {} : { present }), ...(onPresentChange === undefined ? {} : { onPresentChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(sortable === undefined ? {} : { sortable }), ...(onOpen === undefined ? {} : { onOpen }), ...(onPeek === undefined ? {} : { onPeek }), ...(isPeeked === undefined ? {} : { isPeeked }), ...(rowClick === undefined ? {} : { rowClick }), ...(onChoose === undefined || readOnly ? {} : { onChoose }), ...(state === undefined ? {} : { state }), ...(filtered === undefined ? {} : { filtered }), ...(empty === undefined ? {} : { empty }), children: rest.length === 0 ? undefined : rest }));
153
+ : { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(chart === undefined ? {} : { chart }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined
154
+ ? presents[0] === undefined
155
+ ? {}
156
+ : { present: presents[0] }
157
+ : { present }), ...(onPresentChange === undefined ? {} : { onPresentChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(sortable === undefined ? {} : { sortable }), ...(onOpen === undefined ? {} : { onOpen }), ...(onPeek === undefined ? {} : { onPeek }), ...(isPeeked === undefined ? {} : { isPeeked }), ...(openTargets === undefined || readOnly ? {} : { openTargets }), ...(onOpenIn === undefined || readOnly ? {} : { onOpenIn }), ...(rowClick === undefined ? {} : { rowClick }), ...(onChoose === undefined || readOnly ? {} : { onChoose }), ...(state === undefined ? {} : { state }), ...(filtered === undefined ? {} : { filtered }), ...(empty === undefined ? {} : { empty }), children: rest.length === 0 ? undefined : rest }));
154
158
  }
155
159
  List.Bar = Bar;
156
160
  List.Crumbs = Crumbs;
@@ -1,5 +1,5 @@
1
1
  import type { ListViewProps } from "./types.js";
2
- export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions: written, dock, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
2
+ export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions: written, dock, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, openTargets, onOpenIn, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
3
3
  /** What a list offers when it fails and can be retried. */
4
4
  export declare function RetryAction({ onRetry }: {
5
5
  onRetry: () => void;