@sincpro/web-ui 1.9.0 → 1.11.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 (95) hide show
  1. package/dist/components/board/Board.d.ts +51 -0
  2. package/dist/components/board/Board.js +15 -0
  3. package/dist/components/board/index.d.ts +1 -0
  4. package/dist/components/board/index.js +2 -0
  5. package/dist/components/canvas/Canvas.d.ts +14 -0
  6. package/dist/components/canvas/Canvas.js +9 -0
  7. package/dist/components/canvas/canvas.css +19 -0
  8. package/dist/components/canvas/index.d.ts +1 -0
  9. package/dist/components/canvas/index.js +2 -0
  10. package/dist/components/chat/ChatComposer.d.ts +10 -0
  11. package/dist/components/chat/ChatComposer.js +29 -0
  12. package/dist/components/chat/ChatThread.d.ts +13 -0
  13. package/dist/components/chat/ChatThread.js +76 -0
  14. package/dist/components/chat/ConversationList.d.ts +22 -0
  15. package/dist/components/chat/ConversationList.js +22 -0
  16. package/dist/components/chat/index.d.ts +4 -0
  17. package/dist/components/chat/index.js +5 -0
  18. package/dist/components/chat/model.d.ts +30 -0
  19. package/dist/components/chat/model.js +53 -0
  20. package/dist/components/frame/Chart.d.ts +12 -7
  21. package/dist/components/frame/Chart.js +17 -17
  22. package/dist/components/frame/FrameView.d.ts +3 -3
  23. package/dist/components/frame/FrameView.js +79 -26
  24. package/dist/components/frame/model.d.ts +12 -3
  25. package/dist/components/frame/model.js +53 -19
  26. package/dist/components/index.d.ts +4 -0
  27. package/dist/components/index.js +4 -0
  28. package/dist/components/listing/AxisLevels.d.ts +24 -0
  29. package/dist/components/listing/AxisLevels.js +58 -0
  30. package/dist/components/listing/ChartExplorer.d.ts +79 -0
  31. package/dist/components/listing/ChartExplorer.js +114 -0
  32. package/dist/components/listing/ColumnsMenu.d.ts +7 -1
  33. package/dist/components/listing/ColumnsMenu.js +16 -5
  34. package/dist/components/listing/GroupingLevels.d.ts +5 -1
  35. package/dist/components/listing/GroupingLevels.js +7 -4
  36. package/dist/components/listing/ListingBar.js +2 -2
  37. package/dist/components/listing/PivotExplorer.js +5 -36
  38. package/dist/components/listing/index.d.ts +2 -0
  39. package/dist/components/listing/index.js +2 -0
  40. package/dist/components/listing/set.d.ts +3 -1
  41. package/dist/components/preview/FilePreview.d.ts +19 -0
  42. package/dist/components/preview/FilePreview.js +112 -0
  43. package/dist/components/preview/PdfPreview.d.ts +7 -0
  44. package/dist/components/preview/PdfPreview.js +47 -0
  45. package/dist/components/preview/index.d.ts +1 -0
  46. package/dist/components/preview/index.js +2 -0
  47. package/dist/components/record/SmartButtons.js +1 -1
  48. package/dist/components/search/FieldPath.d.ts +54 -0
  49. package/dist/components/search/FieldPath.js +159 -0
  50. package/dist/components/search/FilterBuilder.d.ts +38 -5
  51. package/dist/components/search/FilterBuilder.js +129 -25
  52. package/dist/components/search/SearchBar.js +7 -2
  53. package/dist/components/search/criteria.d.ts +23 -1
  54. package/dist/components/search/index.d.ts +4 -2
  55. package/dist/components/search/index.js +4 -0
  56. package/dist/components/search/paths.d.ts +49 -0
  57. package/dist/components/search/paths.js +75 -0
  58. package/dist/components/shell/TopBar.js +1 -1
  59. package/dist/foundations/calendar.d.ts +15 -0
  60. package/dist/foundations/calendar.js +59 -1
  61. package/dist/foundations/chart.d.ts +126 -0
  62. package/dist/foundations/chart.js +297 -0
  63. package/dist/foundations/copy.d.ts +125 -0
  64. package/dist/foundations/copy.es.js +90 -0
  65. package/dist/foundations/copy.js +84 -0
  66. package/dist/foundations/index.d.ts +2 -1
  67. package/dist/foundations/index.js +4 -1
  68. package/dist/foundations/pivot.d.ts +9 -0
  69. package/dist/foundations/pivot.js +1 -0
  70. package/dist/primitives/chart/Chart.d.ts +39 -0
  71. package/dist/primitives/chart/Chart.js +235 -0
  72. package/dist/primitives/chart/index.d.ts +1 -0
  73. package/dist/primitives/chart/index.js +1 -0
  74. package/dist/primitives/field/Field.js +2 -1
  75. package/dist/primitives/index.d.ts +1 -0
  76. package/dist/primitives/index.js +1 -0
  77. package/dist/primitives/notice/Callout.d.ts +4 -1
  78. package/dist/primitives/notice/Callout.js +12 -2
  79. package/dist/primitives/notice/Notice.d.ts +26 -2
  80. package/dist/primitives/notice/Notice.js +64 -4
  81. package/dist/primitives/notice/Toast.js +10 -1
  82. package/dist/primitives/value/Markdown.d.ts +9 -0
  83. package/dist/primitives/value/Markdown.js +18 -0
  84. package/dist/primitives/value/Metric.d.ts +13 -2
  85. package/dist/primitives/value/Metric.js +25 -3
  86. package/dist/primitives/value/index.d.ts +1 -0
  87. package/dist/primitives/value/index.js +1 -0
  88. package/dist/tokens.css +73 -0
  89. package/dist/views/list/List.d.ts +2 -1
  90. package/dist/views/list/List.js +8 -1
  91. package/dist/views/list/ListView.d.ts +1 -1
  92. package/dist/views/list/ListView.js +37 -5
  93. package/dist/views/list/index.d.ts +1 -1
  94. package/dist/views/list/types.d.ts +34 -0
  95. package/package.json +5 -1
@@ -1,6 +1,7 @@
1
1
  /* Show a number or a datum so that it reads as such and not as text. */
2
2
  export { Copyable, CopyButton, } from "./Copyable.js";
3
3
  export { DateValue, formatDateTime, formatRelative, } from "./DateValue.js";
4
+ export { Markdown } from "./Markdown.js";
4
5
  export { Meter, meterLevel, } from "./Meter.js";
5
6
  export { Metric, Metrics } from "./Metric.js";
6
7
  export { Avatar, UserChip, UserStack, } from "./Person.js";
package/dist/tokens.css CHANGED
@@ -11,6 +11,8 @@
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";
14
16
  /* The record calendar (`RecordCalendar`, FullCalendar v7): its structure and the `forma`
15
17
  theme. The palette that theme reads is defined below, from web-ui's tokens. */
16
18
  @import "@fullcalendar/react/skeleton.css";
@@ -31,6 +33,13 @@
31
33
  * inside node_modules — which Tailwind skips unless told. Importing this file is the whole
32
34
  * setup a consumer needs. */
33
35
  @source ".";
36
+ /* streamdown (the markdown renderer) ships its Tailwind classes too. Two paths, because the
37
+ * package sits in two places: the repo's node_modules (src/ and dist/ are one level below
38
+ * it), and the hoisted node_modules of an application (dist/ sits in
39
+ * node_modules/@sincpro/web-ui). A path that does not exist matches nothing, so the other
40
+ * one is simply skipped. */
41
+ @source "../node_modules/streamdown/dist";
42
+ @source "../../../streamdown/dist";
34
43
 
35
44
  /* ==================================================================== *
36
45
  * LIGHT THEME
@@ -152,6 +161,27 @@
152
161
  element requires. */
153
162
  --color-data-soft: #5c74a6; /* 4.43:1 */
154
163
 
164
+ /* The CATEGORICAL palette: one hue per series when a chart draws two or more. A single
165
+ series is `data`. Eight and not one more — a ninth would be a generated hue, and under
166
+ colour blindness it reads as one of these; the chart gathers the tail into «others».
167
+
168
+ The ORDER is the colour-blind safety, not taste: every neighbouring pair stays apart
169
+ under protan and deutan simulation (worst OKLab ΔE 9.1 here, 8.4 in the dark, target 8)
170
+ and under normal vision (worst 19.6 / 19.3, floor 15) — computed, not eyeballed, against
171
+ these very surfaces. Status keeps its own steps (`good`/`bad`): a series is never «fine».
172
+
173
+ Three light steps (aqua, yellow, magenta) sit under 3:1 on the ground. A mark there is
174
+ never the only channel: the legend names it, the tooltip reads it out, and the table
175
+ presentation is the chart's twin. Text NEVER wears these colours. */
176
+ --color-series-1: #2a78d6; /* 4.20:1 */
177
+ --color-series-2: #eb6834; /* 3.04:1 */
178
+ --color-series-3: #1baf7a; /* 2.68:1 */
179
+ --color-series-4: #eda100; /* 2.06:1 */
180
+ --color-series-5: #e87ba4; /* 2.56:1 */
181
+ --color-series-6: #008300; /* 4.70:1 */
182
+ --color-series-7: #6250d6; /* 5.49:1 */
183
+ --color-series-8: #e34948; /* 3.76:1 */
184
+
155
185
  /* States. Muted on purpose —this is a tool, not an alarm panel— but all three
156
186
  pass AA as TEXT on the ground, because all three are used as a word and not
157
187
  as decoration. */
@@ -709,6 +739,14 @@
709
739
  --color-danger-hover: #f6ab9f; /* 9.66:1 · surface on top 8.78:1 */
710
740
  --color-info: #5cc4d8; /* 8.89:1 */
711
741
  --color-data-soft: #6f88bd; /* 5.10:1 */
742
+ --color-series-1: #3987e5; /* 4.96:1 */
743
+ --color-series-2: #d95926; /* 4.65:1 */
744
+ --color-series-3: #199e70; /* 5.30:1 */
745
+ --color-series-4: #c98500; /* 5.88:1 */
746
+ --color-series-5: #d55181; /* 4.57:1 */
747
+ --color-series-6: #008300; /* 3.65:1 */
748
+ --color-series-7: #9085e9; /* 5.77:1 */
749
+ --color-series-8: #e66767; /* 5.59:1 */
712
750
  --color-good: #6fcf8b; /* 9.43:1 */
713
751
  --color-warn: #e3b341; /* 9.27:1 */
714
752
  --color-bad: #f08d7f; /* 7.58:1 */
@@ -748,6 +786,14 @@
748
786
  --color-danger-hover: #f6ab9f; /* 9.66:1 · surface on top 8.78:1 */
749
787
  --color-info: #5cc4d8; /* 8.89:1 */
750
788
  --color-data-soft: #6f88bd; /* 5.10:1 */
789
+ --color-series-1: #3987e5; /* 4.96:1 */
790
+ --color-series-2: #d95926; /* 4.65:1 */
791
+ --color-series-3: #199e70; /* 5.30:1 */
792
+ --color-series-4: #c98500; /* 5.88:1 */
793
+ --color-series-5: #d55181; /* 4.57:1 */
794
+ --color-series-6: #008300; /* 3.65:1 */
795
+ --color-series-7: #9085e9; /* 5.77:1 */
796
+ --color-series-8: #e66767; /* 5.59:1 */
751
797
  --color-good: #6fcf8b; /* 9.43:1 */
752
798
  --color-warn: #e3b341; /* 9.27:1 */
753
799
  --color-bad: #f08d7f; /* 7.58:1 */
@@ -789,6 +835,14 @@
789
835
  --color-danger-hover: #7c2d24; /* 8.84:1 · white on top 9.30:1 */
790
836
  --color-info: #0f5c6e; /* 7.19:1 · white on top 7.56:1 */
791
837
  --color-data-soft: #5c74a6; /* 4.43:1 */
838
+ --color-series-1: #2a78d6; /* 4.20:1 */
839
+ --color-series-2: #eb6834; /* 3.04:1 */
840
+ --color-series-3: #1baf7a; /* 2.68:1 */
841
+ --color-series-4: #eda100; /* 2.06:1 */
842
+ --color-series-5: #e87ba4; /* 2.56:1 */
843
+ --color-series-6: #008300; /* 4.70:1 */
844
+ --color-series-7: #6250d6; /* 5.49:1 */
845
+ --color-series-8: #e34948; /* 3.76:1 */
792
846
  --color-good: #2f6b3c; /* 6.07:1 */
793
847
  --color-warn: #7e5e12; /* 5.71:1 */
794
848
  --color-bad: #9b3b30; /* 6.52:1 */
@@ -1178,6 +1232,25 @@
1178
1232
  * 100% is a dialog without a scrim**, and then it is not understood that what
1179
1233
  * is behind can still be used.
1180
1234
  * ------------------------------------------------------------------ */
1235
+ /* ------------------------------------------------------------------ *
1236
+ * A strip that scrolls without drawing a scrollbar.
1237
+ *
1238
+ * The menus of the app bar on a phone: they used to be clipped (`overflow:
1239
+ * hidden`), which left half a word against the icons — «Cl» — and the rest
1240
+ * of the menus out of reach. Scrolling keeps every menu reachable with the
1241
+ * finger, the wheel or Tab (the focused one scrolls into view); the word cut
1242
+ * at the edge is the sign that there is more. No bar: on the dark app bar a
1243
+ * scrollbar is a grey stripe across the brand.
1244
+ * ------------------------------------------------------------------ */
1245
+ @utility scroll-quiet {
1246
+ overflow-x: auto;
1247
+ overscroll-behavior-x: contain;
1248
+ scrollbar-width: none;
1249
+ &::-webkit-scrollbar {
1250
+ display: none;
1251
+ }
1252
+ }
1253
+
1181
1254
  @utility peek-width {
1182
1255
  width: min(var(--container-peek), calc(100% - 2rem));
1183
1256
  }
@@ -6,7 +6,7 @@ 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
8
  import type { SortState } from "../../primitives/table/sorting.js";
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";
9
+ import { type CardWays, type ListCalendar, type ListChart, 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 = {
12
12
  children?: ReactNode;
@@ -156,6 +156,7 @@ export declare namespace List {
156
156
  var Sheet: <T>(props: SheetProps<T>) => ReactNode;
157
157
  var Report: ((props: ListReport) => ReactNode) & import("../../foundations/slots.js").Slotted<"report">;
158
158
  var Pivot: <T>(props: ListPivot<T>) => ReactNode;
159
+ var Chart: <T>(props: ListChart<T>) => ReactNode;
159
160
  var Calendar: <T>(props: ListCalendar<T>) => ReactNode;
160
161
  var Gantt: <T>(props: ListGantt<T>) => ReactNode;
161
162
  var Timeline: <T>(props: ListTimeline<T>) => ReactNode;
@@ -30,6 +30,9 @@ const Board = slot("board", (_props) => null);
30
30
  const SheetSlot = slot("sheet", (_props) => null);
31
31
  const Report = slot("report", (_props) => null);
32
32
  const Pivot = slot("pivot", (_props) => null);
33
+ /** The pivot, drawn — Odoo's graph view (`ChartExplorer`). `unknown` in between: the
34
+ * comparison's records make the props invariant in `T`, and the slot never reads them. */
35
+ const ChartSlot = slot("chart", (_props) => null);
33
36
  /* El orden en que se OFRECEN cuando están escritas de otra manera. El conmutador
34
37
  respeta el orden del árbol; esto sólo nombra a qué presentación corresponde
35
38
  cada ranura. */
@@ -40,6 +43,7 @@ const PRESENT_OF = {
40
43
  sheet: "sheet",
41
44
  report: "report",
42
45
  pivot: "pivot",
46
+ chart: "chart",
43
47
  calendar: "calendar",
44
48
  gantt: "gantt",
45
49
  timeline: "timeline",
@@ -51,6 +55,7 @@ const FACES = [
51
55
  "sheet",
52
56
  "report",
53
57
  "pivot",
58
+ "chart",
54
59
  "calendar",
55
60
  "gantt",
56
61
  "timeline",
@@ -97,6 +102,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
97
102
  const sheet = propsOf(pick(top, "sheet"));
98
103
  const report = propsOf(pick(top, "report"));
99
104
  const pivot = propsOf(pick(top, "pivot"));
105
+ const chart = propsOf(pick(top, "chart"));
100
106
  const calendar = propsOf(pick(top, "calendar"));
101
107
  const gantt = propsOf(pick(top, "gantt"));
102
108
  const timeline = propsOf(pick(top, "timeline"));
@@ -141,7 +147,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
141
147
  : { onVisibleColumnIdsChange: table.onVisibleColumnIdsChange }),
142
148
  }), ...(board?.card === undefined ? {} : { card: board.card }), ...(board?.stages === undefined ? {} : { boardStages: board.stages }), ...(sheet?.columns === undefined || sheet.cell === undefined
143
149
  ? {}
144
- : { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined ? {} : { present }), ...(onPresentChange === undefined ? {} : { onPresentChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(sortable === undefined ? {} : { sortable }), ...(onOpen === undefined ? {} : { onOpen }), ...(onPeek === undefined ? {} : { onPeek }), ...(isPeeked === undefined ? {} : { isPeeked }), ...(rowClick === undefined ? {} : { rowClick }), ...(onChoose === undefined || readOnly ? {} : { onChoose }), ...(state === undefined ? {} : { state }), ...(filtered === undefined ? {} : { filtered }), ...(empty === undefined ? {} : { empty }), children: rest.length === 0 ? undefined : rest }));
150
+ : { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(chart === undefined ? {} : { chart }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined ? {} : { present }), ...(onPresentChange === undefined ? {} : { onPresentChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(sortable === undefined ? {} : { sortable }), ...(onOpen === undefined ? {} : { onOpen }), ...(onPeek === undefined ? {} : { onPeek }), ...(isPeeked === undefined ? {} : { isPeeked }), ...(rowClick === undefined ? {} : { rowClick }), ...(onChoose === undefined || readOnly ? {} : { onChoose }), ...(state === undefined ? {} : { state }), ...(filtered === undefined ? {} : { filtered }), ...(empty === undefined ? {} : { empty }), children: rest.length === 0 ? undefined : rest }));
145
151
  }
146
152
  List.Bar = Bar;
147
153
  List.Crumbs = Crumbs;
@@ -157,6 +163,7 @@ List.Board = Board;
157
163
  List.Sheet = SheetSlot;
158
164
  List.Report = Report;
159
165
  List.Pivot = Pivot;
166
+ List.Chart = ChartSlot;
160
167
  List.Calendar = CalendarSlot;
161
168
  List.Gantt = GanttSlot;
162
169
  List.Timeline = TimelineSlot;
@@ -1,5 +1,5 @@
1
1
  import type { ListViewProps } from "./types.js";
2
- export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
2
+ export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
3
3
  /** What a list offers when it fails and can be retried. */
4
4
  export declare function RetryAction({ onRetry }: {
5
5
  onRetry: () => void;
@@ -25,7 +25,7 @@ import { groupedColumnIds, WIDE_PRESENTS } from "./columns.js";
25
25
  import { groupLevelsOf, reportColumnsOf, reportRowsOf, sheetFromColumns, sheetRowsOf, } from "./derive.js";
26
26
  import { SheetPresentation, TablePresentation, } from "./presentations.js";
27
27
  import { useNarrowList } from "./useNarrowList.js";
28
- import { CalendarDays, CalendarRange, ChartGantt, Grid3x3, LayoutGrid, List, Sheet, Sigma, Table2, } from "lucide-react";
28
+ import { CalendarDays, CalendarRange, ChartColumnBig, ChartGantt, Grid3x3, LayoutGrid, List, Sheet, Sigma, Table2, } from "lucide-react";
29
29
  import { Fragment, lazy, Suspense, useCallback, useMemo } from "react";
30
30
  /* The calendar (FullCalendar) and the gantt (SVAR) are each about a third of a list's weight,
31
31
  and most lists never show either face. Each is its own chunk, fetched the first time its
@@ -37,6 +37,11 @@ const RecordCalendar = lazy(() => import("../../components/calendar/RecordCalend
37
37
  const RecordGantt = lazy(() => import("../../components/gantt/RecordGantt.js").then((module) => ({
38
38
  default: module.RecordGantt,
39
39
  })));
40
+ /* The chart (Recharts) is its own chunk too: a list that is never drawn as a chart never
41
+ downloads it. */
42
+ const ChartExplorer = lazy(() => import("../../components/listing/ChartExplorer.js").then((module) => ({
43
+ default: module.ChartExplorer,
44
+ })));
40
45
  /**
41
46
  * EL DIBUJO de una lista. **La puerta es `List`**, que se escribe como árbol y
42
47
  * traduce las ranuras a esto — acá todo entra como props porque acá ya se
@@ -71,11 +76,13 @@ const PRESENT_ICONS = [
71
76
  { id: "report", icon: Sigma },
72
77
  /* La cuadrícula: dos ejes, y lo que importa está adentro. */
73
78
  { id: "pivot", icon: Grid3x3 },
79
+ /* El mismo pivote, dibujado. */
80
+ { id: "chart", icon: ChartColumnBig },
74
81
  { id: "calendar", icon: CalendarDays },
75
82
  { id: "gantt", icon: ChartGantt },
76
83
  { id: "timeline", icon: CalendarRange },
77
84
  ];
78
- export function ListView({ items, keyOf, identity, crumbs, embedded = false, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, faces, present: requested = "rows", presents, onPresentChange, sort, onSortChange, sortable, totals = false, rowActions, create, group, selection, onOpen, onPeek, rowClick = "peek", onChoose, state, filtered = false, empty, children, }) {
85
+ export function ListView({ items, keyOf, identity, crumbs, embedded = false, surface: requestedSurface, metrics, search, pagination, views, actions, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested = "rows", presents, onPresentChange, sort, onSortChange, sortable, totals = false, rowActions, create, group, selection, onOpen, onPeek, rowClick = "peek", onChoose, state, filtered = false, empty, children, }) {
79
86
  const wide = useMemo(() => [
80
87
  ...WIDE_PRESENTS,
81
88
  ...(faces ?? []).filter((f) => f.wide === true).map((f) => f.id),
@@ -155,7 +162,8 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
155
162
  const sortMenu = sortable === undefined ||
156
163
  sortable.length === 0 ||
157
164
  declaredReport ||
158
- present === "pivot" ? null : (_jsx(SortMenu, { fields: sortable, sort: sort ?? [], onSortChange: (next) => onSortChange?.(next), ...(surface === undefined ? {} : { surface }) }));
165
+ present === "pivot" ||
166
+ present === "chart" ? null : (_jsx(SortMenu, { fields: sortable, sort: sort ?? [], onSortChange: (next) => onSortChange?.(next), ...(surface === undefined ? {} : { surface }) }));
159
167
  const rightViews = views ?? switcher;
160
168
  const viewsSlot = columnsMenu === null && sortMenu === null && rightViews === undefined ? undefined : (_jsxs(_Fragment, { children: [sortMenu, columnsMenu, rightViews] }));
161
169
  /* Embedded, the line is drawn only if it has something to OFFER: a count alone repeats
@@ -236,7 +244,9 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
236
244
  error === null &&
237
245
  (present === "pivot" && pivotShown !== undefined
238
246
  ? pivotIsEmpty(pivotShown)
239
- : items.length === 0) &&
247
+ : present === "chart" && chart?.folded !== undefined
248
+ ? pivotIsEmpty(chart.folded)
249
+ : items.length === 0) &&
240
250
  /* The first record of an empty list is written in the table, not under a sentence
241
251
  saying there is nothing. */
242
252
  !(present === "table" && create?.draft != null);
@@ -332,7 +342,29 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
332
342
  orden —cada eje viene en el orden de sus claves— y no hay menú de
333
343
  columnas, porque las columnas son un eje y no una lista de campos que
334
344
  se puedan esconder de a uno. */
335
- _jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
345
+ _jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "chart" &&
346
+ chart !== undefined &&
347
+ (chart.folded !== undefined || chart.spec !== undefined) ? (
348
+ /* Odoo's graph view. Its levels follow the search bar's grouping, like the pivot's
349
+ rows: the first along the axis, the rest as series. */
350
+ _jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(ChartExplorer, { ...(chart.folded === undefined ? {} : { folded: chart.folded }), ...(chart.spec === undefined
351
+ ? {}
352
+ : {
353
+ items: ordered,
354
+ of: chart.spec.of,
355
+ measures: chart.spec.measures,
356
+ defaultCategories: chart.spec.rows,
357
+ defaultSeries: chart.spec.columns,
358
+ ...(chart.spec.labelOf === undefined
359
+ ? {}
360
+ : { labelOf: chart.spec.labelOf }),
361
+ }), ...(chart.fields === undefined ? {} : { fields: chart.fields }), ...(chart.defaultMeasure === undefined
362
+ ? {}
363
+ : { defaultMeasure: chart.defaultMeasure }), ...(chart.kind === undefined ? {} : { defaultKind: chart.kind }), ...(chart.defaultMeasures === undefined
364
+ ? {}
365
+ : { defaultMeasures: chart.defaultMeasures }), ...(chart.stacked === undefined ? {} : { defaultStacked: chart.stacked }), ...(chart.cumulative === undefined
366
+ ? {}
367
+ : { defaultCumulative: chart.cumulative }), ...(chart.order === undefined ? {} : { defaultOrder: chart.order }), ...(chart.compare === undefined ? {} : { compare: chart.compare }), ...((group?.levels.length ?? 0) > 0 ? { levels: group.levels } : {}), ...(chart.onPoint === undefined ? {} : { onPoint: chart.onPoint }), ...(chart.height === undefined ? {} : { height: chart.height }), ...(chart.fileName === undefined ? {} : { fileName: chart.fileName }), ...(identity?.title === undefined ? {} : { label: identity.title }) }) }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
336
368
  /* El encabezado va ANTES de los montones y no adentro de cada uno:
337
369
  rotula la fila, y la fila es la misma en los cinco montones. */
338
370
  _jsxs(_Fragment, { children: [rowHeader === undefined || items.length === 0 ? null : (_jsx(RowHeader, { name: rowHeader.name, ...(rowHeader.meta === undefined ? {} : { meta: rowHeader.meta }), ...(rowHeader.tags === undefined ? {} : { tags: rowHeader.tags }), withSelection: selection !== undefined,
@@ -1,2 +1,2 @@
1
1
  export { List, type ListPresentProps, type ListProps } from "./List.js";
2
- export { type CardWays, type ListCrumb, type ListEmpty, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type RowOf, } from "./types.js";
2
+ export { type CardWays, type ListChart, type ListCrumb, type ListEmpty, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type RowOf, } from "./types.js";
@@ -1,11 +1,13 @@
1
1
  import type { RecordCalendarProps } from "../../components/calendar/RecordCalendar.js";
2
2
  import type { RecordGanttProps } from "../../components/gantt/RecordGantt.js";
3
3
  import type { BoardStages } from "../../components/listing/BoardColumns.js";
4
+ import type { ChartComparison } from "../../components/listing/ChartExplorer.js";
4
5
  import type { ListIdentity } from "../../components/listing/ListingBar.js";
5
6
  import type { ListPresent } from "../../components/listing/set.js";
6
7
  import type { SortField } from "../../components/listing/SortMenu.js";
7
8
  import type { ViewIcon } from "../../components/listing/ViewSwitcher.js";
8
9
  import type { RecordTimelineProps } from "../../components/timeline/RecordTimeline.js";
10
+ import type { ChartKind, ChartOrder } from "../../foundations/chart.js";
9
11
  import type { GroupableField } from "../../foundations/grouping.js";
10
12
  import type { Grouping, GroupLevel, Pile } from "../../foundations/grouping.js";
11
13
  import type { Pivot, PivotKey, PivotSpec } from "../../foundations/pivot.js";
@@ -230,6 +232,36 @@ export type ListPivot<T> = {
230
232
  /** Which of `spec.measures` start on. The first one by default. */
231
233
  defaultMeasures?: readonly string[];
232
234
  };
235
+ /**
236
+ * EL GRÁFICO de una lista: la vista gráfica de Odoo. Lee lo mismo que el pivote —un
237
+ * `Pivot`, plegado acá con `spec` o afuera con `folded`— y lo dibuja como barras, líneas o
238
+ * torta. Sus niveles SIGUEN al agrupado del buscador: el primero va en el eje y los demás
239
+ * son las series, como en Odoo.
240
+ */
241
+ export type ListChart<T> = {
242
+ /** Plegado por quien guarda los datos. Sus ejes son los suyos y no se editan acá. */
243
+ folded?: Pivot;
244
+ /** Cómo plegarlo acá, con las filas en la mano: `rows` es el eje, `columns` las series. */
245
+ spec?: PivotSpec<T>;
246
+ /** Por qué campos se puede partir. Con esto los ejes se eligen sobre el gráfico. */
247
+ fields?: readonly GroupableField[];
248
+ /** La medida con la que abre. La primera de `spec.measures`; `COUNT_MEASURE` para el conteo. */
249
+ defaultMeasure?: string;
250
+ /** Varias medidas, cada una su propio gráfico (nunca dos escalas en un eje). */
251
+ defaultMeasures?: readonly string[];
252
+ kind?: ChartKind;
253
+ /** Cómo abre: apilado (por defecto, como Odoo), acumulado, ordenado. */
254
+ stacked?: boolean;
255
+ cumulative?: boolean;
256
+ order?: ChartOrder;
257
+ /** El período anterior, para dibujarlo al lado: los registros de entonces y sus nombres. */
258
+ compare?: ChartComparison<T>;
259
+ /** Una barra, un punto o una porción: abrir los registros que cayeron ahí. */
260
+ onPoint?: (category: PivotKey, series?: PivotKey) => void;
261
+ height?: number | string;
262
+ /** Con qué nombre se baja. */
263
+ fileName?: string;
264
+ };
233
265
  export type ListViewProps<T extends object> = {
234
266
  items: readonly T[];
235
267
  keyOf: (item: T) => string;
@@ -339,6 +371,8 @@ export type ListViewProps<T extends object> = {
339
371
  * elegirlo acá sería adivinar la pregunta.
340
372
  */
341
373
  pivot?: ListPivot<T>;
374
+ /** El GRÁFICO: el pivote dibujado. Con esto, `present="chart"` dibuja un `ChartExplorer`. */
375
+ chart?: ListChart<T>;
342
376
  /** The presentations the application wrote (`List.Present`), by id. */
343
377
  faces?: readonly ListFace<T>[];
344
378
  present?: ListPresent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-ui",
3
- "version": "1.9.0",
3
+ "version": "1.11.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",
@@ -64,10 +64,14 @@
64
64
  "@tiptap/starter-kit": "^3.32.2",
65
65
  "@tiptap/suggestion": "^3.32.2",
66
66
  "@uiw/react-codemirror": "^4.25.11",
67
+ "@xyflow/react": "^12.12.1",
67
68
  "dompurify": "^3.4.17",
68
69
  "lucide-react": "^1.45.0",
69
70
  "react-aria": "^3.53.1",
70
71
  "react-aria-components": "^1.22.1",
72
+ "react-pdf": "^11.0.0",
73
+ "recharts": "^3.10.1",
74
+ "streamdown": "^2.7.1",
71
75
  "tailwind-variants": "^4.0.0",
72
76
  "tailwindcss-react-aria-components": "^2.2.0",
73
77
  "temporal-polyfill": "^1.0.6"