@sincpro/web-ui 1.7.2 → 1.9.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.
@@ -1,15 +1,36 @@
1
- import type { ReactNode } from "react";
2
- /** Who did something to the record and when, already written: «Carla Rojas», «hace 3 días». */
1
+ import { type UserChipProps } from "../../primitives/value/Person.js";
2
+ import { type ReactNode } from "react";
3
+ /**
4
+ * Who did something to the record and when.
5
+ *
6
+ * `by` is the person: a name (drawn as the system's `UserChip`, the same face and name a
7
+ * «Vendedor» field shows), the chip's props (to give it a photo, a contact card or «Abrir»),
8
+ * or a node the application already drew. Optional: an import, a sync or a backend that does
9
+ * not keep the author still knows WHEN — the line then says only that, never «por —».
10
+ *
11
+ * `at` is the moment: a `Date`, an ISO string or a timestamp is written by the system as the
12
+ * locale's date and time (DD/MM/YYYY HH:mm in Spanish), so every record says it the same
13
+ * way; anything else is shown as the application wrote it.
14
+ */
3
15
  export type RecordStamp = {
4
- by: ReactNode;
5
- at: ReactNode;
16
+ by?: ReactNode | UserChipProps;
17
+ at: ReactNode | Date;
6
18
  };
7
19
  /**
8
20
  * The last line of the paper: who created the record and who touched it last.
9
21
  *
10
22
  * Context: «¿quién cambió esto?» is the first question in front of a number that looks wrong,
11
23
  * and the activity's timeline answers it only for what was logged. Small and at the end: it is
12
- * consulted, not read.
24
+ * consulted, not read — so it is the quietest thing on the paper, below the facts, behind a
25
+ * rule.
26
+ *
27
+ * It was one run-on sentence («Creado por Josefa Muñoz · 02/09/2026») with the person as bare
28
+ * text and the date in whatever shape the app sent. It is now the record's own grammar: a
29
+ * muted label and its value, the person as the chip every other person-field uses and the date
30
+ * as `DateValue` — so the footer reads like the form above it, not like a log line.
31
+ *
32
+ * Its side padding follows the density: the compact body (a dialog, a card) has none, and a
33
+ * footer with `px-4` stood out of the column of fields it closes.
13
34
  */
14
35
  export declare function RecordAudit({ created, updated, }: {
15
36
  created?: RecordStamp;
@@ -1,27 +1,68 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { fillCopy, useUiCopy } from "../../foundations/copy.js";
3
+ import { useUiCopy } from "../../foundations/copy.js";
4
+ import { byDensity, useDensity } from "../../foundations/density.js";
5
+ import { DateValue } from "../../primitives/value/DateValue.js";
6
+ import { UserChip } from "../../primitives/value/Person.js";
7
+ import { isValidElement } from "react";
4
8
  /**
5
9
  * The last line of the paper: who created the record and who touched it last.
6
10
  *
7
11
  * Context: «¿quién cambió esto?» is the first question in front of a number that looks wrong,
8
12
  * and the activity's timeline answers it only for what was logged. Small and at the end: it is
9
- * consulted, not read.
13
+ * consulted, not read — so it is the quietest thing on the paper, below the facts, behind a
14
+ * rule.
15
+ *
16
+ * It was one run-on sentence («Creado por Josefa Muñoz · 02/09/2026») with the person as bare
17
+ * text and the date in whatever shape the app sent. It is now the record's own grammar: a
18
+ * muted label and its value, the person as the chip every other person-field uses and the date
19
+ * as `DateValue` — so the footer reads like the form above it, not like a log line.
20
+ *
21
+ * Its side padding follows the density: the compact body (a dialog, a card) has none, and a
22
+ * footer with `px-4` stood out of the column of fields it closes.
10
23
  */
11
24
  export function RecordAudit({ created, updated, }) {
12
25
  const copy = useUiCopy();
13
- const stamp = (template, one) => {
14
- const [before, middle, after] = splitStamp(template);
15
- return (_jsxs("span", { children: [before, _jsx("span", { className: "text-ink", children: one.by }), middle, _jsx("span", { className: "tabular-nums", children: one.at }), after] }));
16
- };
26
+ const d = useDensity();
17
27
  if (created === undefined && updated === undefined)
18
28
  return null;
19
- return (_jsxs("p", { className: "flex flex-wrap gap-x-4 gap-y-1 border-t border-line px-4 py-2.5 text-micro text-muted", children: [created === undefined ? null : stamp(copy.record.created, created), updated === undefined ? null : stamp(copy.record.updated, updated)] }));
29
+ return (_jsxs("dl", { className: `flex min-w-0 flex-wrap items-center gap-x-6 gap-y-1.5 border-t border-line ${byDensity(d, "px-4 py-2.5", "py-2")}`, children: [created === undefined ? null : _jsx(Stamp, { label: copy.record.created, stamp: created }), updated === undefined ? null : _jsx(Stamp, { label: copy.record.updated, stamp: updated })] }));
30
+ }
31
+ function Stamp({ label, stamp }) {
32
+ return (_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("dt", { className: "shrink-0 text-micro text-muted", children: label }), _jsxs("dd", { className: "flex min-w-0 items-center gap-2", children: [_jsx(Author, { by: stamp.by }), _jsx(Moment, { at: stamp.at })] })] }));
33
+ }
34
+ /** Blank, or the dash an application wrote for «nobody» (`by ?? "—"`, from when `by` was
35
+ * required): a chip would draw it as a face with «—» for initials. */
36
+ const NOBODY = /^[\s\-–—]*$/;
37
+ function Author({ by }) {
38
+ if (by === undefined || by === null || typeof by === "boolean")
39
+ return null;
40
+ if (typeof by === "string") {
41
+ return NOBODY.test(by) ? null : _jsx(UserChip, { name: by, size: "sm" });
42
+ }
43
+ if (isChipProps(by))
44
+ return _jsx(UserChip, { size: "sm", ...by });
45
+ return _jsx("span", { className: "min-w-0 text-meta text-ink", children: by });
46
+ }
47
+ /** The chip's props are a plain object with a name; a React element also is an object, and
48
+ * a node the application drew is passed through untouched. */
49
+ function isChipProps(by) {
50
+ return (typeof by === "object" &&
51
+ by !== null &&
52
+ !isValidElement(by) &&
53
+ !Array.isArray(by) &&
54
+ typeof by.name === "string");
20
55
  }
21
- /** «Creado por {by} · {at}» cut around its two holes, so `by` and `at` can be nodes. */
22
- function splitStamp(template) {
23
- const marked = fillCopy(template, { by: "\u0000", at: "\u0001" });
24
- const [before = "", rest = ""] = marked.split("\u0000");
25
- const [middle = "", after = ""] = rest.split("\u0001");
26
- return [before, middle, after];
56
+ /** A date-only string (`2026-09-02`) is a day: its hour would be an invented midnight. */
57
+ const DAY_ONLY = /^\d{4}-\d{2}-\d{2}$/;
58
+ /** What a backend sends for a moment: `2026-09-02`, `2026-09-02T11:40:00Z`, `2026-09-02 11:40`. */
59
+ const ISO = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
60
+ function Moment({ at }) {
61
+ if (at instanceof Date || typeof at === "number") {
62
+ return _jsx(DateValue, { when: at, format: "exact" });
63
+ }
64
+ if (typeof at === "string" && ISO.test(at)) {
65
+ return (_jsx(DateValue, { when: DAY_ONLY.test(at) ? at : at.replace(" ", "T"), format: DAY_ONLY.test(at) ? "date" : "exact" }));
66
+ }
67
+ return _jsx("span", { className: "text-meta whitespace-nowrap tabular-nums text-muted", children: at });
27
68
  }
@@ -4,7 +4,7 @@ import type { Surface, Tone } from "../../foundations/types.js";
4
4
  import type { LucideIcon } from "lucide-react";
5
5
  import { type ReactNode } from "react";
6
6
  export type { Surface };
7
- export declare function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface, smart, aspects, dirty, activity, activityLayout, width, ribbon, blocking, indicator, children, }: {
7
+ export declare function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Icon, title, subtitle, tag, figure, railSurface, smart, aspects, dirty, activity, activityLayout, width, ribbon, blocking, indicator, paper: onPaper, children, }: {
8
8
  crumbs?: readonly Crumb[];
9
9
  pager?: ReactNode;
10
10
  /** The action buttons. At most three visible + a `Menu` with `iconOnly`, and
@@ -75,6 +75,10 @@ export declare function RecordHeader({ crumbs, pager, actions, status, kicker, i
75
75
  /** The rest of the record's notices, as one indicator — `RecordNoticeIndicator`. In the
76
76
  * rail next to the counters; without a rail, first in the record, next to them. */
77
77
  indicator?: ReactNode;
78
+ /** Whether the record sits on paper — a fact of WHERE it is mounted (`Record`'s
79
+ * `placement`). Only in comfortable: compact (the peek) is always one surface. Omitted, it
80
+ * is guessed from the rail: crumbs, pager or actions mean a page. */
81
+ paper?: boolean;
78
82
  /** The record body. It sits IN the paper with the title, so groups, tabs
79
83
  * and the page are one white sheet on the ground — Odoo's `<sheet>`. */
80
84
  children?: ReactNode;
@@ -8,7 +8,7 @@ import { SurfaceProvider } from "../../foundations/surface.js";
8
8
  import { Line } from "../../primitives/block/Line.js";
9
9
  import { Tag } from "../../primitives/tag/Tag.js";
10
10
  import { useEffect, useRef } from "react";
11
- 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, children, }) {
11
+ 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, children, }) {
12
12
  const d = useDensity();
13
13
  /* «Guardado» is said where Save was; a record whose rail exists only while it has changes
14
14
  keeps it for that moment, or the answer would leave with the question. */
@@ -62,8 +62,14 @@ export function RecordHeader({ crumbs, pager, actions, status, kicker, icon: Ico
62
62
  is mounted, and that does not change while someone types; `dirty` does, with the first
63
63
  letter. Deciding by it swapped the whole tree under the paper at that letter — the field
64
64
  being written was unmounted and lost the focus. Save and Discard still appear: in the
65
- rail, which is a sibling and moves nothing. */
66
- const paper = withRail && (crumbs !== undefined || pager !== undefined || actions !== undefined);
65
+ rail, which is a sibling and moves nothing.
66
+
67
+ Crumbs, pager and actions are only the GUESS for when the mount is not said: they can
68
+ arrive late (loaded, allowed) and the guess flips with them. `paper`, when given, is the
69
+ answer — the rail's contents no longer decide it. */
70
+ const paper = onPaper === undefined
71
+ ? withRail && (crumbs !== undefined || pager !== undefined || actions !== undefined)
72
+ : onPaper && d === "comfortable";
67
73
  /* ONE column for the rail and the page: the rail used to span the screen while the sheet
68
74
  stopped at 72rem, so on a wide desk the buttons sat 250 px left of the paper they act on
69
75
  and the record read as two things. */
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { blankGroup, ExpressionView, treeFromFilter, treeToFilter, WhereTree, } from "./FilterBuilder.js";
4
- import { JsonEditor } from "./JsonEditor.js";
4
+ import { LazyJsonEditor } from "./LazyJsonEditor.js";
5
5
  import { filterableNames, } from "./model.js";
6
6
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
7
7
  import { GRAIN_ORDER } from "../../foundations/grouping.js";
@@ -274,5 +274,5 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
274
274
  return (_jsx("button", { type: "button", onClick: () => push({
275
275
  fields: chosen ? fields.filter((one) => one !== name) : [...fields, name],
276
276
  }), className: `rounded-pill border px-2 py-0.5 text-micro ${chosen ? "border-accent/40 bg-accent/18 text-ink" : `text-muted ${box}`}`, children: name }, name));
277
- }) })] }), _jsx(JsonEditor, { value: rawText, onChange: updateRaw, error: rawError, height: "14rem", label: copy.builder.json }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { role: "primary", disabled: rawError !== null, onClick: () => onApply(rawText.trim() === "" ? undefined : JSON.parse(rawText)), children: copy.builder.apply }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.builder.cancel }))] })] }));
277
+ }) })] }), _jsx(LazyJsonEditor, { value: rawText, onChange: updateRaw, error: rawError, height: "14rem", label: copy.builder.json }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { role: "primary", disabled: rawError !== null, onClick: () => onApply(rawText.trim() === "" ? undefined : JSON.parse(rawText)), children: copy.builder.apply }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.builder.cancel }))] })] }));
278
278
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { JoinWord } from "./JoinWord.js";
4
- import { JsonEditor } from "./JsonEditor.js";
4
+ import { LazyJsonEditor } from "./LazyJsonEditor.js";
5
5
  import { fieldLabel, filterableNames, } from "./model.js";
6
6
  import { opLabel, sayCondition } from "./query.js";
7
7
  import { currentCopy, fillCopy, useUiCopy } from "../../foundations/copy.js";
@@ -417,5 +417,5 @@ export function FilterBuilder({ model, initial, onApply, onCancel, }) {
417
417
  setLockedView(parsed);
418
418
  }
419
419
  }
420
- return (_jsxs("div", { className: "flex min-w-0 flex-col gap-3 p-3", children: [_jsx("div", { className: "max-h-80 min-w-0 overflow-auto", children: lockedView !== null ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-meta text-muted", children: copy.search.unreadable }), _jsx(ExpressionView, { node: lockedView, model: model })] })) : (_jsx(WhereTree, { model: model, group: tree, onChange: updateTree })) }), _jsx(JsonEditor, { value: rawText, onChange: updateRaw, error: rawError, label: copy.builder.jsonFilter }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { role: "primary", disabled: rawError !== null, onClick: () => onApply(rawText.trim() === "" ? undefined : JSON.parse(rawText)), children: copy.builder.add }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.builder.cancel }))] })] }));
420
+ return (_jsxs("div", { className: "flex min-w-0 flex-col gap-3 p-3", children: [_jsx("div", { className: "max-h-80 min-w-0 overflow-auto", children: lockedView !== null ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-meta text-muted", children: copy.search.unreadable }), _jsx(ExpressionView, { node: lockedView, model: model })] })) : (_jsx(WhereTree, { model: model, group: tree, onChange: updateTree })) }), _jsx(LazyJsonEditor, { value: rawText, onChange: updateRaw, error: rawError, label: copy.builder.jsonFilter }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { role: "primary", disabled: rawError !== null, onClick: () => onApply(rawText.trim() === "" ? undefined : JSON.parse(rawText)), children: copy.builder.add }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.builder.cancel }))] })] }));
421
421
  }
@@ -0,0 +1,5 @@
1
+ import type { JsonEditor } from "./JsonEditor.js";
2
+ import { type ComponentProps } from "react";
3
+ /** `JsonEditor`, loaded when it is drawn. Until it arrives, a box of the editor's size holds
4
+ * the place so the dialog does not jump. */
5
+ export declare function LazyJsonEditor(props: ComponentProps<typeof JsonEditor>): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { lazy, Suspense } from "react";
4
+ /* CodeMirror (≈420 KB minified) is its own chunk: fetched the first time a builder is
5
+ OPENED, never by a screen that only has a search bar. The builders are dialogs nobody
6
+ opens on most visits, and they were paying for the editor on every one. */
7
+ const Editor = lazy(() => import("./JsonEditor.js").then((module) => ({
8
+ default: module.JsonEditor,
9
+ })));
10
+ /** `JsonEditor`, loaded when it is drawn. Until it arrives, a box of the editor's size holds
11
+ * the place so the dialog does not jump. */
12
+ export function LazyJsonEditor(props) {
13
+ return (_jsx(Suspense, { fallback: _jsx("div", { "aria-busy": "true", className: "h-64 w-full min-w-0 animate-reveal-late rounded-control border border-line-strong bg-ground" }), children: _jsx(Editor, { ...props }) }));
14
+ }
@@ -88,7 +88,8 @@ export type UiCopy = {
88
88
  noticeMany: string;
89
89
  /** The accessible name of the band of what is wrong with the record. */
90
90
  blocking: string;
91
- /** The paper's last line (`Record.Audit`): «{by}» and «{at}» are already written. */
91
+ /** The labels of the paper's last line (`Record.Audit`): the person and the moment are
92
+ * drawn beside them as values, so they are names, not sentences with holes. */
92
93
  created: string;
93
94
  updated: string;
94
95
  };
@@ -83,8 +83,8 @@ export const SPANISH_COPY = {
83
83
  noticeOne: "{count} aviso",
84
84
  noticeMany: "{count} avisos",
85
85
  blocking: "Lo que está mal en este registro",
86
- created: "Creado por {by} · {at}",
87
- updated: "Modificado por última vez por {by} · {at}",
86
+ created: "Creado",
87
+ updated: "Última modificación",
88
88
  },
89
89
  shell: {
90
90
  close: "Cerrar",
@@ -59,8 +59,8 @@ export const ENGLISH_COPY = {
59
59
  noticeOne: "{count} notice",
60
60
  noticeMany: "{count} notices",
61
61
  blocking: "What is wrong with this record",
62
- created: "Created by {by} · {at}",
63
- updated: "Last changed by {by} · {at}",
62
+ created: "Created",
63
+ updated: "Last changed",
64
64
  },
65
65
  shell: {
66
66
  modules: "All modules",
@@ -1,7 +1,5 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { RecordCalendar } from "../../components/calendar/RecordCalendar.js";
4
- import { RecordGantt } from "../../components/gantt/RecordGantt.js";
5
3
  import { BoardColumns } from "../../components/listing/BoardColumns.js";
6
4
  import { useColumnControl, visibleColumns } from "../../components/listing/columns.js";
7
5
  import { ColumnsMenu, specsFromColumns, } from "../../components/listing/ColumnsMenu.js";
@@ -28,7 +26,17 @@ import { groupLevelsOf, reportColumnsOf, reportRowsOf, sheetFromColumns, sheetRo
28
26
  import { SheetPresentation, TablePresentation, } from "./presentations.js";
29
27
  import { useNarrowList } from "./useNarrowList.js";
30
28
  import { CalendarDays, CalendarRange, ChartGantt, Grid3x3, LayoutGrid, List, Sheet, Sigma, Table2, } from "lucide-react";
31
- import { Fragment, useCallback, useMemo } from "react";
29
+ import { Fragment, lazy, Suspense, useCallback, useMemo } from "react";
30
+ /* The calendar (FullCalendar) and the gantt (SVAR) are each about a third of a list's weight,
31
+ and most lists never show either face. Each is its own chunk, fetched the first time its
32
+ face is SHOWN. `lazy` erases the generic, so the eager signature is put back: the props
33
+ are checked exactly as before. */
34
+ const RecordCalendar = lazy(() => import("../../components/calendar/RecordCalendar.js").then((module) => ({
35
+ default: module.RecordCalendar,
36
+ })));
37
+ const RecordGantt = lazy(() => import("../../components/gantt/RecordGantt.js").then((module) => ({
38
+ default: module.RecordGantt,
39
+ })));
32
40
  /**
33
41
  * EL DIBUJO de una lista. **La puerta es `List`**, que se escribe como árbol y
34
42
  * traduce las ranuras a esto — acá todo entra como props porque acá ya se
@@ -324,7 +332,7 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
324
332
  orden —cada eje viene en el orden de sus claves— y no hay menú de
325
333
  columnas, porque las columnas son un eje y no una lista de campos que
326
334
  se puedan esconder de a uno. */
327
- _jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
335
+ _jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
328
336
  /* El encabezado va ANTES de los montones y no adentro de cada uno:
329
337
  rotula la fila, y la fila es la misma en los cinco montones. */
330
338
  _jsxs(_Fragment, { children: [rowHeader === undefined || items.length === 0 ? null : (_jsx(RowHeader, { name: rowHeader.name, ...(rowHeader.meta === undefined ? {} : { meta: rowHeader.meta }), ...(rowHeader.tags === undefined ? {} : { tags: rowHeader.tags }), withSelection: selection !== undefined,
@@ -131,9 +131,23 @@ export type RecordProps = {
131
131
  /** Hay cambios sin guardar. Su presencia REEMPLAZA los botones de acción por
132
132
  * guardar y descartar — ver la nota en `RecordHeader`. */
133
133
  dirty?: DirtyState;
134
+ /**
135
+ * Where the record is mounted — and so whether it sits on paper.
136
+ *
137
+ * page on the ground, on a white sheet (Odoo's `<sheet>`): the record owns the
138
+ * screen, the workspace's page or a panel.
139
+ * card one surface, no ground: the record is already inside a card — a modal, a
140
+ * window. In compact density (the peek) it is always this.
141
+ *
142
+ * Say it whenever the mount is known (in the composer, `api.surface`): it is a fact of
143
+ * WHERE the record is, and it does not change while the record is on screen. Omitted, the
144
+ * sheet is guessed from the rail — crumbs, pager or actions mean a page — which flips the
145
+ * whole tree under the paper the moment one of them appears or goes away.
146
+ */
147
+ placement?: "page" | "card";
134
148
  children?: ReactNode;
135
149
  };
136
- export declare function Record({ identity, error, dirty, children }: RecordProps): import("react").JSX.Element;
150
+ export declare function Record({ identity, error, dirty, placement, children }: RecordProps): import("react").JSX.Element;
137
151
  export declare namespace Record {
138
152
  var Skeleton: typeof RecordSkeleton;
139
153
  var Rail: ((props: RailProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"rail">;
@@ -72,7 +72,7 @@ const Page = slot("page", (_props) => null);
72
72
  function NotebookScope({ tabs, children }) {
73
73
  return tabs ? _jsx(TabsScope, { children: children }) : children;
74
74
  }
75
- export function Record({ identity, error = null, dirty, children }) {
75
+ export function Record({ identity, error = null, dirty, placement, children }) {
76
76
  const d = useDensity();
77
77
  const copy = useUiCopy();
78
78
  const top = flatten(children);
@@ -90,9 +90,13 @@ export function Record({ identity, error = null, dirty, children }) {
90
90
  const status = propsOf(pick(rail, "status"));
91
91
  /* Las dos preguntas del estado, con la superficie ya resuelta: «¿dónde
92
92
  está?» y «¿qué pasó para llegar acá?». */
93
+ /* The same question `RecordHeader` asks to draw the rail (`status` included): asked
94
+ differently here, a record with only a status drew a `chrome` rail light until the first
95
+ keystroke, and dark from then on. */
93
96
  const onTheRail = crumbs !== undefined ||
94
97
  pager !== undefined ||
95
98
  actions !== undefined ||
99
+ status !== undefined ||
96
100
  dirty !== undefined;
97
101
  const railSurface = propsOf(railNode)?.surface ?? "canvas";
98
102
  const surface = onTheRail && d === "comfortable" ? railSurface : "canvas";
@@ -170,7 +174,7 @@ export function Record({ identity, error = null, dirty, children }) {
170
174
  shorter than the screen. The extra height has no paint of its own: on a desk
171
175
  nothing changes. */
172
176
  /* The record knows the notes of its fields and rows: their cards register here. */
173
- _jsx(NoteRegistryContext, { value: registry, children: _jsx("article", { className: "flex min-w-0 flex-1 flex-col", children: _jsx(NotebookScope, { tabs: tabs.length > 0, children: _jsx(RecordHeader, { railSurface: surface, ...(ribbon === undefined
177
+ _jsx(NoteRegistryContext, { value: registry, children: _jsx("article", { className: "flex min-w-0 flex-1 flex-col", children: _jsx(NotebookScope, { tabs: tabs.length > 0, children: _jsx(RecordHeader, { railSurface: surface, ...(placement === undefined ? {} : { paper: placement === "page" }), ...(ribbon === undefined
174
178
  ? {}
175
179
  : {
176
180
  ribbon: (_jsx(RecordRibbon, { label: ribbon.label, ...(ribbon.tone === undefined ? {} : { tone: ribbon.tone }) })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-ui",
3
- "version": "1.7.2",
3
+ "version": "1.9.0",
4
4
  "description": "An enterprise web design system for business software — ERPs, back offices, management tools — in React and Tailwind: tokens, primitives, components and the two views every management screen is made of.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",