@sincpro/web-ui 2.5.0 → 2.6.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 (33) hide show
  1. package/README.md +52 -6
  2. package/dist/components/activity/Activity.d.ts +8 -1
  3. package/dist/components/activity/Activity.js +9 -4
  4. package/dist/components/activity/Messages.d.ts +4 -0
  5. package/dist/components/attachments/Attachments.d.ts +1 -28
  6. package/dist/components/attachments/Attachments.js +5 -24
  7. package/dist/components/attachments/FileList.d.ts +28 -0
  8. package/dist/components/attachments/FileList.js +91 -0
  9. package/dist/components/attachments/FileThumb.d.ts +13 -0
  10. package/dist/components/attachments/FileThumb.js +34 -0
  11. package/dist/components/attachments/download.d.ts +9 -0
  12. package/dist/components/attachments/download.js +36 -0
  13. package/dist/components/attachments/files.d.ts +28 -0
  14. package/dist/components/attachments/index.d.ts +4 -2
  15. package/dist/components/attachments/index.js +4 -1
  16. package/dist/components/calendar/RecordCalendar.d.ts +2 -1
  17. package/dist/components/calendar/RecordCalendar.js +4 -1
  18. package/dist/components/calendar/calendar.css +37 -0
  19. package/dist/components/chat/ChatThread.d.ts +8 -1
  20. package/dist/components/chat/ChatThread.js +9 -4
  21. package/dist/components/chat/model.d.ts +4 -0
  22. package/dist/components/gantt/RecordGantt.d.ts +9 -1
  23. package/dist/components/gantt/RecordGantt.js +16 -3
  24. package/dist/components/gantt/gantt.css +52 -0
  25. package/dist/foundations/copy.d.ts +6 -0
  26. package/dist/foundations/copy.es.js +3 -0
  27. package/dist/foundations/copy.js +3 -0
  28. package/dist/primitives/button/Button.d.ts +5 -1
  29. package/dist/primitives/button/Button.js +9 -2
  30. package/dist/primitives/value/Markdown.d.ts +1 -0
  31. package/dist/primitives/value/Markdown.js +1 -0
  32. package/dist/tokens.css +6 -85
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -83,7 +83,7 @@ the tokens once — fonts, theme and Tailwind come with it:
83
83
  ```tsx
84
84
  import { Field, installCopy, SPANISH_COPY, TextInput } from "@sincpro/web-ui";
85
85
 
86
- installCopy(SPANISH_COPY); // optional: the interface in Spanish
86
+ installCopy(SPANISH_COPY); // optional: the interface in Spanish — once, where the app starts
87
87
 
88
88
  export function CompanyName({
89
89
  value,
@@ -103,10 +103,56 @@ export function CompanyName({
103
103
  Each level is also its own entry — `@sincpro/web-ui/foundations`, `/primitives`,
104
104
  `/components`, `/views` — so what a level offers is one import away.
105
105
 
106
- **React Server Components.** Every module that needs the browser (hooks, context, events)
107
- starts with `"use client"`, and a test keeps it that way; pure logic (calendar, pivot,
108
- criteria) stays callable from the server. The views are client components: compose
109
- `Record` inside a client component of your own.
106
+ **What your application ships.** Only what it uses: a `Button` alone is ~2.5 KB gzip, a form
107
+ ~74, a `Record` ~130, a `List` ~283 — React aside. The heavy pieces (calendar, Gantt, rich-text
108
+ and JSON editors, charts, PDF) load in their own chunk when they are drawn, and a library's
109
+ stylesheet comes with the component that draws it (the Gantt's alone is ~160 KB), not with
110
+ `tokens.css`. `tests/bundle.test.ts` holds those numbers. Your bundler only needs to handle a
111
+ CSS import from a dependency — Vite, webpack, Turbopack and Next.js do. Tests that load the
112
+ package in Node (Vitest's `node` environment) inline it so those imports go through Vite:
113
+ `test: { server: { deps: { inline: [/@sincpro\/web-ui/] } } }`.
114
+
115
+ ### Server rendering (Next.js)
116
+
117
+ It works as it is with the App Router and the Pages Router, under Turbopack and webpack.
118
+ `tokens.css` goes in your global stylesheet, with Tailwind's PostCSS plugin:
119
+
120
+ ```js
121
+ // postcss.config.mjs
122
+ export default { plugins: { "@tailwindcss/postcss": {} } };
123
+ ```
124
+
125
+ - **Server Components** may import from `@sincpro/web-ui`. Every module that needs the browser
126
+ (hooks, context, events) starts with `"use client"`, and a test keeps it that way; pure logic
127
+ (calendar, pivot, criteria) stays callable from the server. The views are client components:
128
+ compose `Record` or `List` inside a client component of your own.
129
+ - **The language.** `installCopy` sets the one global there is — and on a server, one process
130
+ renders every page and every request. Installed in one page, it leaks into the next page the
131
+ server renders, which the browser then draws in English: a hydration error. Install it in a
132
+ module EVERY page loads (your root layout's client providers), or — when the language changes
133
+ per user — give it with `UiCopyProvider`, which never writes the global:
134
+
135
+ ```tsx
136
+ // app/providers.tsx — rendered by app/layout.tsx around {children}
137
+ "use client";
138
+ import { SPANISH_COPY, UiCopyProvider } from "@sincpro/web-ui";
139
+
140
+ export function Providers({ children }: { children: React.ReactNode }) {
141
+ return <UiCopyProvider copy={SPANISH_COPY}>{children}</UiCopyProvider>;
142
+ }
143
+ ```
144
+
145
+ - **webpack** (`next build --webpack`): a Server Component that imports from the package root
146
+ makes webpack send the WHOLE library to the browser (~1.2 MB gzip for one `Button`). Let Next
147
+ rewrite those imports — Turbopack, the default, does not need it:
148
+
149
+ ```js
150
+ // next.config.mjs
151
+ export default { experimental: { optimizePackageImports: ["@sincpro/web-ui"] } };
152
+ ```
153
+
154
+ - What only a browser can draw is drawn there: the Gantt (SVAR paints its grid on a canvas)
155
+ renders its skeleton on the server and the chart after hydration.
110
156
 
111
157
  ### Theming (light / dark)
112
158
 
@@ -220,7 +266,7 @@ of classes that change with the next refactor:
220
266
 
221
267
  The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`,
222
268
  `menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card`, `board.tile`,
223
- `board.stat`, `board.stat.value`, `activity.changes`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
269
+ `board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
224
270
  `search.panel`, `search.suggestions`, `search-entry`, `search-entry.keys`, `table`,
225
271
  `table.head`, `topbar`, `topbar.brand`, `topbar.menus`, `topbar.actions`, `topbar.user`,
226
272
  `frame`, `frame.bar`, `frame.sidebar`, `frame.main`, `sidebar`, `sidebar.brand`,
@@ -1,4 +1,5 @@
1
1
  import type { Message } from "./Messages.js";
2
+ import type { AttachmentFile } from "../attachments/files.js";
2
3
  import type { Tone } from "../../foundations/types.js";
3
4
  import { type CalloutProps } from "../../primitives/notice/Callout.js";
4
5
  import type { LucideIcon } from "lucide-react";
@@ -75,8 +76,14 @@ export type ActivityProps = {
75
76
  /** The panel's name. «Actividad» by default. */
76
77
  label?: string;
77
78
  layout?: ActivityLayout;
79
+ /** Open a file a message carries. Present = its name is a button; WHERE it opens — a
80
+ * peek, a `FilePreview` — is the application's. */
81
+ onOpenFile?: (file: AttachmentFile, message: Message) => void;
82
+ /** Download a file a message carries by code (a token, a signed URL). Without it, a file
83
+ * with a `url` downloads by link. Busy while the promise runs; a rejection is said. */
84
+ onDownloadFile?: (file: AttachmentFile, message: Message) => void | Promise<unknown>;
78
85
  };
79
- export declare function Activity({ messages, events, alerts, alertsId: ownAlertsId, composer, open, onToggle, label: ownLabel, layout, }: ActivityProps): import("react").JSX.Element;
86
+ export declare function Activity({ messages, events, alerts, alertsId: ownAlertsId, composer, open, onToggle, label: ownLabel, layout, onOpenFile, onDownloadFile, }: ActivityProps): import("react").JSX.Element;
80
87
  /** Whether a standalone activity panel is open. Inside a `Record`, `Record.Activity`
81
88
  * keeps this state itself (open by default: on a big screen you see what the record has). */
82
89
  export declare function useActivity(initial?: boolean): {
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { FileList } from "../attachments/FileList.js";
3
4
  import { usePagination } from "../listing/pages.js";
4
5
  import { Pagination } from "../listing/Pagination.js";
5
6
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
@@ -71,10 +72,14 @@ function at(when) {
71
72
  /* The stream's two kinds of entry share one GEOMETRY: a 1.5rem disc (the face, or the
72
73
  event's node) on the left, the text beside it, the meta line under it. Two geometries
73
74
  in one list read as two lists glued together. */
74
- function MessageEntry({ message }) {
75
+ function MessageEntry({ message, onOpenFile, onDownloadFile, }) {
75
76
  const copy = useUiCopy();
76
77
  const internal = message.internal === true;
77
- return (_jsxs("li", { className: "flex min-w-0 gap-2.5 px-2 py-2", children: [_jsx(Avatar, { name: message.author, size: "md" }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [_jsx("span", { className: "truncate text-meta font-medium text-ink", children: message.author }), _jsx("span", { className: "text-micro text-muted", children: _jsx(DateValue, { when: message.at, format: "relative" }) }), internal ? (_jsxs("span", { className: "inline-flex items-center gap-1 text-micro text-muted", title: copy.activity.internalNote, children: [_jsx(Lock, { className: "size-3", "aria-hidden": true }), copy.activity.internal] })) : null] }), _jsx("p", { className: cn("max-w-(--container-prose) rounded-box px-2.5 py-1.5 text-body whitespace-pre-line text-ink", internal ? "border border-warn/35 bg-warn/6" : "bg-ground"), children: message.body })] })] }));
78
+ return (_jsxs("li", { className: "flex min-w-0 gap-2.5 px-2 py-2", children: [_jsx(Avatar, { name: message.author, size: "md" }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [_jsx("span", { className: "truncate text-meta font-medium text-ink", children: message.author }), _jsx("span", { className: "text-micro text-muted", children: _jsx(DateValue, { when: message.at, format: "relative" }) }), internal ? (_jsxs("span", { className: "inline-flex items-center gap-1 text-micro text-muted", title: copy.activity.internalNote, children: [_jsx(Lock, { className: "size-3", "aria-hidden": true }), copy.activity.internal] })) : null] }), message.body === "" ? null : (_jsx("p", { className: cn("max-w-(--container-prose) rounded-box px-2.5 py-1.5 text-body whitespace-pre-line text-ink", internal ? "border border-warn/35 bg-warn/6" : "bg-ground"), children: message.body })), message.files === undefined ? null : (_jsx(FileList, { files: message.files, ...(onOpenFile === undefined
79
+ ? {}
80
+ : { onOpen: (file) => onOpenFile(file, message) }), ...(onDownloadFile === undefined
81
+ ? {}
82
+ : { onDownload: (file) => onDownloadFile(file, message) }) }))] })] }));
78
83
  }
79
84
  /** The change of state: from what to what. The old one quiet, the new one in ink. */
80
85
  const STATE_CHIP = "inline-flex max-w-32 min-w-0 items-center truncate rounded-pill border border-line-strong bg-ink/5 px-2 py-0.5 text-micro";
@@ -177,7 +182,7 @@ const TONE_TEXT = {
177
182
  info: "text-info",
178
183
  good: "text-good",
179
184
  };
180
- export function Activity({ messages, events, alerts = [], alertsId: ownAlertsId, composer, open, onToggle, label: ownLabel, layout = "auto", }) {
185
+ export function Activity({ messages, events, alerts = [], alertsId: ownAlertsId, composer, open, onToggle, label: ownLabel, layout = "auto", onOpenFile, onDownloadFile, }) {
181
186
  const copy = useUiCopy();
182
187
  const label = ownLabel ?? copy.activity.title;
183
188
  const titleId = useId();
@@ -300,7 +305,7 @@ export function Activity({ messages, events, alerts = [], alertsId: ownAlertsId,
300
305
  _jsxs("li", { "aria-hidden": true, className: "flex items-center gap-2 px-1 pt-2 pb-1 text-micro font-medium text-muted first:pt-0", children: [_jsx("span", { className: "first-letter:uppercase", children: dayLabel(day, copy.locale, {
301
306
  today: copy.activity.today,
302
307
  yesterday: copy.activity.yesterday,
303
- }) }), _jsx("span", { className: "h-px flex-1 bg-line" })] })) : null, entry.kind === "message" ? (_jsx(MessageEntry, { message: entry.message })) : (_jsx(EventEntry, { event: entry.event }))] }, entry.id));
308
+ }) }), _jsx("span", { className: "h-px flex-1 bg-line" })] })) : null, entry.kind === "message" ? (_jsx(MessageEntry, { message: entry.message, onOpenFile: onOpenFile, onDownloadFile: onDownloadFile })) : (_jsx(EventEntry, { event: entry.event }))] }, entry.id));
304
309
  }) }), kept.length <= 20 ? null : _jsx(Pagination, { ...pages.bridge })] }))] })] }));
305
310
  }
306
311
  /** Whether a standalone activity panel is open. Inside a `Record`, `Record.Activity`
@@ -1,3 +1,4 @@
1
+ import type { AttachmentFile } from "../attachments/files.js";
1
2
  import { type UiCopy } from "../../foundations/copy.js";
2
3
  import { type ReactNode } from "react";
3
4
  /**
@@ -33,6 +34,9 @@ export type Message = {
33
34
  body: string;
34
35
  /** An internal note: it stays inside. Drawn differently on purpose. */
35
36
  internal?: boolean;
37
+ /** What it carries — the receipt, the signed contract —, drawn under the text as cards
38
+ * (`FileList`). A message may be only its files: then `body` is empty. */
39
+ files?: readonly AttachmentFile[];
36
40
  };
37
41
  /** A way of writing. `note` stays inside; everything else leaves, and what
38
42
  * changes between them is only the channel and who is on the other side. */
@@ -1,32 +1,5 @@
1
+ import { type AttachmentFile } from "./files.js";
1
2
  import { type FormMode } from "../../foundations/form.js";
2
- export type AttachmentStatus = "ready" | "uploading" | "failed";
3
- export type AttachmentFile = {
4
- /** The attachment's identity: the server's id, or a local key while it uploads. */
5
- id: string;
6
- /** The file name as it was saved: «Factura proveedor 0418.pdf». */
7
- name: string;
8
- /** In bytes. Written in the copy's locale: «1,2 MB». */
9
- size?: number;
10
- /** The MIME type, when the server knows it. With the name, it picks the icon. */
11
- type?: string;
12
- /** Where it downloads from. Absent = no download (still uploading, or not allowed). */
13
- url?: string;
14
- /** A small image for the thumbnail. Defaults to `url` for an image — pass a smaller one
15
- * when the server has it, so a list of 4 MB photos does not load 4 MB photos. */
16
- thumbnail?: string;
17
- /** Who added it. */
18
- by?: string;
19
- /** Their face, for the chip. */
20
- byAvatar?: string;
21
- /** When it was added. */
22
- at?: Date | string | number;
23
- /** `ready` by default. The application owns it: it is what the upload is really doing. */
24
- status?: AttachmentStatus;
25
- /** 0 to 100 while `uploading`. Absent = under way without a figure yet. */
26
- progress?: number;
27
- /** Why it `failed`, in the server's words. */
28
- error?: string;
29
- };
30
3
  export type AttachmentsProps = {
31
4
  files: readonly AttachmentFile[];
32
5
  /** Files to add: dropped, pasted or chosen. Present = the drop zone is drawn (in edit
@@ -1,6 +1,7 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { attachmentKind, fileExtension, formatFileSize, } from "./files.js";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { attachmentKind, formatFileSize, } from "./files.js";
4
+ import { FileThumb } from "./FileThumb.js";
4
5
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
5
6
  import { useFormMode } from "../../foundations/form.js";
6
7
  import { Button, IconButton, IconLink } from "../../primitives/button/Button.js";
@@ -10,28 +11,8 @@ import { useToastIfAny } from "../../primitives/notice/Toast.js";
10
11
  import { DateValue } from "../../primitives/value/DateValue.js";
11
12
  import { UserChip } from "../../primitives/value/Person.js";
12
13
  import { ProgressBar } from "../../primitives/value/ProgressBar.js";
13
- import { Download, File, FileImage, FileSpreadsheet, FileText, FileType, RotateCcw, Trash2, TriangleAlert, X, } from "lucide-react";
14
+ import { Download, RotateCcw, Trash2, TriangleAlert, X } from "lucide-react";
14
15
  import { useEffect, useId, useRef } from "react";
15
- const KIND_ICON = {
16
- image: FileImage,
17
- pdf: FileText,
18
- sheet: FileSpreadsheet,
19
- doc: FileType,
20
- other: File,
21
- };
22
- /** The type, at the size of a row: the image itself when there is one, otherwise the icon
23
- * of its kind over its extension. The extension is written because three of the five
24
- * icons are a page with lines on it — «PDF» and «DOCX» are what tell them apart, and a
25
- * word is never a colour that only some people see. */
26
- function Thumb({ file, kind }) {
27
- const picture = kind === "image" && file.status !== "failed" ? (file.thumbnail ?? file.url) : undefined;
28
- const Icon = KIND_ICON[kind];
29
- const extension = fileExtension(file.name).slice(0, 4);
30
- return (
31
- /* Decorative: the name next to it says which file it is, and the image's `alt` would
32
- say it twice. */
33
- _jsx("span", { "aria-hidden": true, className: "flex size-(--size-control-lg) shrink-0 flex-col items-center justify-center gap-0.5 overflow-clip rounded-control border border-line bg-ink/4 text-muted", children: picture === undefined ? (_jsxs(_Fragment, { children: [_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 1.75 }), extension === "" ? null : (_jsx("span", { className: "text-micro leading-none font-medium uppercase", children: extension }))] })) : (_jsx("img", { src: picture, alt: "", loading: "lazy", className: "size-full object-cover" })) }));
34
- }
35
16
  export function Attachments({ files, onAdd, onRemove, onRestore, onOpen, onRetry, accept, multiple = true, max, mode, label, empty, now, }) {
36
17
  const copy = useUiCopy();
37
18
  const toast = useToastIfAny();
@@ -84,7 +65,7 @@ export function Attachments({ files, onAdd, onRemove, onRestore, onOpen, onRetry
84
65
  const nameId = `${base}-${index}-name`;
85
66
  const detailId = `${base}-${index}-detail`;
86
67
  const kind = attachmentKind(file.name, file.type);
87
- return (_jsxs("li", { "data-attachment-id": file.id, "data-status": status, className: "flex min-w-0 items-center gap-3 py-2", children: [_jsx(Thumb, { file: file, kind: kind }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [onOpen === undefined || status !== "ready" ? (_jsx("span", { id: nameId, title: file.name, className: "max-w-full truncate text-body font-medium text-ink", children: file.name })) : (_jsx("button", { type: "button", id: nameId, title: file.name, "data-attachment-name": true, "aria-describedby": detailId, onClick: () => onOpen(file), className: "max-w-full cursor-pointer truncate rounded-control text-left text-body font-medium text-ink outline-primary outline-offset-2 hover:underline hover:underline-offset-4 focus-visible:outline-2 forced-colors:outline-[Highlight]", children: file.name })), status === "uploading" ? (_jsx("div", { className: "w-full", children: _jsx(ProgressBar, { label: fillCopy(copy.attachments.uploading, { name: file.name }), width: "w-full", ...(file.progress === undefined ? {} : { value: file.progress }) }) })) : status === "failed" ? (
68
+ return (_jsxs("li", { "data-attachment-id": file.id, "data-status": status, className: "flex min-w-0 items-center gap-3 py-2", children: [_jsx(FileThumb, { file: file, kind: kind }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [onOpen === undefined || status !== "ready" ? (_jsx("span", { id: nameId, title: file.name, className: "max-w-full truncate text-body font-medium text-ink", children: file.name })) : (_jsx("button", { type: "button", id: nameId, title: file.name, "data-attachment-name": true, "aria-describedby": detailId, onClick: () => onOpen(file), className: "max-w-full cursor-pointer truncate rounded-control text-left text-body font-medium text-ink outline-primary outline-offset-2 hover:underline hover:underline-offset-4 focus-visible:outline-2 forced-colors:outline-[Highlight]", children: file.name })), status === "uploading" ? (_jsx("div", { className: "w-full", children: _jsx(ProgressBar, { label: fillCopy(copy.attachments.uploading, { name: file.name }), width: "w-full", ...(file.progress === undefined ? {} : { value: file.progress }) }) })) : status === "failed" ? (
88
69
  /* The icon AND the words: red alone is a colour some people do not see. */
89
70
  _jsxs("p", { id: detailId, role: "alert", className: "flex min-w-0 items-start gap-1.5 text-meta text-bad", children: [_jsx(TriangleAlert, { "aria-hidden": true, className: "mt-px size-(--size-icon-sm) shrink-0", strokeWidth: 2 }), _jsx("span", { className: "min-w-0", children: file.error ?? copy.attachments.failed })] })) : (_jsxs("p", { id: detailId, className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta text-muted", children: [file.size === undefined ? null : (_jsx("span", { className: "tabular-nums whitespace-nowrap", children: formatFileSize(file.size, copy.locale) })), file.by === undefined ? null : (_jsx(UserChip, { name: file.by, size: "sm", ...(file.byAvatar === undefined ? {} : { src: file.byAvatar }) })), file.at === undefined ? null : (_jsx(DateValue, { when: file.at, ...(now === undefined ? {} : { now }) }))] }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [status === "failed" && onRetry !== undefined ? (_jsx(Button, { role: "ghost", size: "sm", icon: RotateCcw, "aria-describedby": nameId, onClick: () => onRetry(file), children: copy.attachments.retry })) : null, status === "ready" && file.url !== undefined ? (_jsx(IconLink, { icon: Download, label: copy.attachments.download, href: file.url, download: file.name, tone: "normal", "aria-describedby": nameId })) : null, editable && onRemove !== undefined ? (_jsx(IconButton, { icon: status === "ready" ? Trash2 : X, label: status === "uploading"
90
71
  ? copy.attachments.cancelUpload
@@ -0,0 +1,28 @@
1
+ import { type AttachmentFile } from "./files.js";
2
+ export type FileListLayout = "cards" | "rows";
3
+ export type FileListProps = {
4
+ files: readonly AttachmentFile[];
5
+ /** `cards` (default): a file someone sent, under a message. `rows`: the files of
6
+ * something, in a bordered list. */
7
+ layout?: FileListLayout;
8
+ /** What these files are — «Assets», «Comprobantes» —, drawn with their count. Without it
9
+ * the list is named by `label`. */
10
+ title?: string;
11
+ /** The title folds the list (it needs a `title`). Open by default; `defaultOpen={false}`
12
+ * starts it folded. */
13
+ collapsible?: boolean;
14
+ defaultOpen?: boolean;
15
+ /** Open the file. Present = its name is a button; WHERE it opens is the application's. */
16
+ onOpen?: (file: AttachmentFile) => void;
17
+ /** Download by code. Present = every ready file has a download button that calls it,
18
+ * busy while its promise runs. Without it, a file with a `url` downloads by link. */
19
+ onDownload?: (file: AttachmentFile) => void | Promise<unknown>;
20
+ /** «Download all», shown when there are two or more files. */
21
+ onDownloadAll?: (files: readonly AttachmentFile[]) => void | Promise<unknown>;
22
+ /** The accessible name when there is no `title`. «Archivos» by default. */
23
+ label?: string;
24
+ /** The «now» the dates are relative to — so a story or a test does not change its text
25
+ * every minute. */
26
+ now?: Date;
27
+ };
28
+ export declare function FileList({ files, layout, title, collapsible, defaultOpen, onOpen, onDownload, onDownloadAll, label, now, }: FileListProps): import("react").JSX.Element | null;
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { attachmentKind, fileExtension, formatFileSize, } from "./files.js";
4
+ import { FileThumb } from "./FileThumb.js";
5
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
6
+ import { Button, IconButton, IconLink } from "../../primitives/button/Button.js";
7
+ import { Disclosure } from "../../primitives/disclosure/Disclosure.js";
8
+ import { DateValue } from "../../primitives/value/DateValue.js";
9
+ import { ProgressBar } from "../../primitives/value/ProgressBar.js";
10
+ import { Download, TriangleAlert } from "lucide-react";
11
+ import { useId, useState } from "react";
12
+ const add = (marks, id) => new Set(marks).add(id);
13
+ const drop = (marks, id) => {
14
+ const next = new Set(marks);
15
+ next.delete(id);
16
+ return next;
17
+ };
18
+ /* The ring every name shares, as a button or as a link. */
19
+ const NAME = "max-w-full cursor-pointer truncate rounded-control text-left font-medium text-ink outline-primary outline-offset-2 hover:underline hover:underline-offset-4 focus-visible:outline-2 forced-colors:outline-[Highlight]";
20
+ export function FileList({ files, layout = "cards", title, collapsible = false, defaultOpen = true, onOpen, onDownload, onDownloadAll, label, now, }) {
21
+ const copy = useUiCopy();
22
+ const base = useId();
23
+ const titleId = `${base}-title`;
24
+ const [pending, setPending] = useState(() => new Set());
25
+ const [failed, setFailed] = useState(() => new Set());
26
+ const [allPending, setAllPending] = useState(false);
27
+ const [allFailed, setAllFailed] = useState(false);
28
+ if (files.length === 0)
29
+ return null;
30
+ const download = async (file) => {
31
+ if (onDownload === undefined)
32
+ return;
33
+ setFailed((marks) => drop(marks, file.id));
34
+ setPending((marks) => add(marks, file.id));
35
+ try {
36
+ await onDownload(file);
37
+ }
38
+ catch {
39
+ setFailed((marks) => add(marks, file.id));
40
+ }
41
+ finally {
42
+ setPending((marks) => drop(marks, file.id));
43
+ }
44
+ };
45
+ const downloadAll = async () => {
46
+ if (onDownloadAll === undefined)
47
+ return;
48
+ setAllFailed(false);
49
+ setAllPending(true);
50
+ try {
51
+ await onDownloadAll(files);
52
+ }
53
+ catch {
54
+ setAllFailed(true);
55
+ }
56
+ finally {
57
+ setAllPending(false);
58
+ }
59
+ };
60
+ const cards = layout === "cards";
61
+ const list = (_jsx("ul", { ...(title === undefined
62
+ ? { "aria-label": label ?? copy.attachments.files }
63
+ : { "aria-labelledby": titleId }), className: cards
64
+ ? "flex min-w-0 flex-wrap gap-2"
65
+ : "flex min-w-0 flex-col divide-y divide-line rounded-box border border-line bg-surface", children: files.map((file, index) => {
66
+ const status = file.status ?? "ready";
67
+ const ready = status === "ready";
68
+ const nameId = `${base}-${index}-name`;
69
+ const kind = attachmentKind(file.name, file.type);
70
+ const busy = pending.has(file.id);
71
+ const extension = fileExtension(file.name).toUpperCase();
72
+ const name = ready && onOpen !== undefined ? (_jsx("button", { type: "button", id: nameId, title: file.name, onClick: () => onOpen(file), className: NAME, children: file.name })) : ready && file.url !== undefined && onDownload === undefined ? (_jsx("a", { id: nameId, href: file.url, download: file.name, title: file.name, className: NAME, children: file.name })) : (_jsx("span", { id: nameId, title: file.name, className: "max-w-full truncate font-medium text-ink", children: file.name }));
73
+ /* What the file is, or what is happening to it — in words: red alone is a colour some
74
+ people do not see. */
75
+ const detail = status === "uploading" ? (_jsx(ProgressBar, { label: fillCopy(copy.attachments.uploading, { name: file.name }), width: "w-full", ...(file.progress === undefined ? {} : { value: file.progress }) })) : status === "failed" || failed.has(file.id) ? (_jsxs("span", { role: "alert", className: "flex min-w-0 items-start gap-1.5 text-micro text-bad", children: [_jsx(TriangleAlert, { "aria-hidden": true, className: "mt-px size-(--size-icon-sm) shrink-0" }), _jsx("span", { className: "min-w-0", children: status === "failed"
76
+ ? (file.error ?? copy.attachments.failed)
77
+ : fillCopy(copy.attachments.downloadFailed, { name: file.name }) })] })) : (_jsxs("span", { className: "flex min-w-0 flex-wrap items-center gap-x-2 text-micro text-muted tabular-nums", children: [cards && extension !== "" ? _jsx("span", { children: extension }) : null, cards && extension !== "" && file.size !== undefined ? (_jsx("span", { "aria-hidden": true, children: "\u00B7" })) : null, file.size === undefined ? null : (_jsx("span", { className: "whitespace-nowrap", children: formatFileSize(file.size, copy.locale) })), !cards && file.at !== undefined ? (_jsx(DateValue, { when: file.at, ...(now === undefined ? {} : { now }) })) : null] }));
78
+ const action = !ready ? null : onDownload !== undefined ? (_jsx(IconButton, { icon: Download, label: copy.attachments.download, busy: busy, "aria-describedby": nameId, onClick: () => void download(file) })) : file.url !== undefined ? (_jsx(IconLink, { icon: Download, label: copy.attachments.download, href: file.url, download: file.name, tone: "normal", "aria-describedby": nameId })) : null;
79
+ return (_jsxs("li", { "data-ui": "file-list.file", "data-status": status, className: cards
80
+ ? "flex w-full max-w-sm min-w-0 items-center gap-3 rounded-box border border-line bg-surface p-2"
81
+ : "flex min-w-0 items-center gap-3 px-3 py-2", children: [_jsx(FileThumb, { file: file, kind: kind, size: cards ? "md" : "sm" }), cards ? (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-meta", children: [name, detail] })) : (_jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-0.5 text-body", children: [name, detail] })), action] }, file.id));
82
+ }) }));
83
+ const all = onDownloadAll !== undefined && files.length > 1 ? (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsx(Button, { role: "ghost", size: "sm", icon: Download, busy: allPending, onClick: () => void downloadAll(), children: copy.attachments.downloadAll }), allFailed ? (_jsx("span", { role: "alert", className: "text-micro text-bad", children: fillCopy(copy.attachments.downloadFailed, {
84
+ name: title ?? copy.attachments.files,
85
+ }) })) : null] })) : null;
86
+ const count = (_jsx("span", { className: "rounded-pill bg-ink/6 px-1.5 text-micro font-medium text-muted tabular-nums", children: files.length }));
87
+ if (title !== undefined && collapsible) {
88
+ return (_jsx("div", { "data-ui": "file-list", "data-layout": layout, className: "min-w-0", children: _jsx(Disclosure, { title: _jsxs("span", { id: titleId, className: "inline-flex items-center gap-2", children: [title, count] }), defaultExpanded: defaultOpen, children: _jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [list, all] }) }) }));
89
+ }
90
+ return (_jsxs("div", { "data-ui": "file-list", "data-layout": layout, className: "flex min-w-0 flex-col gap-2", children: [title === undefined ? null : (_jsxs("p", { id: titleId, className: "flex items-center gap-2 text-meta font-medium text-ink", children: [title, count] })), list, all] }));
91
+ }
@@ -0,0 +1,13 @@
1
+ import { type AttachmentFile, type AttachmentKind } from "./files.js";
2
+ /** The type, at the size of a row: the image itself when there is one, otherwise the icon
3
+ * of its kind over its extension. The extension is written because three of the five
4
+ * icons are a page with lines on it — «PDF» and «DOCX» are what tell them apart, and a
5
+ * word is never a colour that only some people see.
6
+ *
7
+ * `sm` is the icon alone, for a line of text (a list of a release's assets): the name next
8
+ * to it already ends in its extension. */
9
+ export declare function FileThumb({ file, kind, size, }: {
10
+ file: AttachmentFile;
11
+ kind: AttachmentKind;
12
+ size?: "sm" | "md";
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { fileExtension, } from "./files.js";
3
+ import { File, FileImage, FileSpreadsheet, FileText, FileType, } from "lucide-react";
4
+ /* ==================================================================== *
5
+ * FILE THUMB — what a file is, at the size of a row: shared by the record's list
6
+ * (`Attachments`) and the files inside a message or a section (`FileList`), so a PDF looks
7
+ * the same wherever it appears.
8
+ * ==================================================================== */
9
+ const KIND_ICON = {
10
+ image: FileImage,
11
+ pdf: FileText,
12
+ sheet: FileSpreadsheet,
13
+ doc: FileType,
14
+ other: File,
15
+ };
16
+ /** The type, at the size of a row: the image itself when there is one, otherwise the icon
17
+ * of its kind over its extension. The extension is written because three of the five
18
+ * icons are a page with lines on it — «PDF» and «DOCX» are what tell them apart, and a
19
+ * word is never a colour that only some people see.
20
+ *
21
+ * `sm` is the icon alone, for a line of text (a list of a release's assets): the name next
22
+ * to it already ends in its extension. */
23
+ export function FileThumb({ file, kind, size = "md", }) {
24
+ const Icon = KIND_ICON[kind];
25
+ if (size === "sm") {
26
+ return (_jsx(Icon, { "aria-hidden": true, className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75 }));
27
+ }
28
+ const picture = kind === "image" && file.status !== "failed" ? (file.thumbnail ?? file.url) : undefined;
29
+ const extension = fileExtension(file.name).slice(0, 4);
30
+ return (
31
+ /* Decorative: the name next to it says which file it is, and the image's `alt` would
32
+ say it twice. */
33
+ _jsx("span", { "aria-hidden": true, className: "flex size-(--size-control-lg) shrink-0 flex-col items-center justify-center gap-0.5 overflow-clip rounded-control border border-line bg-ink/4 text-muted", children: picture === undefined ? (_jsxs(_Fragment, { children: [_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 1.75 }), extension === "" ? null : (_jsx("span", { className: "text-micro leading-none font-medium uppercase", children: extension }))] })) : (_jsx("img", { src: picture, alt: "", loading: "lazy", className: "size-full object-cover" })) }));
34
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Saves `source` — a `Blob` already in memory, or a URL the browser can reach — as `name`.
3
+ *
4
+ * A `Blob` gets an object URL for the length of the click and is released after it, so a
5
+ * 40 MB PDF does not stay pinned in the tab. A URL on another origin ignores `download` (the
6
+ * browser's rule, not ours): it opens instead of saving, and the server should send
7
+ * `Content-Disposition: attachment` — or the application fetches it and passes the `Blob`.
8
+ */
9
+ export declare function downloadFile(source: Blob | string, name: string): void;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ /* ==================================================================== *
3
+ * DOWNLOAD — save a file the application fetched by code, with its name.
4
+ *
5
+ * Context: a link with `download` is the best download there is — the browser streams it to
6
+ * disk, middle-click and «save as» work — and `FileList` uses one whenever the file has a
7
+ * `url`. But some files are not behind a plain URL: the request needs a token in a header,
8
+ * the server signs a URL on demand, an Odoo attachment comes through an RPC. Then the
9
+ * application fetches the bytes and has a `Blob` in its hand, and saving it with the right
10
+ * name is the same ten lines in every application. They are here once.
11
+ *
12
+ * onDownload={async (file) => downloadFile(await api.attachment(file.id), file.name)}
13
+ * ==================================================================== */
14
+ /**
15
+ * Saves `source` — a `Blob` already in memory, or a URL the browser can reach — as `name`.
16
+ *
17
+ * A `Blob` gets an object URL for the length of the click and is released after it, so a
18
+ * 40 MB PDF does not stay pinned in the tab. A URL on another origin ignores `download` (the
19
+ * browser's rule, not ours): it opens instead of saving, and the server should send
20
+ * `Content-Disposition: attachment` — or the application fetches it and passes the `Blob`.
21
+ */
22
+ export function downloadFile(source, name) {
23
+ const href = typeof source === "string" ? source : URL.createObjectURL(source);
24
+ const link = document.createElement("a");
25
+ link.href = href;
26
+ link.download = name;
27
+ link.rel = "noopener";
28
+ /* Firefox only follows a click on a link that is in the document. */
29
+ link.style.display = "none";
30
+ document.body.append(link);
31
+ link.click();
32
+ link.remove();
33
+ /* Released on the next task, not now: Safari reads the object URL after `click` returns. */
34
+ if (typeof source !== "string")
35
+ setTimeout(() => URL.revokeObjectURL(href), 0);
36
+ }
@@ -1,3 +1,31 @@
1
+ export type AttachmentStatus = "ready" | "uploading" | "failed";
2
+ export type AttachmentFile = {
3
+ /** The attachment's identity: the server's id, or a local key while it uploads. */
4
+ id: string;
5
+ /** The file name as it was saved: «Factura proveedor 0418.pdf». */
6
+ name: string;
7
+ /** In bytes. Written in the copy's locale: «1,2 MB». */
8
+ size?: number;
9
+ /** The MIME type, when the server knows it. With the name, it picks the icon. */
10
+ type?: string;
11
+ /** Where it downloads from. Absent = no download (still uploading, or not allowed). */
12
+ url?: string;
13
+ /** A small image for the thumbnail. Defaults to `url` for an image — pass a smaller one
14
+ * when the server has it, so a list of 4 MB photos does not load 4 MB photos. */
15
+ thumbnail?: string;
16
+ /** Who added it. */
17
+ by?: string;
18
+ /** Their face, for the chip. */
19
+ byAvatar?: string;
20
+ /** When it was added. */
21
+ at?: Date | string | number;
22
+ /** `ready` by default. The application owns it: it is what the upload is really doing. */
23
+ status?: AttachmentStatus;
24
+ /** 0 to 100 while `uploading`. Absent = under way without a figure yet. */
25
+ progress?: number;
26
+ /** Why it `failed`, in the server's words. */
27
+ error?: string;
28
+ };
1
29
  /** The five kinds a list of attachments tells apart. Five and not twenty: the icon is there
2
30
  * to say «this one is the spreadsheet» at a glance, and twenty icons are read, not seen. */
3
31
  export type AttachmentKind = "image" | "pdf" | "sheet" | "doc" | "other";
@@ -1,2 +1,4 @@
1
- export { type AttachmentFile, Attachments, type AttachmentsProps, type AttachmentStatus, } from "./Attachments.js";
2
- export { type AttachmentKind, attachmentKind, fileExtension, formatFileSize, } from "./files.js";
1
+ export { Attachments, type AttachmentsProps, } from "./Attachments.js";
2
+ export { downloadFile } from "./download.js";
3
+ export { FileList, type FileListLayout, type FileListProps, } from "./FileList.js";
4
+ export { type AttachmentFile, type AttachmentKind, attachmentKind, type AttachmentStatus, fileExtension, formatFileSize, } from "./files.js";
@@ -1,3 +1,6 @@
1
- /* ATTACHMENTS — the files of a record: what they are, who brought them, and what to do with them. */
1
+ /* ATTACHMENTS — the files of a record (`Attachments`: add, remove, undo), files shown inside a
2
+ message, a card or a section (`FileList`), and how to save one fetched by code. */
2
3
  export { Attachments, } from "./Attachments.js";
4
+ export { downloadFile } from "./download.js";
5
+ export { FileList, } from "./FileList.js";
3
6
  export { attachmentKind, fileExtension, formatFileSize, } from "./files.js";
@@ -1,3 +1,4 @@
1
+ import "@sincpro/web-ui/components/calendar/calendar.css";
1
2
  import type { Tone } from "../../foundations/types.js";
2
3
  import type { ReactNode } from "react";
3
4
  export type CalendarView = "month" | "week" | "day" | "agenda";
@@ -39,7 +40,7 @@ export type RecordCalendarProps<T> = {
39
40
  * Records on a calendar — Odoo's calendar view: meetings, deliveries, due dates.
40
41
  *
41
42
  * Context: drawn by FullCalendar v7 (MIT standard views: month, week, day, agenda), dressed by
42
- * `tokens.css` (its `forma` palette points at web-ui's tokens, so it follows the theme). It is a
43
+ * `calendar.css` (its `forma` palette points at web-ui's tokens, so it follows the theme). It is a
43
44
  * CONTROLLED view of the records: dragging or stretching an event reports `onMove` and the
44
45
  * library's own change is undone at once — the app persists and passes the new `items`, so the
45
46
  * screen never shows a date the backend refused. Resource rows (per person, per room) are
@@ -1,5 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /* FullCalendar's stylesheet and its palette in web-ui's tokens: imported here, not in
4
+ `tokens.css`, so it travels in the calendar's chunk. */
5
+ import "@sincpro/web-ui/components/calendar/calendar.css";
3
6
  import FullCalendar from "@fullcalendar/react";
4
7
  import dayGridPlugin from "@fullcalendar/react/daygrid";
5
8
  import interactionPlugin from "@fullcalendar/react/interaction";
@@ -29,7 +32,7 @@ const TONE_COLOR = {
29
32
  * Records on a calendar — Odoo's calendar view: meetings, deliveries, due dates.
30
33
  *
31
34
  * Context: drawn by FullCalendar v7 (MIT standard views: month, week, day, agenda), dressed by
32
- * `tokens.css` (its `forma` palette points at web-ui's tokens, so it follows the theme). It is a
35
+ * `calendar.css` (its `forma` palette points at web-ui's tokens, so it follows the theme). It is a
33
36
  * CONTROLLED view of the records: dragging or stretching an event reports `onMove` and the
34
37
  * library's own change is undone at once — the app persists and passes the new `items`, so the
35
38
  * screen never shows a date the backend refused. Resource rows (per person, per room) are
@@ -0,0 +1,37 @@
1
+ /* ====================================================================
2
+ * THE RECORD CALENDAR (FullCalendar v7, `forma` theme) in these tokens.
3
+ *
4
+ * Context: FullCalendar's structure and its `forma` theme, then the palette that theme reads.
5
+ * It comes with `RecordCalendar` — imported by the component, not by `tokens.css` — so it
6
+ * travels in the calendar's chunk: a screen that never opens a calendar never downloads it.
7
+ *
8
+ * The theme reads a palette of `--fc-forma-*` variables. Pointed at web-ui's tokens it takes
9
+ * the theme — light, dark, a brand — with no dark block of its own: the tokens already flip.
10
+ * Aliases, so no contrast of their own to measure; the translucent washes are mixed from the
11
+ * ink so they read on either theme.
12
+ * ==================================================================== */
13
+ @import "@fullcalendar/react/skeleton.css";
14
+ @import "@fullcalendar/react/themes/forma/theme.css";
15
+
16
+ :root {
17
+ --fc-forma-primary: var(--color-primary);
18
+ --fc-forma-primary-over: var(--color-primary-hover);
19
+ --fc-forma-primary-down: var(--color-primary-hover);
20
+ --fc-forma-primary-foreground: var(--color-surface);
21
+ --fc-forma-event: var(--color-primary);
22
+ --fc-forma-event-contrast: var(--color-surface);
23
+ --fc-forma-background-event: var(--color-primary);
24
+ --fc-forma-highlight: color-mix(in srgb, var(--color-primary) 18%, transparent);
25
+ --fc-forma-background: var(--color-surface);
26
+ --fc-forma-faint: color-mix(in srgb, var(--color-ink) 3%, transparent);
27
+ --fc-forma-muted: color-mix(in srgb, var(--color-ink) 7%, transparent);
28
+ --fc-forma-strong: color-mix(in srgb, var(--color-ink) 12%, transparent);
29
+ --fc-forma-stronger: color-mix(in srgb, var(--color-ink) 16%, transparent);
30
+ --fc-forma-strongest: color-mix(in srgb, var(--color-ink) 20%, transparent);
31
+ --fc-forma-foreground: var(--color-ink);
32
+ --fc-forma-faint-foreground: var(--color-muted);
33
+ --fc-forma-muted-foreground: var(--color-muted);
34
+ --fc-forma-border: var(--color-line);
35
+ --fc-forma-muted-border: var(--color-line);
36
+ --fc-forma-strong-border: var(--color-line-strong);
37
+ }
@@ -1,3 +1,4 @@
1
+ import type { AttachmentFile } from "../attachments/files.js";
1
2
  import { type ChatMessage } from "./model.js";
2
3
  export type ChatThreadProps = {
3
4
  messages: readonly ChatMessage[];
@@ -9,5 +10,11 @@ export type ChatThreadProps = {
9
10
  label?: string;
10
11
  /** The «now» the day names are relative to. */
11
12
  now?: Date;
13
+ /** Open a file a message carries. Present = its name is a button; WHERE it opens — a
14
+ * peek, a `FilePreview` — is the application's. */
15
+ onOpenFile?: (file: AttachmentFile, message: ChatMessage) => void;
16
+ /** Download a file a message carries by code (a token, a signed URL). Without it, a file
17
+ * with a `url` downloads by link. Busy while the promise runs; a rejection is said. */
18
+ onDownloadFile?: (file: AttachmentFile, message: ChatMessage) => void | Promise<unknown>;
12
19
  };
13
- export declare function ChatThread({ messages, onLoadOlder, loadingOlder, label, now, }: ChatThreadProps): import("react").JSX.Element;
20
+ export declare function ChatThread({ messages, onLoadOlder, loadingOlder, label, now, onOpenFile, onDownloadFile, }: ChatThreadProps): import("react").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { FileList } from "../attachments/FileList.js";
3
4
  import { dayLabel, groupByDay, startsRun, } from "./model.js";
4
5
  import { useUiCopy } from "../../foundations/copy.js";
5
6
  import { Button } from "../../primitives/button/Button.js";
@@ -33,7 +34,7 @@ import { useLayoutEffect, useRef, useState } from "react";
33
34
  * ==================================================================== */
34
35
  /** How close to the bottom still counts as «at the bottom», in pixels. */
35
36
  const AT_BOTTOM = 48;
36
- export function ChatThread({ messages, onLoadOlder, loadingOlder = false, label, now, }) {
37
+ export function ChatThread({ messages, onLoadOlder, loadingOlder = false, label, now, onOpenFile, onDownloadFile, }) {
37
38
  const copy = useUiCopy();
38
39
  const scroller = useRef(null);
39
40
  /* A ref, not state: the scroll handler writes it on every frame and nothing
@@ -67,10 +68,14 @@ export function ChatThread({ messages, onLoadOlder, loadingOlder = false, label,
67
68
  const words = { today: copy.chat.today, yesterday: copy.chat.yesterday };
68
69
  return (_jsxs("div", { className: "relative flex min-h-0 flex-1 flex-col", children: [_jsxs("div", { ref: scroller, role: "log",
69
70
  /* A scrollable region is reachable by keyboard (axe): the arrows scroll it. */
70
- tabIndex: 0, "aria-label": label ?? copy.chat.thread, "aria-live": "polite", onScroll: onScroll, className: "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-5 py-4", children: [onLoadOlder === undefined ? null : (_jsx("div", { className: "flex justify-center pb-3", children: _jsx(Button, { role: "ghost", size: "sm", disabled: loadingOlder, onClick: onLoadOlder, children: loadingOlder ? copy.chat.loadingOlder : copy.chat.loadOlder }) })), messages.length === 0 ? _jsx(Empty, { sentence: copy.chat.empty }) : null, groups.map((group) => (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("div", { className: "my-3 flex justify-center", children: _jsx("span", { className: "rounded-control border border-line bg-surface px-3 py-0.5 text-micro font-medium text-muted", children: dayLabel(group.day, clock, words, copy.locale) }) }), group.messages.map((message, index) => (_jsx(Bubble, { message: message, first: startsRun(group.messages, index), locale: copy.locale }, message.id)))] }, group.key)))] }), showJump ? (_jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-3 flex justify-center", children: _jsx("div", { className: "pointer-events-auto", children: _jsx(Button, { role: "secondary", size: "sm", onClick: toLatest, children: copy.chat.jumpLatest }) }) })) : null] }));
71
+ tabIndex: 0, "aria-label": label ?? copy.chat.thread, "aria-live": "polite", onScroll: onScroll, className: "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-5 py-4", children: [onLoadOlder === undefined ? null : (_jsx("div", { className: "flex justify-center pb-3", children: _jsx(Button, { role: "ghost", size: "sm", disabled: loadingOlder, onClick: onLoadOlder, children: loadingOlder ? copy.chat.loadingOlder : copy.chat.loadOlder }) })), messages.length === 0 ? _jsx(Empty, { sentence: copy.chat.empty }) : null, groups.map((group) => (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("div", { className: "my-3 flex justify-center", children: _jsx("span", { className: "rounded-control border border-line bg-surface px-3 py-0.5 text-micro font-medium text-muted", children: dayLabel(group.day, clock, words, copy.locale) }) }), group.messages.map((message, index) => (_jsx(Bubble, { message: message, first: startsRun(group.messages, index), locale: copy.locale, onOpenFile: onOpenFile, onDownloadFile: onDownloadFile }, message.id)))] }, group.key)))] }), showJump ? (_jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-3 flex justify-center", children: _jsx("div", { className: "pointer-events-auto", children: _jsx(Button, { role: "secondary", size: "sm", onClick: toLatest, children: copy.chat.jumpLatest }) }) })) : null] }));
71
72
  }
72
- function Bubble({ message, first, locale, }) {
73
+ function Bubble({ message, first, locale, onOpenFile, onDownloadFile, }) {
73
74
  const copy = useUiCopy();
74
75
  const time = new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit" }).format(message.at);
75
- return (_jsx("div", { className: `flex ${message.mine ? "justify-end" : "justify-start"} ${first ? "mt-2" : ""}`, children: _jsxs("div", { className: `max-w-prose rounded-control border px-3 py-2 ${message.mine ? "border-primary/30 bg-primary/10" : "border-line bg-surface"} ${message.pending === true ? "opacity-70" : ""}`, children: [first && !message.mine ? (_jsx("p", { className: "text-meta font-medium text-muted", children: message.author })) : null, _jsx("p", { className: "text-body break-words whitespace-pre-wrap text-ink", children: message.body }), _jsxs("p", { className: "mt-1 text-micro text-muted", children: [_jsx("time", { dateTime: message.at.toISOString(), children: time }), message.pending === true ? ` · ${copy.chat.sending}` : null] })] }) }));
76
+ return (_jsx("div", { className: `flex ${message.mine ? "justify-end" : "justify-start"} ${first ? "mt-2" : ""}`, children: _jsxs("div", { className: `max-w-prose rounded-control border px-3 py-2 ${message.mine ? "border-primary/30 bg-primary/10" : "border-line bg-surface"} ${message.pending === true ? "border-dashed" : ""}`, children: [first && !message.mine ? (_jsx("p", { className: "text-meta font-medium text-muted", children: message.author })) : null, message.body === "" ? null : (_jsx("p", { className: "text-body break-words whitespace-pre-wrap text-ink", children: message.body })), message.files === undefined ? null : (_jsx("div", { className: "mt-1.5", children: _jsx(FileList, { files: message.files, ...(onOpenFile === undefined
77
+ ? {}
78
+ : { onOpen: (file) => onOpenFile(file, message) }), ...(onDownloadFile === undefined
79
+ ? {}
80
+ : { onDownload: (file) => onDownloadFile(file, message) }) }) })), _jsxs("p", { className: "mt-1 text-micro text-muted", children: [_jsx("time", { dateTime: message.at.toISOString(), children: time }), message.pending === true ? ` · ${copy.chat.sending}` : null] })] }) }));
76
81
  }
@@ -1,3 +1,4 @@
1
+ import type { AttachmentFile } from "../attachments/files.js";
1
2
  export type ChatMessage = {
2
3
  id: string;
3
4
  /** Who wrote it, as the screen names them: «Ana Ruiz». */
@@ -9,6 +10,9 @@ export type ChatMessage = {
9
10
  mine?: boolean;
10
11
  /** Sent but not yet confirmed by the server. Said, never a silent success. */
11
12
  pending?: boolean;
13
+ /** The files it carries, drawn under the text as cards (`FileList`). A message may be
14
+ * only its files: then `body` is empty. One still uploading says so with its progress. */
15
+ files?: readonly AttachmentFile[];
12
16
  };
13
17
  export type DayGroup = {
14
18
  /** `YYYY-MM-DD` in local time: a stable key, and the day's identity. */
@@ -1,3 +1,4 @@
1
+ import "@sincpro/web-ui/components/gantt/gantt.css";
1
2
  /** A dependency between two records: «B starts when A ends» (`e2s`, the usual one). */
2
3
  export type GanttLink = {
3
4
  id: string;
@@ -35,7 +36,14 @@ export type RecordGanttProps<T> = {
35
36
  * Records on a timeline — Odoo's Gantt view: projects, tasks, manufacturing orders.
36
37
  *
37
38
  * Context: drawn by SVAR React Gantt (MIT core: move, resize, progress, dependencies, zoom),
38
- * dressed by `tokens.css` (its Willow theme's `--wx-*` variables point at web-ui's tokens).
39
+ * dressed by `gantt.css` — SVAR's stylesheet and its Willow theme's `--wx-*` variables pointed
40
+ * at web-ui's tokens —, imported here so it travels in the Gantt's chunk.
41
+ *
42
+ * The chart is drawn in the browser only: SVAR paints its grid with a canvas, which a server
43
+ * does not have, so a server-rendered chart (Next.js) would not match the browser's first
44
+ * render. The server — and the hydrating pass — draw the skeleton; the chart comes right
45
+ * after. An SPA, which does not hydrate, draws the chart at once.
46
+ *
39
47
  * The chart keeps its own state while dragging; every finished change is reported (`onMove`,
40
48
  * `onProgress`) and the app passes the saved `items` back, which the chart re-reads. Without
41
49
  * `onMove` / `onProgress` it is read-only. Auto-scheduling, critical path and resource load are
@@ -1,9 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import "@sincpro/web-ui/components/gantt/gantt.css";
3
4
  import { TimelineToolbar } from "../timeline/TimelineToolbar.js";
4
5
  import { useUiCopy } from "../../foundations/copy.js";
6
+ import { Skeleton } from "../../primitives/notice/Notice.js";
5
7
  import { Gantt, Willow } from "@svar-ui/react-gantt";
6
- import { useEffect, useMemo, useRef, useState } from "react";
8
+ import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
9
+ /* Nothing to listen to: the answer («is this a browser?») never changes after the first
10
+ render. Only the hydrating pass reads the server's `false`. */
11
+ const subscribe = () => () => { };
7
12
  /* The two rows of the time scale per zoom, written with `Intl` in the system's language
8
13
  (SVAR's own format strings would ignore it), and how wide one cell of the finer row is. */
9
14
  function scalesOf(zoom, locale) {
@@ -40,7 +45,14 @@ function scalesOf(zoom, locale) {
40
45
  * Records on a timeline — Odoo's Gantt view: projects, tasks, manufacturing orders.
41
46
  *
42
47
  * Context: drawn by SVAR React Gantt (MIT core: move, resize, progress, dependencies, zoom),
43
- * dressed by `tokens.css` (its Willow theme's `--wx-*` variables point at web-ui's tokens).
48
+ * dressed by `gantt.css` — SVAR's stylesheet and its Willow theme's `--wx-*` variables pointed
49
+ * at web-ui's tokens —, imported here so it travels in the Gantt's chunk.
50
+ *
51
+ * The chart is drawn in the browser only: SVAR paints its grid with a canvas, which a server
52
+ * does not have, so a server-rendered chart (Next.js) would not match the browser's first
53
+ * render. The server — and the hydrating pass — draw the skeleton; the chart comes right
54
+ * after. An SPA, which does not hydrate, draws the chart at once.
55
+ *
44
56
  * The chart keeps its own state while dragging; every finished change is reported (`onMove`,
45
57
  * `onProgress`) and the app passes the saved `items` back, which the chart re-reads. Without
46
58
  * `onMove` / `onProgress` it is read-only. Auto-scheduling, critical path and resource load are
@@ -77,6 +89,7 @@ export function RecordGantt({ items, keyOf, titleOf, startOf, endOf, progressOf,
77
89
  };
78
90
  });
79
91
  const editable = onMove !== undefined || onProgress !== undefined;
92
+ const inBrowser = useSyncExternalStore(subscribe, () => true, () => false);
80
93
  /* The chart reports through its store's actions: `update-task` for a move, a stretch or the
81
94
  progress handle — the finished one, not every pixel of the drag (`inProgress`). */
82
95
  const init = (api) => {
@@ -106,5 +119,5 @@ export function RecordGantt({ items, keyOf, titleOf, startOf, endOf, progressOf,
106
119
  void root.current?.requestFullscreen?.();
107
120
  else if (document.fullscreenElement !== null)
108
121
  void document.exitFullscreen();
109
- } }), _jsx("div", { className: "min-h-0 flex-1", children: _jsx(Willow, { fonts: false, children: _jsx(Gantt, { tasks: tasks, links: links.map((link) => ({ ...link, type: link.type ?? "e2s" })), scales: time.scales, cellWidth: cellWidth, readonly: !editable, columns: [{ id: "text", header: nameHeader ?? "", width: 260 }], init: init }) }) })] }));
122
+ } }), _jsx("div", { className: "min-h-0 flex-1", children: inBrowser ? (_jsx(Willow, { fonts: false, children: _jsx(Gantt, { tasks: tasks, links: links.map((link) => ({ ...link, type: link.type ?? "e2s" })), scales: time.scales, cellWidth: cellWidth, readonly: !editable, columns: [{ id: "text", header: nameHeader ?? "", width: 260 }], init: init }) })) : (_jsx(Skeleton, { label: copy.failed.loading })) })] }));
110
123
  }
@@ -0,0 +1,52 @@
1
+ /* ====================================================================
2
+ * THE RECORD GANTT (SVAR, Willow theme) in these tokens.
3
+ *
4
+ * Context: SVAR's stylesheet (~160 KB, Willow included), then its variables pointed at
5
+ * web-ui's tokens. It comes with `RecordGantt` — imported by the component, not by
6
+ * `tokens.css` — so it travels in the Gantt's chunk: a screen that never opens a Gantt never
7
+ * downloads it.
8
+ *
9
+ * Willow DECLARES its `--wx-*` on `.wx-willow-theme`; redeclared on the same class here, after
10
+ * its import in the same file, they win — whenever the chunk arrives. Bars are the navy of the
11
+ * system, a summary the ink, a milestone the info tone; the type is the system's. Aliases:
12
+ * they flip with the theme.
13
+ * ==================================================================== */
14
+ @import "@svar-ui/react-gantt/all.css";
15
+
16
+ .wx-willow-theme {
17
+ --wx-color-primary: var(--color-primary);
18
+ --wx-color-primary-selected: color-mix(in srgb, var(--color-primary) 14%, transparent);
19
+ --wx-color-primary-font: var(--color-surface);
20
+ --wx-color-secondary-hover: color-mix(in srgb, var(--color-primary) 10%, transparent);
21
+ --wx-color-success: var(--color-good);
22
+ --wx-color-warning: var(--color-warn);
23
+ --wx-color-info: var(--color-info);
24
+ --wx-color-danger: var(--color-danger);
25
+ --wx-color-font: var(--color-ink);
26
+ --wx-color-font-alt: var(--color-muted);
27
+ --wx-background: var(--color-surface);
28
+ --wx-background-alt: var(--color-ground);
29
+ --wx-background-hover: color-mix(in srgb, var(--color-ink) 5%, transparent);
30
+ --wx-font-family: inherit;
31
+ --wx-font-size: var(--text-meta);
32
+ --wx-font-size-sm: var(--text-micro);
33
+ --wx-icon-color: var(--color-muted);
34
+ --wx-border-color: var(--color-line);
35
+ --wx-border-radius: var(--radius-control);
36
+ --wx-radius-major: var(--radius-box);
37
+ --wx-gantt-border-color: var(--color-line);
38
+ --wx-gantt-task-color: var(--color-primary);
39
+ --wx-gantt-task-fill-color: var(--color-primary-hover);
40
+ --wx-gantt-task-border-color: var(--color-primary-hover);
41
+ --wx-gantt-task-font-color: var(--color-surface);
42
+ --wx-gantt-summary-color: var(--color-line-strong);
43
+ --wx-gantt-summary-fill-color: color-mix(in srgb, var(--color-ink) 45%, transparent);
44
+ --wx-gantt-summary-border-color: var(--color-line-strong);
45
+ --wx-gantt-summary-font-color: var(--color-ink);
46
+ --wx-gantt-milestone-color: var(--color-info);
47
+ --wx-gantt-select-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
48
+ --wx-gantt-link-color: var(--color-muted);
49
+ --wx-gantt-link-color-hovered: var(--color-ink);
50
+ --wx-gantt-holiday-background: var(--color-ground);
51
+ --wx-gantt-holiday-color: var(--color-muted);
52
+ }
@@ -904,6 +904,12 @@ export type UiCopy = {
904
904
  /** A failed upload, when the server did not say why. */
905
905
  failed: string;
906
906
  retry: string;
907
+ /** The name of a `FileList` that has no title of its own. */
908
+ files: string;
909
+ /** Every file of a `FileList` at once (`onDownloadAll`). */
910
+ downloadAll: string;
911
+ /** A download by code (`onDownload`) failed. `{name}` is the file. */
912
+ downloadFailed: string;
907
913
  };
908
914
  /** The field picker that walks relations: «Líneas > Impuestos > Monto». */
909
915
  fieldPath: {
@@ -602,6 +602,9 @@ export const SPANISH_COPY = {
602
602
  cancelUpload: "Cancelar la subida",
603
603
  failed: "No se pudo subir el archivo.",
604
604
  retry: "Reintentar",
605
+ files: "Archivos",
606
+ downloadAll: "Descargar todo",
607
+ downloadFailed: "No se pudo descargar «{name}».",
605
608
  },
606
609
  fieldPath: {
607
610
  choose: "Elegir un campo",
@@ -597,6 +597,9 @@ export const ENGLISH_COPY = {
597
597
  cancelUpload: "Cancel the upload",
598
598
  failed: "The file could not be uploaded.",
599
599
  retry: "Try again",
600
+ files: "Files",
601
+ downloadAll: "Download all",
602
+ downloadFailed: "«{name}» could not be downloaded.",
600
603
  },
601
604
  fieldPath: {
602
605
  choose: "Choose a field",
@@ -115,6 +115,10 @@ export type IconButtonProps = NativeProps<"button", "type" | "disabled" | "title
115
115
  /** The system's `Tooltip` with the `label`, on hover and focus. On by default; `false`
116
116
  * falls back to the native `title`. */
117
117
  tooltip?: boolean;
118
+ /** What it started is running — a download fetched by code. As `Button`'s: it keeps the
119
+ * focus, says so (`aria-busy`, a turning mark in place of the icon) and ignores presses
120
+ * until it is done — never `disabled`, which drops the focus to the page. */
121
+ busy?: boolean;
118
122
  };
119
123
  /** Only an icon, and that is why the label is mandatory even though it is not
120
124
  * drawn.
@@ -123,7 +127,7 @@ export type IconButtonProps = NativeProps<"button", "type" | "disabled" | "title
123
127
  * most frequent action of a row was the hardest one to hit. Here it has its
124
128
  * full control height and a background on hover — the target is the same as
125
129
  * that of a button with text, only without the text. */
126
- export declare function IconButton({ icon: Icon, label, size, surface: surfaceProp, tone, disabled, type, expanded, haspopup, tooltip, ref, ...native }: IconButtonProps): import("react").JSX.Element;
130
+ export declare function IconButton({ icon: Icon, label, size, surface: surfaceProp, tone, disabled, type, expanded, haspopup, tooltip, busy, ref, onClick, ...native }: IconButtonProps): import("react").JSX.Element;
127
131
  export type IconLinkProps = NativeProps<"a", "href" | "download" | "title" | "aria-label"> & {
128
132
  icon: LucideIcon;
129
133
  label: string;
@@ -226,10 +226,17 @@ function Labelled({ label, tooltip, children, }) {
226
226
  * most frequent action of a row was the hardest one to hit. Here it has its
227
227
  * full control height and a background on hover — the target is the same as
228
228
  * that of a button with text, only without the text. */
229
- export function IconButton({ icon: Icon, label, size = "sm", surface: surfaceProp, tone = "normal", disabled = false, type = "button", expanded, haspopup, tooltip = true, ref, ...native }) {
229
+ export function IconButton({ icon: Icon, label, size = "sm", surface: surfaceProp, tone = "normal", disabled = false, type = "button", expanded, haspopup, tooltip = true, busy = false, ref, onClick, ...native }) {
230
230
  const surface = useSurface(surfaceProp);
231
231
  const ic = ICON[size];
232
- return (_jsx(Labelled, { label: label, tooltip: tooltip, children: (title) => (_jsx("button", { ...native, ref: ref, type: type, title: title, "aria-label": label, disabled: disabled, ...popupAttrs(expanded, haspopup), "data-ui": "icon-button", "data-tone": tone, "data-size": size, "data-surface": surface, className: `${BOX} disabled:pointer-events-none disabled:opacity-45 ${SQUARE[size]} ${TONE[tone][surface]}`, children: _jsx(Icon, { className: ic.size, strokeWidth: ic.stroke, "aria-hidden": true }) })) }));
232
+ const Mark = busy ? LoaderCircle : Icon;
233
+ return (_jsx(Labelled, { label: label, tooltip: tooltip, children: (title) => (_jsx("button", { ...native, ref: ref, type: type, title: title, "aria-label": label, disabled: disabled, ...(busy ? { "aria-busy": true, "aria-disabled": true } : {}), onClick: (event) => {
234
+ if (busy) {
235
+ event.preventDefault();
236
+ return;
237
+ }
238
+ onClick?.(event);
239
+ }, ...popupAttrs(expanded, haspopup), "data-ui": "icon-button", "data-tone": tone, "data-size": size, "data-surface": surface, className: `${BOX} disabled:pointer-events-none disabled:opacity-45 ${SQUARE[size]} ${TONE[tone][surface]}${busy ? " cursor-progress" : ""}`, children: _jsx(Mark, { className: `${ic.size}${busy ? " motion-safe:animate-spin" : ""}`, strokeWidth: ic.stroke, "aria-hidden": true }) })) }));
233
240
  }
234
241
  /**
235
242
  * The same icon, but it is a real link.
@@ -1,3 +1,4 @@
1
+ import "streamdown/styles.css";
1
2
  export type MarkdownProps = {
2
3
  /** The markdown source. Plain text is valid markdown too. */
3
4
  children: string;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import "streamdown/styles.css";
3
4
  import { Streamdown } from "streamdown";
4
5
  /* The document's own rhythm, in tokens. The arbitrary variants only select the
5
6
  descendants; every value is a token. A heading is the same size as the rest
package/dist/tokens.css CHANGED
@@ -11,15 +11,12 @@
11
11
  @import "@fontsource/ibm-plex-mono/latin-ext-400.css";
12
12
  @import "@fontsource/ibm-plex-mono/latin-500.css";
13
13
  @import "@fontsource/ibm-plex-mono/latin-ext-500.css";
14
- /* streamdown's animations for text that is still arriving (see Markdown). */
15
- @import "streamdown/styles.css";
16
- /* The record calendar (`RecordCalendar`, FullCalendar v7): its structure and the `forma`
17
- theme. The palette that theme reads is defined below, from web-ui's tokens. */
18
- @import "@fullcalendar/react/skeleton.css";
19
- @import "@fullcalendar/react/themes/forma/theme.css";
20
- /* The record Gantt (`RecordGantt`, SVAR): its styles, Willow theme included. Its variables
21
- are pointed at web-ui's tokens below. */
22
- @import "@svar-ui/react-gantt/all.css";
14
+ /* Only what every screen uses is imported here. A library's own stylesheet — the Gantt's
15
+ * (SVAR, ~160 KB), the calendar's (FullCalendar), markdown's (streamdown), React Flow's — is
16
+ * imported by the component that draws it, together with the mapping of its variables to
17
+ * these tokens (`gantt.css`, `calendar.css`, `canvas.css`), so it travels in that component's
18
+ * chunk: an application that never opens a Gantt never downloads its CSS.
19
+ * `tests/bundle.test.ts` keeps it that way. */
23
20
 
24
21
  @import "tailwindcss";
25
22
 
@@ -1179,82 +1176,6 @@
1179
1176
  --sc-icon: var(--size-icon-md);
1180
1177
  }
1181
1178
 
1182
- /* ====================================================================
1183
- * THE RECORD CALENDAR (FullCalendar v7, `forma` theme) in these tokens.
1184
- *
1185
- * Context: the theme reads a palette of `--fc-forma-*` variables. Pointed at web-ui's tokens it
1186
- * takes the theme — light, dark, a brand — with no dark block of its own: the tokens already
1187
- * flip. Aliases, so no contrast of their own to measure; the translucent washes are mixed from
1188
- * the ink so they read on either theme.
1189
- * ==================================================================== */
1190
- :root {
1191
- --fc-forma-primary: var(--color-primary);
1192
- --fc-forma-primary-over: var(--color-primary-hover);
1193
- --fc-forma-primary-down: var(--color-primary-hover);
1194
- --fc-forma-primary-foreground: var(--color-surface);
1195
- --fc-forma-event: var(--color-primary);
1196
- --fc-forma-event-contrast: var(--color-surface);
1197
- --fc-forma-background-event: var(--color-primary);
1198
- --fc-forma-highlight: color-mix(in srgb, var(--color-primary) 18%, transparent);
1199
- --fc-forma-background: var(--color-surface);
1200
- --fc-forma-faint: color-mix(in srgb, var(--color-ink) 3%, transparent);
1201
- --fc-forma-muted: color-mix(in srgb, var(--color-ink) 7%, transparent);
1202
- --fc-forma-strong: color-mix(in srgb, var(--color-ink) 12%, transparent);
1203
- --fc-forma-stronger: color-mix(in srgb, var(--color-ink) 16%, transparent);
1204
- --fc-forma-strongest: color-mix(in srgb, var(--color-ink) 20%, transparent);
1205
- --fc-forma-foreground: var(--color-ink);
1206
- --fc-forma-faint-foreground: var(--color-muted);
1207
- --fc-forma-muted-foreground: var(--color-muted);
1208
- --fc-forma-border: var(--color-line);
1209
- --fc-forma-muted-border: var(--color-line);
1210
- --fc-forma-strong-border: var(--color-line-strong);
1211
- }
1212
-
1213
- /* ====================================================================
1214
- * THE RECORD GANTT (SVAR, Willow theme) in these tokens.
1215
- *
1216
- * Context: Willow declares its `--wx-*` on `.wx-willow-theme`; redeclared on the same class
1217
- * here, later, they win. Bars are the navy of the system, a summary the ink, a milestone the
1218
- * info tone; the type is the system's. Aliases: they flip with the theme.
1219
- * ==================================================================== */
1220
- .wx-willow-theme {
1221
- --wx-color-primary: var(--color-primary);
1222
- --wx-color-primary-selected: color-mix(in srgb, var(--color-primary) 14%, transparent);
1223
- --wx-color-primary-font: var(--color-surface);
1224
- --wx-color-secondary-hover: color-mix(in srgb, var(--color-primary) 10%, transparent);
1225
- --wx-color-success: var(--color-good);
1226
- --wx-color-warning: var(--color-warn);
1227
- --wx-color-info: var(--color-info);
1228
- --wx-color-danger: var(--color-danger);
1229
- --wx-color-font: var(--color-ink);
1230
- --wx-color-font-alt: var(--color-muted);
1231
- --wx-background: var(--color-surface);
1232
- --wx-background-alt: var(--color-ground);
1233
- --wx-background-hover: color-mix(in srgb, var(--color-ink) 5%, transparent);
1234
- --wx-font-family: inherit;
1235
- --wx-font-size: var(--text-meta);
1236
- --wx-font-size-sm: var(--text-micro);
1237
- --wx-icon-color: var(--color-muted);
1238
- --wx-border-color: var(--color-line);
1239
- --wx-border-radius: var(--radius-control);
1240
- --wx-radius-major: var(--radius-box);
1241
- --wx-gantt-border-color: var(--color-line);
1242
- --wx-gantt-task-color: var(--color-primary);
1243
- --wx-gantt-task-fill-color: var(--color-primary-hover);
1244
- --wx-gantt-task-border-color: var(--color-primary-hover);
1245
- --wx-gantt-task-font-color: var(--color-surface);
1246
- --wx-gantt-summary-color: var(--color-line-strong);
1247
- --wx-gantt-summary-fill-color: color-mix(in srgb, var(--color-ink) 45%, transparent);
1248
- --wx-gantt-summary-border-color: var(--color-line-strong);
1249
- --wx-gantt-summary-font-color: var(--color-ink);
1250
- --wx-gantt-milestone-color: var(--color-info);
1251
- --wx-gantt-select-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
1252
- --wx-gantt-link-color: var(--color-muted);
1253
- --wx-gantt-link-color-hovered: var(--color-ink);
1254
- --wx-gantt-holiday-background: var(--color-ground);
1255
- --wx-gantt-holiday-color: var(--color-muted);
1256
- }
1257
-
1258
1179
  @layer base {
1259
1180
  /* No forced height anywhere: the document is exactly as tall as its content.
1260
1181
  * The color still has to reach the bottom of the viewport on a short page —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-ui",
3
- "version": "2.5.0",
3
+ "version": "2.6.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",