@sincpro/web-ui 2.18.0 → 2.19.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 (69) hide show
  1. package/README.md +6 -4
  2. package/dist/components/calendar/RecordCalendar.js +1 -1
  3. package/dist/components/flow/SetupCard.d.ts +21 -0
  4. package/dist/components/flow/SetupCard.js +16 -0
  5. package/dist/components/flow/index.d.ts +1 -0
  6. package/dist/components/flow/index.js +3 -0
  7. package/dist/components/form/Form.js +7 -5
  8. package/dist/components/listing/Pagination.js +28 -3
  9. package/dist/components/listing/Row.d.ts +5 -2
  10. package/dist/components/listing/Row.js +6 -5
  11. package/dist/components/listing/modelCells.js +1 -1
  12. package/dist/components/navigation/NavigationTree.d.ts +3 -0
  13. package/dist/components/navigation/NavigationTree.js +2 -1
  14. package/dist/components/record/ActionDock.d.ts +10 -3
  15. package/dist/components/record/ActionDock.js +15 -8
  16. package/dist/components/record/DirtyActions.d.ts +15 -7
  17. package/dist/components/record/DirtyActions.js +37 -13
  18. package/dist/components/record/DockMessage.d.ts +18 -0
  19. package/dist/components/record/DockMessage.js +31 -0
  20. package/dist/components/record/dock.d.ts +25 -0
  21. package/dist/components/record/index.d.ts +2 -1
  22. package/dist/components/record/index.js +1 -0
  23. package/dist/components/shell/Page.d.ts +12 -0
  24. package/dist/components/shell/Page.js +12 -0
  25. package/dist/components/shell/Sidebar.d.ts +22 -3
  26. package/dist/components/shell/Sidebar.js +88 -10
  27. package/dist/components/shell/index.d.ts +1 -0
  28. package/dist/components/shell/index.js +2 -0
  29. package/dist/foundations/copy.es.js +5 -0
  30. package/dist/foundations/grouping.d.ts +37 -0
  31. package/dist/foundations/grouping.js +0 -0
  32. package/dist/foundations/index.d.ts +1 -1
  33. package/dist/foundations/index.js +1 -1
  34. package/dist/foundations/uiCopy.d.ts +10 -0
  35. package/dist/foundations/uiCopy.js +5 -0
  36. package/dist/primitives/button/Button.d.ts +5 -1
  37. package/dist/primitives/button/Button.js +4 -4
  38. package/dist/primitives/button/classes.d.ts +1 -8
  39. package/dist/primitives/button/classes.js +12 -2
  40. package/dist/primitives/menu/Menu.d.ts +22 -1
  41. package/dist/primitives/menu/Menu.js +44 -18
  42. package/dist/primitives/table/DataTable.d.ts +16 -1
  43. package/dist/primitives/table/DataTable.js +62 -22
  44. package/dist/primitives/table/EditableTable.js +6 -7
  45. package/dist/primitives/table/PileFootLine.d.ts +4 -2
  46. package/dist/primitives/table/PileFootLine.js +16 -5
  47. package/dist/primitives/table/ReportTable.js +2 -2
  48. package/dist/primitives/table/RowActions.js +1 -1
  49. package/dist/primitives/table/SheetTable.d.ts +19 -1
  50. package/dist/primitives/table/SheetTable.js +22 -2
  51. package/dist/primitives/table/Table.js +9 -6
  52. package/dist/primitives/table/index.d.ts +1 -1
  53. package/dist/primitives/table/index.js +1 -1
  54. package/dist/primitives/tabs/Tabs.d.ts +21 -1
  55. package/dist/primitives/tabs/Tabs.js +26 -7
  56. package/dist/primitives/tabs/index.d.ts +1 -1
  57. package/dist/primitives/tag/Tag.d.ts +5 -0
  58. package/dist/primitives/tag/Tag.js +2 -1
  59. package/dist/primitives/tag/Tags.js +1 -1
  60. package/dist/primitives/value/Avatar.d.ts +7 -3
  61. package/dist/primitives/value/Avatar.js +17 -11
  62. package/dist/primitives/value/Person.js +9 -3
  63. package/dist/primitives/value/Value.js +4 -1
  64. package/dist/views/list/ListView.js +27 -7
  65. package/dist/views/list/derive.d.ts +15 -3
  66. package/dist/views/list/derive.js +48 -6
  67. package/dist/views/list/presentations.js +2 -1
  68. package/dist/views/list/types.d.ts +5 -1
  69. package/package.json +1 -1
package/README.md CHANGED
@@ -359,7 +359,7 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
359
359
  `kiosk.content`, `kiosk.reach`, `board.tile`,
360
360
  `board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `file-value`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`, `search.facet-mark`,
361
361
  `search.panel`, `search.suggestions`, `search.suggestion`, `search.record`, `search.recent`,
362
- `search.advanced`, `search.keys`, `search.completion`, `search.undo`, `search.slash`, `search-entry`, `search-entry.keys`, `table`, `table.pile`, `yes-no`,
362
+ `search.advanced`, `search.keys`, `search.completion`, `search.undo`, `search.slash`, `search-entry`, `search-entry.keys`, `table`, `table.pile`, `list.pile`, `yes-no`,
363
363
  `table.head`, `table.grip`, `row.ways`, `topbar`, `topbar.brand`, `topbar.menus`, `topbar.actions`, `topbar.user`,
364
364
  `frame`, `frame.banner`, `frame.bar`, `frame.sidebar`, `frame.main`, `banner`, `banner.action`,
365
365
  `inbox`, `inbox.item` (with `data-unread`), `kbd`, `plans`, `plan` (with `data-highlight`, `data-current`), `plan.highlight`, `plan.price`,
@@ -371,9 +371,11 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
371
371
  `story-viewer.media`, `notification-bell`, `notification-panel`, `notification-panel.group`,
372
372
  `notification-panel.item` (with `data-unread`), `portal-nav`, `portal-nav.person`, `portal-nav.toggle`,
373
373
  `portal-nav.sections`, `check-field`, `file-preview.video`, `file-preview.audio`, `file-preview.office` (with `data-kind`), `sidebar`, `sidebar.brand`,
374
- `sidebar.user`, `sidebar.search`, `sidebar.nav`, `sidebar.account`, `navigation`,
375
- `navigation.item`, `dirty.blocked`, `dirty.bar`, `field`, `field.label`, `form.section`,
376
- `form.index`, `dock`, `dock.pill`, `dock.bare`, `pager`, `pagination`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
374
+ `sidebar.user`, `sidebar.me` (the person at the foot, `account="menu"`), `sidebar.search`,
375
+ `sidebar.nav`, `sidebar.account`, `navigation`, `navigation.item`, `menu.header`, `tabs` (with
376
+ `data-look`), `tabs.tab`, `dirty.blocked`, `dirty.bar`, `field`, `field.label`, `form.section`,
377
+ `form.card`, `form.index`, `dock`, `dock.pill`, `dock.bare`, `dock.message` (with `data-tone`),
378
+ `setup`, `setup.step`, `setup.reason`, `setup.preview`, `page`, `pager`, `pagination`, `smart`, `guide`, `guide.veil`, `guide.spot`, `guide.card`,
377
379
  `guide.progress`, `guide.title`, `guide.body`, `guide.actions`. A part that is one of many
378
380
  carries `data-key` too (`navigation.item`). Put your rules in a cascade layer above web-ui's, or
379
381
  outside any layer.
@@ -66,7 +66,7 @@ export function RecordCalendar({ items, keyOf, titleOf, startOf, endOf, allDayOf
66
66
  return renderEvent(item, info.timeText);
67
67
  const person = avatarOf?.(item);
68
68
  const meta = metaOf?.(item);
69
- return (_jsxs("span", { className: "flex min-w-0 items-start gap-1.5 px-0.5 py-px", children: [person === undefined ? null : (_jsx(Avatar, { name: person.name, size: "sm", ...(person.src === undefined ? {} : { src: person.src }) })), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsxs("span", { className: "min-w-0 truncate", children: [info.timeText === "" ? null : (_jsxs("b", { className: "font-semibold tabular-nums", children: [info.timeText, " "] })), titleOf(item)] }), meta === undefined ? null : (_jsx("span", { className: "min-w-0 truncate opacity-80", children: meta }))] })] }));
69
+ return (_jsxs("span", { className: "flex min-w-0 items-start gap-1.5 px-0.5 py-px", children: [person === undefined ? null : (_jsx(Avatar, { name: person.name, size: "xs", ...(person.src === undefined ? {} : { src: person.src }) })), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsxs("span", { className: "min-w-0 truncate", children: [info.timeText === "" ? null : (_jsxs("b", { className: "font-semibold tabular-nums", children: [info.timeText, " "] })), titleOf(item)] }), meta === undefined ? null : (_jsx("span", { className: "min-w-0 truncate opacity-80", children: meta }))] })] }));
70
70
  };
71
71
  const moved = (info) => {
72
72
  const item = byId.get(info.event.id);
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from "react";
2
+ export type SetupCardProps = {
3
+ /** Where this card stands in the path: «Paso 1 de 2 · Conectar Slack». */
4
+ step?: {
5
+ index: number;
6
+ total: number;
7
+ label?: string;
8
+ };
9
+ /** What it does for the person, as a sentence: «Trabaja desde un hilo de Slack.» */
10
+ title: string;
11
+ /** The reason, in a paragraph or two (`<p>`). */
12
+ children?: ReactNode;
13
+ /** The ONE thing to do: a primary `Button`, at the foot of the reason. */
14
+ action: ReactNode;
15
+ /** What it will look like once it is on: any composition of the system. */
16
+ preview: ReactNode;
17
+ /** Under the preview, what the person is looking at: «El asistente lee la alerta y
18
+ * propone el arreglo dentro de Slack.» */
19
+ caption?: string;
20
+ };
21
+ export declare function SetupCard({ step, title, children, action, preview, caption, }: SetupCardProps): 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 { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
+ import { useId } from "react";
5
+ export function SetupCard({ step, title, children, action, preview, caption, }) {
6
+ const copy = useUiCopy();
7
+ const titleId = useId();
8
+ const where = step === undefined
9
+ ? undefined
10
+ : fillCopy(step.label === undefined ? copy.stepFlow.position : copy.stepFlow.where, {
11
+ index: String(step.index),
12
+ total: String(step.total),
13
+ label: step.label ?? "",
14
+ });
15
+ return (_jsxs("section", { "data-ui": "setup", "aria-labelledby": titleId, className: "@container flex min-w-0 flex-col gap-2 rounded-ui-card border border-ui-card-border bg-ground p-2", children: [where === undefined ? null : (_jsx("p", { "data-ui": "setup.step", className: "px-3 pt-1 text-micro text-muted", children: where })), _jsxs("div", { className: "flex min-w-0 flex-col gap-2 @3xl:flex-row", children: [_jsxs("div", { "data-ui": "setup.reason", className: "flex min-w-0 flex-col gap-6 rounded-ui-card border border-ui-card-border bg-surface p-8 @3xl:flex-3", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [_jsx("h2", { id: titleId, className: "text-display font-semibold text-balance text-ink", children: title }), children === undefined ? null : (_jsx("div", { className: "flex max-w-prose flex-col gap-3 text-body text-muted", children: children }))] }), _jsx("div", { className: "mt-auto flex min-w-0 flex-col *:w-full", children: action })] }), _jsxs("figure", { "data-ui": "setup.preview", className: "flex min-w-0 flex-col overflow-clip rounded-ui-card border border-ui-card-border bg-surface @3xl:flex-4", children: [_jsx("div", { className: "min-h-0 flex-1", children: preview }), caption === undefined ? null : (_jsx("figcaption", { className: "border-t border-line px-4 py-3 text-micro text-muted", children: caption }))] })] })] }));
16
+ }
@@ -1 +1,2 @@
1
1
  export { StepFlow, type StepFlowProps, type StepFlowStepProps, } from "./StepFlow.js";
2
+ export { SetupCard, type SetupCardProps } from "./SetupCard.js";
@@ -1,2 +1,5 @@
1
1
  /* One operation in several steps, done in one sitting — import: upload › map › review. */
2
2
  export { StepFlow, } from "./StepFlow.js";
3
+ /* Turning something on, with the result in sight — connect an integration: the reason and the
4
+ one action beside a preview of what changes. */
5
+ export { SetupCard } from "./SetupCard.js";
@@ -33,11 +33,13 @@ export function FormSection({ title, hint, status, actions, columns = 1, childre
33
33
  hint !== undefined ||
34
34
  actions !== undefined;
35
35
  if (settings) {
36
- /* «settings»: the section is a card of rows, one under the other, a hairline between
37
- them — `columns` does not apply, a row already has its two. Its help is written under
38
- the title, like a field's under its label. `@container`: each row measures the card
39
- to decide whether its label still fits beside the control (`grid-setting`). */
40
- return (_jsxs("section", { ...(indexed === undefined ? {} : { id: indexed }), "data-ui": "form.section", className: "@container flex min-w-0 scroll-mt-3 flex-col gap-1 rounded-ui-card border border-ui-card-border bg-ui-card px-5 py-4", children: [withHeader ? (_jsxs("header", { className: "flex min-w-0 flex-wrap items-start gap-x-2.5 gap-y-1 pb-2", children: [title === undefined && hint === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [title === undefined ? null : (_jsx("h2", { className: "min-w-0 text-title font-semibold text-ink", children: title })), hint === undefined ? null : (_jsx("p", { className: "max-w-prose text-micro text-muted", children: hint }))] })), status === undefined ? null : _jsx(Tag, { tone: status.tone, children: status.label }), actions === undefined ? null : (_jsx("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: actions }))] })) : null, _jsx("div", { className: "flex min-w-0 flex-col divide-y divide-line *:py-3.5 *:first:pt-0 *:last:pb-0", children: children })] }));
36
+ /* «settings»: the section is a TITLE over a card of rows, one under the other, a hairline
37
+ between them — `columns` does not apply, a row already has its two. The title and its
38
+ help sit above the card, on the ground: the card holds only what is answered, so a page
39
+ of five cards reads as five named blocks and not as five boxes that each start with a
40
+ heading. `@container`: each row measures the card to decide whether its label still
41
+ fits beside the control (`grid-setting`). */
42
+ return (_jsxs("section", { ...(indexed === undefined ? {} : { id: indexed }), "data-ui": "form.section", className: "flex min-w-0 scroll-mt-3 flex-col gap-2.5", children: [withHeader ? (_jsxs("header", { className: "flex min-w-0 flex-wrap items-end gap-x-2.5 gap-y-1", children: [title === undefined && hint === undefined ? null : (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [title === undefined ? null : (_jsx("h2", { className: "min-w-0 text-title font-semibold text-ink", children: title })), hint === undefined ? null : (_jsx("p", { className: "max-w-prose text-meta text-muted", children: hint }))] })), status === undefined ? null : _jsx(Tag, { tone: status.tone, children: status.label }), actions === undefined ? null : (_jsx("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: actions }))] })) : null, _jsx("div", { "data-ui": "form.card", className: "@container flex min-w-0 flex-col divide-y divide-line rounded-ui-card border border-ui-card-border bg-ui-card px-5 *:py-3.5", children: children })] }));
41
43
  }
42
44
  if (sections) {
43
45
  /* «sections»: the settings' card, the dense sheet's body — label | value in its columns,
@@ -6,7 +6,7 @@ import { byDensity, useDensity } from "../../foundations/density.js";
6
6
  import { bySurface, useSurface } from "../../foundations/surface.js";
7
7
  import { useViewStyle } from "../../foundations/viewStyle.js";
8
8
  import { ChevronLeft, ChevronRight } from "lucide-react";
9
- import { useId, useState } from "react";
9
+ import { useEffect, useId, useRef, useState } from "react";
10
10
  /* ---------------------------------------------------------------- *
11
11
  * THE FOOTER AND ITS PAGINATION
12
12
  * ---------------------------------------------------------------- */
@@ -40,6 +40,15 @@ export function Pagination({ from, to, total, pageSize, pageSizes = PAGE_SIZES,
40
40
  const [editing, setEditing] = useState(false);
41
41
  const [draft, setDraft] = useState("");
42
42
  const listId = useId();
43
+ const range = useRef(null);
44
+ /* Back to the range once the size is set or dropped: the field goes away under the focus,
45
+ and a focus left on the page's body sends the next Tab to its first control. */
46
+ const wasEditing = useRef(false);
47
+ useEffect(() => {
48
+ if (wasEditing.current && !editing)
49
+ range.current?.focus();
50
+ wasEditing.current = editing;
51
+ }, [editing]);
43
52
  /* The modern style's position is the record's pager's: one translucent primary pill, so a
44
53
  list and a record say «where I am in the set» the same way. */
45
54
  const style = useViewStyle();
@@ -58,6 +67,9 @@ export function Pagination({ from, to, total, pageSize, pageSizes = PAGE_SIZES,
58
67
  ? [...pageSizes, pageSize]
59
68
  : pageSizes;
60
69
  function commitSize(raw) {
70
+ /* Enter commits and the field leaves; its blur on the way out must not commit twice. */
71
+ if (!editing)
72
+ return;
61
73
  const next = Number(raw);
62
74
  if (!Number.isFinite(next) || next < 1) {
63
75
  setEditing(false);
@@ -75,8 +87,21 @@ export function Pagination({ from, to, total, pageSize, pageSizes = PAGE_SIZES,
75
87
  }
76
88
  if (e.key === "Escape")
77
89
  setEditing(false);
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: () => {
90
+ }, "aria-label": copy.pager.size,
91
+ /* Inside the pill it is a pill: a square box there broke the one shape the
92
+ position has. */
93
+ className: `h-(--size-control-sm) w-24 border px-1.5 tabular-nums focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary ${pill
94
+ ? "rounded-pill px-2.5 text-meta font-semibold"
95
+ : "rounded-control text-micro"} ${bySurface(activeSurface, pill
96
+ ? "border-primary/30 bg-surface text-primary"
97
+ : "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", { ref: range, type: "button", onClick: () => {
79
98
  setDraft(String(pageSize));
80
99
  setEditing(true);
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 }) })] })] }));
100
+ }, title: fillCopy(copy.pager.sizeHint, { size: pageSize ?? 0 }),
101
+ /* Plain, the range says it is touchable with a dotted underline. In the pill an
102
+ underline read as a typo under a label: there it lights up like the arrows
103
+ beside it, which are the pill's other buttons. */
104
+ className: `transition-colors duration-(--duration-instant) ${strong} ${pill
105
+ ? `-mx-1.5 -my-1 rounded-pill px-1.5 py-1 ${bySurface(activeSurface, "hover:bg-primary/15", "hover:bg-chrome-link/20")}`
106
+ : `rounded-control underline decoration-dotted underline-offset-4 ${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 }) })] })] }));
82
107
  }
@@ -129,9 +129,12 @@ export declare function GroupHeader({ field, label, count, detail, depth, open,
129
129
  onToggle?: () => void;
130
130
  }): import("react").JSX.Element;
131
131
  /** Under a short pile: «Ver 50 más de 49.950», or «Se muestran 500 de 49.950» when there is
132
- * no next page. Indented like the pile's rows. */
133
- export declare function GroupMore({ foot, depth, onMore, }: {
132
+ * no next page — and after a short level of piles, «Ver 50 grupos más». Indented like the
133
+ * pile's rows. */
134
+ export declare function GroupMore({ foot, depth, onMore, of, }: {
134
135
  foot: PileFoot;
135
136
  depth?: number;
136
137
  onMore: () => void;
138
+ /** What it pages: the rows of a pile, or the piles of a level («Ver 50 grupos más»). */
139
+ of?: "rows" | "piles";
137
140
  }): import("react").JSX.Element;
@@ -132,7 +132,7 @@ export function RowHeader({ name, meta, tags, withSelection = false, withIcon =
132
132
  export function GroupHeader({ field, label, count, detail, depth = 0, open = true, onToggle, }) {
133
133
  const d = useDensity();
134
134
  const copy = useUiCopy();
135
- const content = (_jsxs(_Fragment, { children: [onToggle === undefined ? null : (_jsx(ChevronRight, { className: `size-(--size-icon-sm) shrink-0 text-muted transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true })), field === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro text-muted", children: field })), _jsx("span", { className: "truncate text-micro font-medium text-ink", children: label }), count === undefined ? null : (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-line-strong bg-ink/5 px-2 py-0.5 text-micro tabular-nums text-muted", children: count.toLocaleString(copy.locale) })), detail === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro tabular-nums text-muted", children: detail }))] }));
135
+ const content = (_jsxs(_Fragment, { children: [onToggle === undefined ? null : (_jsx(ChevronRight, { className: `size-(--size-icon-sm) shrink-0 text-muted transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true })), field === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro text-muted", children: field })), _jsx("span", { className: "truncate text-meta font-medium text-ink", children: label }), count === undefined ? null : (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-line-strong bg-ink/5 px-2 py-0.5 text-micro tabular-nums text-muted", children: count.toLocaleString(copy.locale) })), detail === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro tabular-nums text-muted", children: detail }))] }));
136
136
  /* The indentation goes in the left padding and not in a margin: the
137
137
  header has a background and a bottom border, and a margin would cut them before the
138
138
  list's edge — the band would stop reading as a stripe. The hover
@@ -140,11 +140,12 @@ export function GroupHeader({ field, label, count, detail, depth = 0, open = tru
140
140
  const box = `flex min-w-0 items-center gap-2 border-b border-line bg-ground ${byDensity(d, "px-3 py-1.5", "px-2.5 py-1")}`;
141
141
  const indent = depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` };
142
142
  const mark = (_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-1 inset-y-0.5 rounded-control group-hover/head:bg-ink/4" }));
143
- return onToggle === undefined ? (_jsx("div", { className: box, style: indent, children: content })) : (_jsxs("button", { type: "button", onClick: onToggle, "aria-expanded": open, style: indent, className: `group/head relative ${box} w-full text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary`, children: [mark, content] }));
143
+ return onToggle === undefined ? (_jsx("div", { "data-ui": "list.pile", className: box, style: indent, children: content })) : (_jsxs("button", { type: "button", "data-ui": "list.pile", onClick: onToggle, "aria-expanded": open, style: indent, className: `group/head relative ${box} w-full text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary`, children: [mark, content] }));
144
144
  }
145
145
  /** Under a short pile: «Ver 50 más de 49.950», or «Se muestran 500 de 49.950» when there is
146
- * no next page. Indented like the pile's rows. */
147
- export function GroupMore({ foot, depth = 0, onMore, }) {
146
+ * no next page — and after a short level of piles, «Ver 50 grupos más». Indented like the
147
+ * pile's rows. */
148
+ export function GroupMore({ foot, depth = 0, onMore, of = "rows", }) {
148
149
  const d = useDensity();
149
- return (_jsx("div", { className: `border-b border-line ${byDensity(d, "px-3 py-1", "px-2.5 py-0.5")}`, style: depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` }, children: _jsx(PileFootLine, { foot: foot, onMore: onMore }) }));
150
+ return (_jsx("div", { className: `border-b border-line ${byDensity(d, "px-3 py-1", "px-2.5 py-0.5")}`, style: depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` }, children: _jsx(PileFootLine, { foot: foot, onMore: onMore, of: of }) }));
150
151
  }
@@ -36,7 +36,7 @@ export function ModelCell({ kind, value, }) {
36
36
  case "duration":
37
37
  return typeof value === "number" ? (
38
38
  /* Right aligned like `Numeric`: a column of hours lines up by the colon. */
39
- _jsx("span", { className: "block text-right text-body tabular-nums whitespace-nowrap text-ink", children: formatDuration(value) })) : (_jsx(Plain, { text: text }));
39
+ _jsx("span", { className: "block text-right tabular-nums whitespace-nowrap text-ink", children: formatDuration(value) })) : (_jsx(Plain, { text: text }));
40
40
  case "boolean":
41
41
  return typeof value === "boolean" ? _jsx(YesNo, { value: value }) : _jsx(Plain, { text: text });
42
42
  case "date":
@@ -8,6 +8,9 @@ export interface NavItem {
8
8
  /** What is waiting there: drafts, overdue, to approve. Zero is not drawn — a «0» beside
9
9
  * every quiet screen is a column of noise the eye has to read to learn nothing. */
10
10
  count?: number;
11
+ /** A word about the place itself, not about what waits there: «Gratis en beta», «Configurar».
12
+ * Quiet, at the end of the row; a `count` says how many, this says what kind. */
13
+ badge?: string;
11
14
  children?: readonly NavItem[];
12
15
  }
13
16
  /**
@@ -5,6 +5,7 @@ import { useUiCopy } from "../../foundations/copy.js";
5
5
  import { useSurface } from "../../foundations/surface.js";
6
6
  import { focusRing, tv } from "../../foundations/variants.js";
7
7
  import { Count } from "../../primitives/tag/Count.js";
8
+ import { Tag } from "../../primitives/tag/Tag.js";
8
9
  import { ChevronRight } from "lucide-react";
9
10
  import { useMemo } from "react";
10
11
  import { Button as AriaButton, Link, NavigationTree as AriaNavigationTree, NavigationTreeItem as AriaNavigationTreeItem, NavigationTreeItemContent, RouterProvider, } from "react-aria-components";
@@ -100,7 +101,7 @@ export function NavigationTree({ items, current, onNavigate, defaultExpanded = [
100
101
  : undefined;
101
102
  return (_jsxs(AriaNavigationTreeItem, { "data-ui": "navigation.item", "data-key": item.id, id: item.id, textValue: item.label, ...(module ? {} : { href: item.id }), className: ({ isCurrent, isFocusVisible }) => row({ surface, isCurrent, isFocusVisible }), children: [_jsx(NavigationTreeItemContent, { children: ({ isCurrent, isCurrentAncestor, isExpanded }) => (_jsxs(_Fragment, { children: [isCurrent ? _jsx("span", { "aria-hidden": true, className: MARKER[surface] }) : null, _jsxs(Link, { className: link({ isModule: module }), style: indent, children: [Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${isCurrent || (isCurrentAncestor && !isExpanded)
102
103
  ? HERE[surface].here
103
- : HERE[surface].rest}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: `min-w-0 flex-1 truncate ${isCurrentAncestor && !isExpanded ? HERE[surface].here : ""}`, children: item.label }), item.count === undefined ? null : (_jsx(Count, { value: item.count, current: isCurrent }))] }), module ? (_jsx(AriaButton, { slot: "chevron", className: ({ isFocusVisible }) => chevronButton({ surface, isFocusVisible }), children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-quick) ease-(--ease-out) ${isExpanded ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }) })) : null] })) }), children.map((child) => render(child, level + 1))] }, item.id));
104
+ : HERE[surface].rest}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: `min-w-0 flex-1 truncate ${isCurrentAncestor && !isExpanded ? HERE[surface].here : ""}`, children: item.label }), item.badge === undefined ? null : (_jsx(Tag, { surface: surface === "chrome" ? "chrome" : "canvas", children: item.badge })), item.count === undefined ? null : (_jsx(Count, { value: item.count, current: isCurrent }))] }), module ? (_jsx(AriaButton, { slot: "chevron", className: ({ isFocusVisible }) => chevronButton({ surface, isFocusVisible }), children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-quick) ease-(--ease-out) ${isExpanded ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }) })) : null] })) }), children.map((child) => render(child, level + 1))] }, item.id));
104
105
  };
105
106
  return (_jsx(AriaLocale, { children: _jsx(RouterProvider, { navigate: (id) => onNavigate?.(id), useHref: (id) => `#${id}`, children: _jsx(AriaNavigationTree, { "data-ui": "navigation", "aria-label": label ?? copy.shell.menus, selectedRoute: current ?? null, defaultExpandedKeys: expanded, className: "flex w-full min-w-0 flex-col gap-px p-2 outline-0", children: items.map((item) => render(item, 1)) }) }) }));
106
107
  }
@@ -1,5 +1,5 @@
1
1
  import { type DirtyState } from "./DirtyActions.js";
2
- import { type DockAction } from "./dock.js";
2
+ import { type DockAction, type DockMoment } from "./dock.js";
3
3
  import { type ReactNode, type Ref } from "react";
4
4
  /** Where the dock goes. `bottom` floats it, stuck to the bottom of what scrolls; `inline` draws
5
5
  * only the pill — its host places it (`Record.Dock` does). A pill resting in the rail and
@@ -23,8 +23,15 @@ export interface ActionDockProps {
23
23
  /** The toolbar's accessible name: «Acciones de la factura». */
24
24
  label?: string;
25
25
  /** What the pill says before its actions — «3 elegidas ✕» over a list's chosen rows. Drawn
26
- * on the pill's band: write it with `useSurface()` colours. */
26
+ * on the pill's band: write it with `useSurface()` colours. For a sentence, `moment`. */
27
27
  lead?: ReactNode;
28
+ /**
29
+ * What the moment is, said before the actions and the same on every screen: «Colegiado
30
+ * observado · falta el certificado». The screen changes it with the record's state. While
31
+ * there are changes the pill says those instead (`DirtyState.message`/`detail`), then
32
+ * «Guardado» for a moment, and then this again — one place that changes, with a short rise.
33
+ */
34
+ moment?: DockMoment;
28
35
  }
29
36
  /** Where a record's actions go: as the rail's buttons, or floating at the bottom of the screen.
30
37
  * Absent, the record's style decides: `traditional` → `rail`, `modern` → `bottom`. */
@@ -33,7 +40,7 @@ export type RecordDockPlacement = "rail" | "bottom";
33
40
  export type RecordDockProps = Omit<ActionDockProps, "dirty" | "saved" | "placement"> & {
34
41
  placement?: RecordDockPlacement;
35
42
  };
36
- export declare function ActionDock({ actions, visible, dirty, saved, placement, align, look, label, lead, }: ActionDockProps): import("react").JSX.Element;
43
+ export declare function ActionDock({ actions, visible, dirty, saved, placement, align, look, label, lead, moment, }: ActionDockProps): import("react").JSX.Element;
37
44
  /**
38
45
  * The band a floating pill sits in. Sticky to the edge of what scrolls, as the settings bar: no
39
46
  * padding to keep in sync with its height, and at the end of the page it settles in its place in
@@ -2,13 +2,14 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { DirtyActions, SavedMark, } from "./DirtyActions.js";
4
4
  import { dockOption, dockPlan, dockShortcuts, moreGroups, } from "./dock.js";
5
+ import { DockMessage } from "./DockMessage.js";
5
6
  import { useUiCopy } from "../../foundations/copy.js";
6
7
  import { keysLabel } from "../../foundations/keys.js";
7
8
  import { useKeyboardPlatform, useKeysHint, useShortcuts, } from "../../foundations/shortcut.js";
8
9
  import { SurfaceProvider, useSurface } from "../../foundations/surface.js";
9
10
  import { Button } from "../../primitives/button/Button.js";
10
11
  import { Menu } from "../../primitives/menu/Menu.js";
11
- import { MoreHorizontal } from "lucide-react";
12
+ import { Check, MoreHorizontal } from "lucide-react";
12
13
  import { createContext, use } from "react";
13
14
  const PILL = { "--ui-button-radius": "var(--radius-pill)" };
14
15
  /** One action as a button, its shortcut in its title and in `aria-keyshortcuts`. */
@@ -20,7 +21,7 @@ function DockButton({ action, role, size, surface, }) {
20
21
  }
21
22
  /** The same actions with no pill: the rail's buttons — the primary first and gold, the
22
23
  * secondary ones bordered, «⋯» with the rest. What the `traditional` style draws. */
23
- function Bare({ actions, visible, dirty, saved, label, }) {
24
+ function Bare({ actions, visible, dirty, saved, label, moment, }) {
24
25
  const copy = useUiCopy();
25
26
  const surface = useSurface();
26
27
  const platform = useKeyboardPlatform();
@@ -31,24 +32,30 @@ function Bare({ actions, visible, dirty, saved, label, }) {
31
32
  if (dirty !== undefined) {
32
33
  return (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: _jsx(DirtyActions, { ...dirty }) }));
33
34
  }
34
- return (_jsxs("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.bare", className: "flex shrink-0 items-center gap-1.5", children: [plan.primary === undefined ? null : (_jsx(DockButton, { action: plan.primary, role: "primary", size: "sm", surface: tone })), plan.shown.map((action) => action.items === undefined ? (_jsx(DockButton, { action: action, role: "secondary", size: "sm", surface: tone }, action.id)) : (_jsx(Menu, { role: "secondary", size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", 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, size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", groups: more })), _jsx(SavedMark, { saved: saved === true })] }));
35
+ return (_jsxs("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.bare", className: "flex min-w-0 shrink-0 items-center gap-1.5", children: [_jsx(DockMessage, { moment: moment }), plan.primary === undefined ? null : (_jsx(DockButton, { action: plan.primary, role: "primary", size: "sm", surface: tone })), plan.shown.map((action) => action.items === undefined ? (_jsx(DockButton, { action: action, role: "secondary", size: "sm", surface: tone }, action.id)) : (_jsx(Menu, { role: "secondary", size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", 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, size: "sm", surface: surface === "chrome" ? "chrome" : "canvas", groups: more })), _jsx(SavedMark, { saved: saved === true })] }));
35
36
  }
36
37
  /** The pill alone: the actions, or Save and Discard. */
37
- function Pill({ actions, visible, dirty, saved, look, label, lead, }) {
38
+ function Pill({ actions, visible, dirty, saved, look, label, lead, moment, }) {
38
39
  const copy = useUiCopy();
39
40
  const platform = useKeyboardPlatform();
40
41
  const label_ = (keys) => keysLabel(keys, platform);
41
42
  const plan = dockPlan(actions, visible);
42
43
  const more = moreGroups(plan, label_);
43
- return (_jsx(SurfaceProvider, { value: look, children: _jsx("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.pill", style: PILL, className: `pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill p-1.5 shadow-float *:shrink-0 ${look === "chrome"
44
+ return (_jsx(SurfaceProvider, { value: look, children: _jsxs("div", { role: "toolbar", "aria-label": label ?? copy.dock.label, "data-ui": "dock.pill", style: PILL, className: `pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill p-1.5 shadow-float *:shrink-0 ${look === "chrome"
44
45
  ? "border border-chrome-edge bg-chrome"
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
+ : "border border-line bg-surface"}`, children: [_jsx("span", { role: "status", className: "sr-only", children: dirty !== undefined
47
+ ? ""
48
+ : saved === true
49
+ ? copy.record.saved
50
+ : (moment?.text ?? "") }), dirty !== undefined ? (_jsx(DirtyActions, { ...dirty, floating: true })) : (_jsxs(_Fragment, { children: [_jsx(DockMessage, { moment: saved === true
51
+ ? { text: copy.record.saved, tone: "good", icon: Check }
52
+ : moment }), 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 }))] }))] }) }));
46
53
  }
47
- export function ActionDock({ actions, visible = 2, dirty, saved, placement = "bottom", align = "center", look = "chrome", label, lead, }) {
54
+ export function ActionDock({ actions, visible = 2, dirty, saved, placement = "bottom", align = "center", look = "chrome", label, lead, moment, }) {
48
55
  /* The combinations run while the dock is on screen; while there are changes Save answers
49
56
  Mod+S itself. */
50
57
  useShortcuts(dockShortcuts(actions, dirty !== undefined));
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 }) }));
58
+ const pill = look === "bare" ? (_jsx(Bare, { actions: actions, visible: visible, ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }), ...(moment === undefined ? {} : { moment }) })) : (_jsx(Pill, { actions: actions, visible: visible, look: look, ...(lead === undefined ? {} : { lead }), ...(moment === undefined ? {} : { moment }), ...(dirty === undefined ? {} : { dirty }), ...(saved === undefined ? {} : { saved }), ...(label === undefined ? {} : { label }) }));
52
59
  if (placement === "inline")
53
60
  return pill;
54
61
  return _jsx(DockBand, { align: align, children: pill });
@@ -14,6 +14,12 @@ export interface DirtyState {
14
14
  /** How many fields changed. Not drawn: it describes the Save button, «Guardar — 2 cambios
15
15
  * sin guardar», for whoever cannot see the fields' own `Field changed` marks. */
16
16
  changes?: number;
17
+ /** What the floating pill says in place of «Cambios sin guardar», when the screen knows
18
+ * better: «La regla tiene cambios», «Respuesta sin enviar». */
19
+ message?: string;
20
+ /** The help under it in the floating pill: what saving will do — «se avisará al cliente»,
21
+ * «aplica desde el próximo mes». `blocked` takes its place while it cannot be saved. */
22
+ detail?: string;
17
23
  }
18
24
  /** Save and discard, in the rail and in place of the action buttons.
19
25
  *
@@ -21,15 +27,17 @@ export interface DirtyState {
21
27
  * the same rule as `FormActions`, and here it matters more: the rail is where
22
28
  * the hand is after editing.
23
29
  *
24
- * There is no «sin guardar» mark. The two buttons only exist while something changed, and
25
- * each changed field already says so (`Field changed`): a third signal repeating the other
26
- * two was noise beside the one action that matters. The only thing written here is what
30
+ * There is no «sin guardar» mark in the rail. The two buttons only exist while something
31
+ * changed, and each changed field already says so (`Field changed`): a third signal
32
+ * repeating the other two was noise beside the one action that matters. The floating pill
33
+ * is the exception — it says the moment, because the fields may be out of sight. The only thing written here is what
27
34
  * the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
28
35
  * still reaches a screen reader, as the Save button's description. */
29
- export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, floating, }: DirtyState & {
30
- /** In the floating bar (`DirtyBar`): the count is WRITTEN — the changed fields may be far
31
- * up a long form, out of sight, and their marks with them — and Discard is the quiet
32
- * ghost, so the bar reads «what is pending · undo · save» and not two equal boxes. */
36
+ export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, message, detail, floating, }: DirtyState & {
37
+ /** In the floating pill (`DirtyBar`, `ActionDock`): what is pending is WRITTEN — the
38
+ * changed fields may be far up a long form, out of sight, and their marks with them — as
39
+ * the pill's sentence (`DockMessage`, `message`/`detail`), and Discard takes the soft red,
40
+ * so the pill reads «what is pending · drop it · save» and not two equal boxes. */
33
41
  floating?: boolean;
34
42
  }): import("react").JSX.Element;
35
43
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { DockMessage } from "./DockMessage.js";
3
4
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
5
  import { useKeysHint, useShortcuts } from "../../foundations/shortcut.js";
5
6
  import { bySurface, SurfaceProvider, useSurface } from "../../foundations/surface.js";
@@ -12,12 +13,13 @@ import { useEffect, useId, useRef, useState } from "react";
12
13
  * the same rule as `FormActions`, and here it matters more: the rail is where
13
14
  * the hand is after editing.
14
15
  *
15
- * There is no «sin guardar» mark. The two buttons only exist while something changed, and
16
- * each changed field already says so (`Field changed`): a third signal repeating the other
17
- * two was noise beside the one action that matters. The only thing written here is what
16
+ * There is no «sin guardar» mark in the rail. The two buttons only exist while something
17
+ * changed, and each changed field already says so (`Field changed`): a third signal
18
+ * repeating the other two was noise beside the one action that matters. The floating pill
19
+ * is the exception — it says the moment, because the fields may be out of sight. The only thing written here is what
18
20
  * the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
19
21
  * still reaches a screen reader, as the Save button's description. */
20
- export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, floating = false, }) {
22
+ export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, message, detail, floating = false, }) {
21
23
  const copy = useUiCopy();
22
24
  /* Mod+S saves wherever Save is — the rail, the thumb bar, a floating pill —: the gesture
23
25
  every editor has, and in a browser it would otherwise save the PAGE. */
@@ -33,15 +35,37 @@ export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked
33
35
  ...(blocked === undefined ? [] : [blockedId]),
34
36
  ...(counted ? [changesId] : []),
35
37
  ].join(" ");
36
- return (_jsxs(_Fragment, { children: [blocked === undefined ? null : (_jsx("span", { id: blockedId, "data-ui": "dirty.blocked", className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked })), counted ? (_jsx("span", { id: changesId, ...(floating
37
- ? {
38
- /* One row on a phone too: the count gives way (it truncates), never the
39
- buttons — a pill broken in two rows is a blob. */
40
- className: `min-w-0 shrink! truncate px-2.5 text-meta ${bySurface(surface, "text-muted", "text-chrome-muted")}`,
41
- }
42
- : { hidden: true }), children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
38
+ if (floating) {
39
+ /* The pill's sentence (`DockMessage`), the same one a record's state uses: what is
40
+ pending, and under it why it cannot be saved yet or what saving will do. The dot is the
41
+ accent of a field's own «changed» mark; it turns warn while saving is not possible. */
42
+ const said = message ??
43
+ (counted
44
+ ? fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
43
45
  count: changes.toLocaleString(copy.locale),
44
- }) })) : null, _jsx(Button, { ...(floating ? { role: "ghost" } : {}), surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(saveHint === undefined
46
+ })
47
+ : copy.record.unsavedAny);
48
+ const help = blocked ?? detail;
49
+ return (_jsxs(_Fragment, { children: [_jsx(DockMessage, { moment: {
50
+ text: saving ? copy.record.saving : said,
51
+ tone: blocked === undefined ? "accent" : "warn",
52
+ busy: saving,
53
+ ...(help === undefined || saving ? {} : { detail: help }),
54
+ }, detailId: blockedId }), _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, destructive: true, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(saveHint === undefined
55
+ ? {}
56
+ : {
57
+ title: `${copy.record.save} (${saveHint.label})`,
58
+ "aria-keyshortcuts": saveHint.aria,
59
+ }), ...(describedBy === "" ? {} : { "aria-describedby": describedBy }), children: label ?? copy.record.save }), counted ? (_jsx("span", { id: changesId, hidden: true, children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
60
+ count: changes.toLocaleString(copy.locale),
61
+ }) })) : null] }));
62
+ }
63
+ return (_jsxs(_Fragment, { children: [blocked === undefined ? null : (_jsx("span", { id: blockedId, "data-ui": "dirty.blocked", className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked })), counted ? (_jsx("span", { id: changesId,
64
+ /* In the rail the changed fields are in sight and the count only describes Save;
65
+ in the floating bar it is written. */
66
+ hidden: true, children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
67
+ count: changes.toLocaleString(copy.locale),
68
+ }) })) : null, _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(saveHint === undefined
45
69
  ? {}
46
70
  : {
47
71
  title: `${copy.record.save} (${saveHint.label})`,
@@ -155,5 +179,5 @@ export function DirtyBar({ dirty, saved, }) {
155
179
  }, [shown]);
156
180
  /* Always mounted, so «Guardado» is announced (see `SavedMark`); with nothing to say it has
157
181
  no height and covers nothing. */
158
- return (_jsxs("div", { ref: ref, "data-ui": "dirty.bar", className: `pointer-events-none sticky bottom-0 z-20 mt-auto flex justify-center px-3 ${shown ? "pt-3 safe-bottom" : ""}`, children: [_jsx("span", { role: "status", className: "sr-only", children: saved ? copy.record.saved : "" }), shown ? (_jsx(SurfaceProvider, { value: "chrome", children: _jsx("div", { style: PILL, className: "pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill border border-chrome-edge bg-chrome p-1.5 shadow-float *:shrink-0", children: dirty === undefined ? _jsx(SavedChip, {}) : _jsx(DirtyActions, { ...dirty, floating: true }) }) })) : null] }));
182
+ return (_jsxs("div", { ref: ref, "data-ui": "dirty.bar", className: `pointer-events-none sticky bottom-0 z-20 mt-auto flex justify-center px-3 ${shown ? "pt-3 safe-bottom" : ""}`, children: [_jsx("span", { role: "status", className: "sr-only", children: saved ? copy.record.saved : "" }), shown ? (_jsx(SurfaceProvider, { value: "chrome", children: _jsx("div", { style: PILL, className: "pointer-events-auto flex max-w-full min-w-0 items-center gap-1 rounded-pill border border-chrome-edge bg-chrome p-1.5 shadow-float *:shrink-0", children: dirty === undefined ? (_jsx(DockMessage, { moment: { text: copy.record.saved, tone: "good", icon: Check } })) : (_jsx(DirtyActions, { ...dirty, floating: true })) }) })) : null] }));
159
183
  }
@@ -0,0 +1,18 @@
1
+ import type { DockMoment } from "./dock.js";
2
+ /**
3
+ * The pill's sentence: a dot of its tone (or its icon), the text, and the help under it.
4
+ *
5
+ * Context: one look for every screen — the unsaved changes, a record waiting on someone,
6
+ * «Guardado» — so the message is told apart by its words and its tone, never by who wrote
7
+ * the screen. It draws, it does not announce: the host keeps ONE always-mounted live region
8
+ * (the pill, `DirtyBar`) — a region inserted together with its words is not reliably read.
9
+ * The visible part is keyed by its text: a new sentence enters with a short rise, so dirty → saved → the record's state reads as one place
10
+ * changing, not as a pill rebuilt. The global reduced-motion rule flattens it.
11
+ *
12
+ * It gives way first: one row on a phone too, the sentence truncates and the buttons stay.
13
+ */
14
+ export declare function DockMessage({ moment, detailId, }: {
15
+ moment: DockMoment | undefined;
16
+ /** The help's id, for the button it explains (Save names why it is off). */
17
+ detailId?: string;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useSurface } from "../../foundations/surface.js";
4
+ import { DOT_TONE } from "../../primitives/tag/Tag.js";
5
+ /* The mark in each tone when it is an icon; the dot is `Tag`'s own (`DOT_TONE`). */
6
+ const INK = {
7
+ neutral: { canvas: "text-muted", chrome: "text-chrome-muted" },
8
+ info: { canvas: "text-info", chrome: "text-chrome-link" },
9
+ good: { canvas: "text-good", chrome: "text-chrome-good" },
10
+ warn: { canvas: "text-warn", chrome: "text-chrome-warn" },
11
+ bad: { canvas: "text-bad", chrome: "text-chrome-bad" },
12
+ accent: { canvas: "text-accent", chrome: "text-chrome-accent" },
13
+ };
14
+ /**
15
+ * The pill's sentence: a dot of its tone (or its icon), the text, and the help under it.
16
+ *
17
+ * Context: one look for every screen — the unsaved changes, a record waiting on someone,
18
+ * «Guardado» — so the message is told apart by its words and its tone, never by who wrote
19
+ * the screen. It draws, it does not announce: the host keeps ONE always-mounted live region
20
+ * (the pill, `DirtyBar`) — a region inserted together with its words is not reliably read.
21
+ * The visible part is keyed by its text: a new sentence enters with a short rise, so dirty → saved → the record's state reads as one place
22
+ * changing, not as a pill rebuilt. The global reduced-motion rule flattens it.
23
+ *
24
+ * It gives way first: one row on a phone too, the sentence truncates and the buttons stay.
25
+ */
26
+ export function DockMessage({ moment, detailId, }) {
27
+ const surface = useSurface() === "chrome" ? "chrome" : "canvas";
28
+ const tone = moment?.tone ?? "neutral";
29
+ const Icon = moment?.icon;
30
+ return (_jsx(_Fragment, { children: moment === undefined ? null : (_jsxs("span", { "data-ui": "dock.message", "data-tone": tone, className: "flex min-w-0 shrink! items-center gap-2 px-2.5 transition-[opacity,translate] duration-(--duration-quick) ease-(--ease-out) starting:translate-y-0.5 starting:opacity-0", children: [Icon === undefined ? (_jsxs("span", { "aria-hidden": true, className: "relative flex size-1.5 shrink-0", children: [moment.busy === true ? (_jsx("span", { className: `absolute inline-flex size-full animate-ping rounded-pill opacity-70 ${DOT_TONE[tone][surface]}` })) : null, _jsx("span", { className: `relative inline-flex size-1.5 rounded-pill ${DOT_TONE[tone][surface]}` })] })) : (_jsx(Icon, { "aria-hidden": true, strokeWidth: 2.25, className: `size-(--size-icon-sm) shrink-0 ${INK[tone][surface]}` })), _jsxs("span", { className: "flex min-w-0 flex-col leading-tight", children: [_jsx("span", { className: `truncate text-meta font-medium ${surface === "chrome" ? "text-chrome-ink" : "text-ink"}`, children: moment.text }), moment.detail === undefined ? null : (_jsx("span", { ...(detailId === undefined ? {} : { id: detailId }), className: `truncate text-micro ${surface === "chrome" ? "text-chrome-muted" : "text-muted"}`, children: moment.detail }))] })] }, moment.text)) }));
31
+ }
@@ -1,5 +1,30 @@
1
+ import type { Tone } from "../../foundations/types.js";
1
2
  import type { MenuGroup, MenuOption } from "../../primitives/menu/Menu.js";
2
3
  import type { LucideIcon } from "lucide-react";
4
+ /**
5
+ * What the pill SAYS about the moment, before its actions — «Colegiado observado · falta el
6
+ * certificado», «Cambios sin guardar · se avisará al cliente al guardar», «Guardado».
7
+ *
8
+ * Context: the pill only offered buttons, and an application that wanted to say something
9
+ * wrote its own node in `lead`: each screen styled its message, and the pills stopped looking
10
+ * alike. This is the common case, drawn the same everywhere (`DockMessage`): a dot of the
11
+ * tone, the sentence, and under it the help that explains it. It is DATA the screen changes
12
+ * with its state — the record's stage, why it cannot go on, what saving will do —, not copy
13
+ * fixed in the component.
14
+ */
15
+ export interface DockMoment {
16
+ /** The sentence, short: it truncates before the buttons give way. */
17
+ text: string;
18
+ /** The help under it, quieter: why, or what happens next. */
19
+ detail?: string;
20
+ /** What the moment means: `warn` something waits for you, `bad` something failed, `good`
21
+ * done, `info` news. Without this, `neutral`. Never alone: the text says it too. */
22
+ tone?: Tone;
23
+ /** In place of the dot, when a mark says it faster. */
24
+ icon?: LucideIcon;
25
+ /** Something is happening right now (saving, sending): the dot breathes. */
26
+ busy?: boolean;
27
+ }
3
28
  /** One action of a dock. */
4
29
  export interface DockAction {
5
30
  id: string;
@@ -1,7 +1,8 @@
1
1
  export { ActionDock, type ActionDockProps, type DockLook, type DockPlacement, type RecordDockPlacement, type RecordDockProps, } from "./ActionDock.js";
2
2
  export { Breadcrumb, type Crumb } from "./Breadcrumb.js";
3
3
  export { DirtyActions, type DirtyState, } from "./DirtyActions.js";
4
- export { type DockAction, dockOption, type DockPlan, dockPlan, moreGroups, } from "./dock.js";
4
+ export { type DockAction, type DockMoment, dockOption, type DockPlan, dockPlan, moreGroups, } from "./dock.js";
5
+ export { DockMessage } from "./DockMessage.js";
5
6
  export { Pager } from "./Pager.js";
6
7
  export { RecordAudit, type RecordStamp } from "./RecordAudit.js";
7
8
  export { RecordRibbon } from "./RecordRibbon.js";