@sincpro/web-ui 2.5.0 → 2.7.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 (52) hide show
  1. package/README.md +97 -7
  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/components/search/CriteriaBuilder.d.ts +11 -2
  26. package/dist/components/search/CriteriaBuilder.js +25 -6
  27. package/dist/components/search/FilterBuilder.d.ts +63 -5
  28. package/dist/components/search/FilterBuilder.js +346 -50
  29. package/dist/components/search/RuleValue.d.ts +17 -0
  30. package/dist/components/search/RuleValue.js +121 -0
  31. package/dist/components/search/SearchBar.d.ts +25 -2
  32. package/dist/components/search/SearchBar.js +360 -39
  33. package/dist/components/search/context.d.ts +45 -0
  34. package/dist/components/search/context.js +25 -0
  35. package/dist/components/search/criteria.d.ts +20 -0
  36. package/dist/components/search/index.d.ts +7 -4
  37. package/dist/components/search/index.js +9 -3
  38. package/dist/components/search/model.d.ts +16 -1
  39. package/dist/components/search/model.js +5 -0
  40. package/dist/components/search/query.d.ts +88 -4
  41. package/dist/components/search/query.js +262 -62
  42. package/dist/components/search/records.d.ts +68 -0
  43. package/dist/components/search/records.js +115 -0
  44. package/dist/foundations/copy.d.ts +27 -0
  45. package/dist/foundations/copy.es.js +15 -0
  46. package/dist/foundations/copy.js +15 -0
  47. package/dist/primitives/button/Button.d.ts +5 -1
  48. package/dist/primitives/button/Button.js +9 -2
  49. package/dist/primitives/value/Markdown.d.ts +1 -0
  50. package/dist/primitives/value/Markdown.js +1 -0
  51. package/dist/tokens.css +6 -85
  52. package/package.json +1 -1
@@ -261,6 +261,24 @@ export type UiCopy = {
261
261
  /** The cut of a long phrase: a chip that does not fit in the bar says
262
262
  * nothing, and the builder is there to see it whole. */
263
263
  andMore: string;
264
+ /** A chip of values of ONE field: «Cliente: Andrés Pérez o Andrés Gutiérrez». */
265
+ valuesChip: string;
266
+ /** What a row that unfolds says it unfolds, after the field: «con «andres»». */
267
+ unfoldHint: string;
268
+ /** The ▸ of a row: show the records (or values) that match, and hide them again. */
269
+ unfold: string;
270
+ fold: string;
271
+ /** While the records of a relation are being searched; when none matches; when the search
272
+ * could not be done. */
273
+ searchingRecords: string;
274
+ noRecords: string;
275
+ recordsFailed: string;
276
+ /** The last record of an unfolded relation: the chooser with the whole list. */
277
+ moreRecords: string;
278
+ /** The way into the builder — in the dropdown, under what is offered, and in the panel. */
279
+ advanced: string;
280
+ /** The keys of the dropdown, said once at its foot. */
281
+ keysHint: string;
264
282
  placeholder: string;
265
283
  /** The titles of the three columns of the tools panel. */
266
284
  filters: string;
@@ -663,6 +681,9 @@ export type UiCopy = {
663
681
  ruleField: string;
664
682
  ruleOperator: string;
665
683
  noValue: string;
684
+ /** The value of a rule, when it is chosen and not written: an enum's word, a record. */
685
+ ruleValue: string;
686
+ chooseValue: string;
666
687
  from: string;
667
688
  to: string;
668
689
  value: string;
@@ -904,6 +925,12 @@ export type UiCopy = {
904
925
  /** A failed upload, when the server did not say why. */
905
926
  failed: string;
906
927
  retry: string;
928
+ /** The name of a `FileList` that has no title of its own. */
929
+ files: string;
930
+ /** Every file of a `FileList` at once (`onDownloadAll`). */
931
+ downloadAll: string;
932
+ /** A download by code (`onDownload`) failed. `{name}` is the file. */
933
+ downloadFailed: string;
907
934
  };
908
935
  /** The field picker that walks relations: «Líneas > Impuestos > Monto». */
909
936
  fieldPath: {
@@ -177,6 +177,16 @@ export const SPANISH_COPY = {
177
177
  joins: { all: "todas", any: "cualquiera", none: "ninguna" },
178
178
  notWord: "no",
179
179
  andMore: "y {count} más",
180
+ valuesChip: "{field}: {values}",
181
+ unfoldHint: "con «{text}»",
182
+ unfold: "ver los que coinciden",
183
+ fold: "ocultarlos",
184
+ searchingRecords: "Buscando…",
185
+ noRecords: "Ninguno coincide",
186
+ recordsFailed: "No se pudo buscar",
187
+ moreRecords: "Buscar más…",
188
+ advanced: "Búsqueda avanzada…",
189
+ keysHint: "↑↓ moverse · Enter poner · → abrir · Esc deshacer",
180
190
  landsHere: "acá cae lo próximo",
181
191
  closeGroup: "Cerrar este grupo",
182
192
  condition: "{field} {op} {value}",
@@ -439,6 +449,8 @@ export const SPANISH_COPY = {
439
449
  ruleField: "Campo",
440
450
  ruleOperator: "Comparación",
441
451
  noValue: "sin valor",
452
+ ruleValue: "Valor",
453
+ chooseValue: "Elegir…",
442
454
  from: "desde…",
443
455
  to: "hasta…",
444
456
  value: "valor…",
@@ -602,6 +614,9 @@ export const SPANISH_COPY = {
602
614
  cancelUpload: "Cancelar la subida",
603
615
  failed: "No se pudo subir el archivo.",
604
616
  retry: "Reintentar",
617
+ files: "Archivos",
618
+ downloadAll: "Descargar todo",
619
+ downloadFailed: "No se pudo descargar «{name}».",
605
620
  },
606
621
  fieldPath: {
607
622
  choose: "Elegir un campo",
@@ -154,6 +154,16 @@ export const ENGLISH_COPY = {
154
154
  askValue: "to what",
155
155
  condition: "{field} {op} {value}",
156
156
  andMore: "and {count} more",
157
+ valuesChip: "{field}: {values}",
158
+ unfoldHint: "matching “{text}”",
159
+ unfold: "show the ones that match",
160
+ fold: "hide them",
161
+ searchingRecords: "Searching…",
162
+ noRecords: "Nothing matches",
163
+ recordsFailed: "The search could not be done",
164
+ moreRecords: "Search more…",
165
+ advanced: "Advanced search…",
166
+ keysHint: "↑↓ move · Enter set · → open · Esc undo",
157
167
  placeholder: "search…",
158
168
  filters: "Filters",
159
169
  groupBy: "Group by",
@@ -429,6 +439,8 @@ export const ENGLISH_COPY = {
429
439
  ruleField: "Field",
430
440
  ruleOperator: "Comparison",
431
441
  noValue: "no value",
442
+ ruleValue: "Value",
443
+ chooseValue: "Choose…",
432
444
  from: "from…",
433
445
  to: "to…",
434
446
  value: "value…",
@@ -597,6 +609,9 @@ export const ENGLISH_COPY = {
597
609
  cancelUpload: "Cancel the upload",
598
610
  failed: "The file could not be uploaded.",
599
611
  retry: "Try again",
612
+ files: "Files",
613
+ downloadAll: "Download all",
614
+ downloadFailed: "«{name}» could not be downloaded.",
600
615
  },
601
616
  fieldPath: {
602
617
  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.7.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",