@sincpro/web-ui 1.5.0 → 1.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 (101) hide show
  1. package/dist/components/attachments/Attachments.d.ts +56 -0
  2. package/dist/components/attachments/Attachments.js +93 -0
  3. package/dist/components/attachments/files.d.ts +28 -0
  4. package/dist/components/attachments/files.js +100 -0
  5. package/dist/components/attachments/index.d.ts +2 -0
  6. package/dist/components/attachments/index.js +3 -0
  7. package/dist/components/flow/StepFlow.d.ts +37 -0
  8. package/dist/components/flow/StepFlow.js +74 -0
  9. package/dist/components/flow/index.d.ts +1 -0
  10. package/dist/components/flow/index.js +2 -0
  11. package/dist/components/index.d.ts +2 -0
  12. package/dist/components/index.js +2 -0
  13. package/dist/components/lines/LineItems.d.ts +14 -3
  14. package/dist/components/lines/LineItems.js +6 -4
  15. package/dist/components/listing/SortMenu.d.ts +24 -20
  16. package/dist/components/listing/SortMenu.js +51 -91
  17. package/dist/components/listing/index.d.ts +2 -1
  18. package/dist/components/listing/index.js +2 -1
  19. package/dist/components/listing/modelCells.d.ts +7 -0
  20. package/dist/components/listing/modelCells.js +56 -0
  21. package/dist/components/listing/modelColumns.d.ts +9 -0
  22. package/dist/components/listing/modelColumns.js +59 -14
  23. package/dist/components/search/index.d.ts +1 -1
  24. package/dist/components/search/index.js +1 -1
  25. package/dist/components/search/model.d.ts +1 -0
  26. package/dist/components/search/model.js +7 -0
  27. package/dist/components/search/query.js +2 -3
  28. package/dist/foundations/copy.d.ts +131 -0
  29. package/dist/foundations/copy.es.js +86 -0
  30. package/dist/foundations/copy.js +86 -0
  31. package/dist/foundations/form.d.ts +18 -1
  32. package/dist/foundations/form.js +6 -3
  33. package/dist/primitives/button/Button.js +3 -1
  34. package/dist/primitives/field/CardNumberInput.d.ts +41 -0
  35. package/dist/primitives/field/CardNumberInput.js +117 -0
  36. package/dist/primitives/field/CodeInput.d.ts +18 -0
  37. package/dist/primitives/field/CodeInput.js +37 -0
  38. package/dist/primitives/field/ColorInput.d.ts +21 -0
  39. package/dist/primitives/field/ColorInput.js +42 -0
  40. package/dist/primitives/field/ContactInputs.d.ts +18 -0
  41. package/dist/primitives/field/ContactInputs.js +70 -0
  42. package/dist/primitives/field/DurationInput.d.ts +20 -0
  43. package/dist/primitives/field/DurationInput.js +54 -0
  44. package/dist/primitives/field/Field.d.ts +24 -4
  45. package/dist/primitives/field/Field.js +17 -4
  46. package/dist/primitives/field/ImageInput.d.ts +51 -0
  47. package/dist/primitives/field/ImageInput.js +267 -0
  48. package/dist/primitives/field/PasswordInput.d.ts +29 -0
  49. package/dist/primitives/field/PasswordInput.js +44 -0
  50. package/dist/primitives/field/PatternInput.d.ts +23 -0
  51. package/dist/primitives/field/PatternInput.js +48 -0
  52. package/dist/primitives/field/RichTextEditor.d.ts +18 -0
  53. package/dist/primitives/field/RichTextEditor.js +224 -0
  54. package/dist/primitives/field/RichTextInput.d.ts +30 -0
  55. package/dist/primitives/field/RichTextInput.js +38 -0
  56. package/dist/primitives/field/SignatureInput.d.ts +34 -0
  57. package/dist/primitives/field/SignatureInput.js +215 -0
  58. package/dist/primitives/field/card.d.ts +33 -0
  59. package/dist/primitives/field/card.js +173 -0
  60. package/dist/primitives/field/clipboard.js +3 -2
  61. package/dist/primitives/field/contact.d.ts +17 -0
  62. package/dist/primitives/field/contact.js +65 -0
  63. package/dist/primitives/field/duration.d.ts +5 -0
  64. package/dist/primitives/field/duration.js +48 -0
  65. package/dist/primitives/field/index.d.ts +14 -0
  66. package/dist/primitives/field/index.js +20 -0
  67. package/dist/primitives/field/mask.d.ts +33 -0
  68. package/dist/primitives/field/mask.js +56 -0
  69. package/dist/primitives/field/media.d.ts +99 -0
  70. package/dist/primitives/field/media.js +136 -0
  71. package/dist/primitives/field/pattern.d.ts +10 -0
  72. package/dist/primitives/field/pattern.js +68 -0
  73. package/dist/primitives/menu/Menu.d.ts +16 -0
  74. package/dist/primitives/menu/Menu.js +26 -8
  75. package/dist/primitives/menu/index.d.ts +1 -1
  76. package/dist/primitives/menu/index.js +1 -1
  77. package/dist/primitives/table/DataTable.d.ts +5 -3
  78. package/dist/primitives/table/DataTable.js +2 -4
  79. package/dist/primitives/table/EditableTable.d.ts +49 -7
  80. package/dist/primitives/table/EditableTable.js +321 -82
  81. package/dist/primitives/table/Table.d.ts +5 -8
  82. package/dist/primitives/table/Table.js +63 -15
  83. package/dist/primitives/table/index.d.ts +3 -2
  84. package/dist/primitives/table/index.js +2 -1
  85. package/dist/primitives/table/rowWindow.d.ts +3 -0
  86. package/dist/primitives/table/rowWindow.js +4 -0
  87. package/dist/primitives/table/sorting.d.ts +42 -0
  88. package/dist/primitives/table/sorting.js +110 -0
  89. package/dist/primitives/value/RichText.d.ts +10 -0
  90. package/dist/primitives/value/RichText.js +130 -0
  91. package/dist/primitives/value/Value.d.ts +20 -2
  92. package/dist/primitives/value/Value.js +26 -7
  93. package/dist/primitives/value/index.d.ts +3 -1
  94. package/dist/primitives/value/index.js +4 -1
  95. package/dist/primitives/value/rounding.d.ts +9 -0
  96. package/dist/primitives/value/rounding.js +48 -0
  97. package/dist/tokens.css +103 -0
  98. package/dist/views/list/List.d.ts +5 -4
  99. package/dist/views/list/ListView.js +2 -2
  100. package/dist/views/list/types.d.ts +6 -6
  101. package/package.json +9 -1
package/dist/tokens.css CHANGED
@@ -1237,3 +1237,106 @@
1237
1237
  writing-mode: vertical-rl;
1238
1238
  transform: rotate(180deg);
1239
1239
  }
1240
+
1241
+ /* ==================================================================== *
1242
+ * RICH TEXT — the HTML of a note, a description, an email body.
1243
+ *
1244
+ * The SAME rules for the editor (`RichTextInput`, Tiptap) and for reading it
1245
+ * (`RichTextValue`): what is written is what is read, to the line. HTML that
1246
+ * arrives from an engine (Odoo `html` fields) has no classes, so the look is
1247
+ * given by the element — and only with tokens, so it follows the theme.
1248
+ * ==================================================================== */
1249
+ @utility rich-text {
1250
+ font-size: var(--text-meta);
1251
+ line-height: var(--text-meta--line-height);
1252
+ color: var(--color-ink);
1253
+ overflow-wrap: anywhere;
1254
+ & > * + * {
1255
+ margin-top: calc(var(--spacing) * 2);
1256
+ }
1257
+ & h2 {
1258
+ font-size: var(--text-lead);
1259
+ line-height: var(--text-lead--line-height);
1260
+ font-weight: 600;
1261
+ }
1262
+ & h3 {
1263
+ font-size: var(--text-body);
1264
+ line-height: var(--text-body--line-height);
1265
+ font-weight: 600;
1266
+ }
1267
+ & ul {
1268
+ list-style: disc;
1269
+ padding-left: calc(var(--spacing) * 5);
1270
+ }
1271
+ & ol {
1272
+ list-style: decimal;
1273
+ padding-left: calc(var(--spacing) * 5);
1274
+ }
1275
+ & li > p {
1276
+ margin: 0;
1277
+ }
1278
+ & blockquote {
1279
+ border-left: calc(var(--spacing) * 0.5) solid var(--color-line-strong);
1280
+ padding-left: calc(var(--spacing) * 3);
1281
+ color: var(--color-muted);
1282
+ }
1283
+ & a {
1284
+ color: var(--color-primary);
1285
+ text-decoration: underline;
1286
+ text-underline-offset: calc(var(--spacing) * 0.5);
1287
+ }
1288
+ & code {
1289
+ font-family: var(--font-mono);
1290
+ background: color-mix(in oklab, var(--color-ink) 6%, transparent);
1291
+ border-radius: var(--radius-mark);
1292
+ padding: 0 calc(var(--spacing) * 1);
1293
+ }
1294
+ & pre {
1295
+ font-family: var(--font-mono);
1296
+ background: color-mix(in oklab, var(--color-ink) 6%, transparent);
1297
+ border-radius: var(--radius-control);
1298
+ padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
1299
+ overflow-x: auto;
1300
+ }
1301
+ & pre code {
1302
+ background: none;
1303
+ padding: 0;
1304
+ }
1305
+ & hr {
1306
+ border: none;
1307
+ border-top: calc(var(--spacing) * 0.25) solid var(--color-line);
1308
+ }
1309
+ & table {
1310
+ border-collapse: collapse;
1311
+ width: 100%;
1312
+ }
1313
+ & th,
1314
+ & td {
1315
+ border: calc(var(--spacing) * 0.25) solid var(--color-line-strong);
1316
+ padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
1317
+ text-align: left;
1318
+ vertical-align: top;
1319
+ }
1320
+ & th {
1321
+ font-weight: 600;
1322
+ background: var(--color-ground);
1323
+ }
1324
+ /* A person named in the text: the same tint as a link, so it reads as «someone», and a
1325
+ box so it is one thing that is deleted at once. */
1326
+ & [data-type="mention"] {
1327
+ color: var(--color-primary);
1328
+ background: color-mix(in oklab, var(--color-primary) 10%, transparent);
1329
+ border-radius: var(--radius-mark);
1330
+ padding: 0 calc(var(--spacing) * 0.5);
1331
+ }
1332
+ & p.is-editor-empty:first-child::before {
1333
+ content: attr(data-placeholder);
1334
+ color: var(--color-muted);
1335
+ float: left;
1336
+ height: 0;
1337
+ pointer-events: none;
1338
+ }
1339
+ & .selectedCell {
1340
+ background: color-mix(in oklab, var(--color-primary) 10%, transparent);
1341
+ }
1342
+ }
@@ -5,7 +5,7 @@ import type { ViewIcon } from "../../components/listing/ViewSwitcher.js";
5
5
  import type { Surface } from "../../foundations/types.js";
6
6
  import type { DataColumn, DataTableCreate } from "../../primitives/table/DataTable.js";
7
7
  import type { RowAction } from "../../primitives/table/RowActions.js";
8
- import type { SortState } from "../../primitives/table/Table.js";
8
+ import type { SortState } from "../../primitives/table/sorting.js";
9
9
  import { type CardWays, type ListCalendar, type ListCrumb, type ListEmpty, type ListGantt, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type ListTimeline, type RowOf } from "./types.js";
10
10
  import type { ReactNode } from "react";
11
11
  type BarProps = {
@@ -97,9 +97,10 @@ export type ListProps<T extends object> = {
97
97
  onSelect: () => void;
98
98
  };
99
99
  };
100
- /** El orden, que también es del conjunto. */
101
- sort?: SortState | null;
102
- onSortChange?: (next: SortState | null) => void;
100
+ /** El orden, que también es del conjunto: una lista de criterios, el primero manda y los
101
+ * demás desempatan. Vacío es «como llegaron». */
102
+ sort?: readonly SortState[];
103
+ onSortChange?: (next: SortState[]) => void;
103
104
  /** Por qué campos se puede ordenar en las caras que NO tienen encabezados
104
105
  * donde hacer clic. */
105
106
  sortable?: readonly SortField<T>[];
@@ -147,7 +147,7 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
147
147
  const sortMenu = sortable === undefined ||
148
148
  sortable.length === 0 ||
149
149
  declaredReport ||
150
- present === "pivot" ? null : (_jsx(SortMenu, { fields: sortable, sort: sort ?? null, onSortChange: (next) => onSortChange?.(next), ...(surface === undefined ? {} : { surface }) }));
150
+ present === "pivot" ? null : (_jsx(SortMenu, { fields: sortable, sort: sort ?? [], onSortChange: (next) => onSortChange?.(next), ...(surface === undefined ? {} : { surface }) }));
151
151
  const rightViews = views ?? switcher;
152
152
  const viewsSlot = columnsMenu === null && sortMenu === null && rightViews === undefined ? undefined : (_jsxs(_Fragment, { children: [sortMenu, columnsMenu, rightViews] }));
153
153
  /* Embedded, the line is drawn only if it has something to OFFER: a count alone repeats
@@ -202,7 +202,7 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
202
202
  veces no rompe nada, pero es trabajo al pedo sobre cada render. */
203
203
  const ordered = useMemo(() => present === "table" || sortable === undefined
204
204
  ? items
205
- : sortItems(items, sortable, sort ?? null), [items, present, sortable, sort]);
205
+ : sortItems(items, sortable, sort), [items, present, sortable, sort]);
206
206
  /**
207
207
  * La grilla que hay que dibujar: la que le pasaron plegada, o la que se arma
208
208
  * con las filas en la mano.
@@ -14,7 +14,7 @@ import type { DataColumn, DataTableCreate } from "../../primitives/table/DataTab
14
14
  import type { ReportColumn, ReportRow } from "../../primitives/table/ReportTable.js";
15
15
  import type { RowAction } from "../../primitives/table/RowActions.js";
16
16
  import type { SheetColumn } from "../../primitives/table/SheetTable.js";
17
- import type { SortState } from "../../primitives/table/Table.js";
17
+ import type { SortState } from "../../primitives/table/sorting.js";
18
18
  import type { LucideIcon } from "lucide-react";
19
19
  import type { ReactNode } from "react";
20
20
  /**
@@ -276,11 +276,11 @@ export type ListViewProps<T extends object> = {
276
276
  * Owned by the view when omitted — catalog filters must not reset them. */
277
277
  visibleColumnIds?: readonly string[];
278
278
  onVisibleColumnIdsChange?: (ids: readonly string[]) => void;
279
- /** The sorting of the table. It lives outside because it belongs to the SET
280
- * and not to the presentation: switching from table to rows has no reason to
281
- * lose it. */
282
- sort?: SortState | null;
283
- onSortChange?: (next: SortState | null) => void;
279
+ /** The order of the set, outermost first: «by date, then by customer». It lives outside
280
+ * because it belongs to the SET and not to the presentation: switching from table to
281
+ * rows has no reason to lose it. Empty or absent is «as they came». */
282
+ sort?: readonly SortState[];
283
+ onSortChange?: (next: SortState[]) => void;
284
284
  /**
285
285
  * Por qué campos se puede ordenar, para las presentaciones que NO tienen
286
286
  * encabezados donde hacer clic.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-ui",
3
- "version": "1.5.0",
3
+ "version": "1.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",
@@ -56,7 +56,15 @@
56
56
  "@fullcalendar/react": "7.1.3",
57
57
  "@internationalized/date": "^3.12.4",
58
58
  "@svar-ui/react-gantt": "2.8.2",
59
+ "@tiptap/extension-mention": "^3.32.2",
60
+ "@tiptap/extension-table": "^3.32.2",
61
+ "@tiptap/extensions": "^3.32.2",
62
+ "@tiptap/pm": "^3.32.2",
63
+ "@tiptap/react": "^3.32.2",
64
+ "@tiptap/starter-kit": "^3.32.2",
65
+ "@tiptap/suggestion": "^3.32.2",
59
66
  "@uiw/react-codemirror": "^4.25.11",
67
+ "dompurify": "^3.4.17",
60
68
  "lucide-react": "^1.45.0",
61
69
  "react-aria": "^3.53.1",
62
70
  "react-aria-components": "^1.22.1",