@sincpro/web-ui 1.11.1 → 2.1.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 (120) hide show
  1. package/dist/components/activity/Activity.d.ts +13 -14
  2. package/dist/components/activity/Activity.js +1 -1
  3. package/dist/components/activity/Messages.d.ts +5 -5
  4. package/dist/components/activity/Messages.js +8 -8
  5. package/dist/components/form/Form.js +6 -6
  6. package/dist/components/form/index.js +2 -2
  7. package/dist/components/frame/FrameView.d.ts +5 -5
  8. package/dist/components/frame/FrameView.js +4 -4
  9. package/dist/components/listing/GroupingLevels.d.ts +22 -22
  10. package/dist/components/listing/GroupingLevels.js +9 -9
  11. package/dist/components/listing/Listing.d.ts +11 -11
  12. package/dist/components/listing/Listing.js +11 -11
  13. package/dist/components/listing/ListingBar.js +11 -11
  14. package/dist/components/listing/Row.d.ts +19 -19
  15. package/dist/components/listing/Row.js +25 -25
  16. package/dist/components/listing/SortMenu.d.ts +36 -36
  17. package/dist/components/listing/SortMenu.js +6 -6
  18. package/dist/components/listing/grouping.d.ts +16 -16
  19. package/dist/components/listing/grouping.js +6 -6
  20. package/dist/components/listing/index.js +1 -1
  21. package/dist/components/listing/modelColumns.d.ts +25 -25
  22. package/dist/components/listing/modelColumns.js +24 -24
  23. package/dist/components/listing/pages.js +4 -4
  24. package/dist/components/listing/set.d.ts +18 -18
  25. package/dist/components/navigation/index.js +2 -2
  26. package/dist/components/record/RecordSkeleton.js +7 -7
  27. package/dist/components/search/CriteriaBuilder.d.ts +35 -22
  28. package/dist/components/search/CriteriaBuilder.js +95 -85
  29. package/dist/components/search/CriteriaChips.d.ts +9 -9
  30. package/dist/components/search/CriteriaChips.js +13 -13
  31. package/dist/components/search/FilterBuilder.d.ts +72 -71
  32. package/dist/components/search/FilterBuilder.js +190 -145
  33. package/dist/components/search/JoinWord.d.ts +1 -1
  34. package/dist/components/search/JoinWord.js +14 -14
  35. package/dist/components/search/JsonEditor.d.ts +8 -8
  36. package/dist/components/search/JsonEditor.js +21 -18
  37. package/dist/components/search/SearchBar.d.ts +34 -34
  38. package/dist/components/search/SearchBar.js +113 -113
  39. package/dist/components/search/criteria.d.ts +86 -74
  40. package/dist/components/search/criteria.js +44 -43
  41. package/dist/components/search/datePeriods.d.ts +47 -48
  42. package/dist/components/search/datePeriods.js +29 -29
  43. package/dist/components/search/dateRanges.d.ts +27 -27
  44. package/dist/components/search/dateRanges.js +16 -16
  45. package/dist/components/search/index.d.ts +2 -2
  46. package/dist/components/search/index.js +14 -14
  47. package/dist/components/search/model.d.ts +28 -28
  48. package/dist/components/search/model.js +21 -21
  49. package/dist/components/search/query.d.ts +71 -71
  50. package/dist/components/search/query.js +119 -119
  51. package/dist/components/shell/AppFrame.js +3 -3
  52. package/dist/components/shell/index.js +1 -1
  53. package/dist/foundations/calendar.d.ts +27 -27
  54. package/dist/foundations/calendar.js +72 -72
  55. package/dist/foundations/chart.d.ts +57 -57
  56. package/dist/foundations/chart.js +27 -27
  57. package/dist/foundations/copy.d.ts +104 -94
  58. package/dist/foundations/copy.es.js +6 -1
  59. package/dist/foundations/copy.js +6 -1
  60. package/dist/foundations/grouping.d.ts +175 -175
  61. package/dist/foundations/grouping.js +0 -0
  62. package/dist/foundations/index.d.ts +1 -1
  63. package/dist/foundations/index.js +21 -21
  64. package/dist/foundations/pivot.d.ts +133 -131
  65. package/dist/foundations/pivot.js +54 -54
  66. package/dist/foundations/pivotSheet.d.ts +36 -36
  67. package/dist/foundations/pivotSheet.js +0 -0
  68. package/dist/foundations/slots.d.ts +38 -38
  69. package/dist/foundations/slots.js +18 -18
  70. package/dist/foundations/sticky.d.ts +28 -28
  71. package/dist/foundations/sticky.js +59 -59
  72. package/dist/foundations/xlsx.d.ts +47 -47
  73. package/dist/foundations/xlsx.js +0 -0
  74. package/dist/primitives/block/Line.d.ts +4 -4
  75. package/dist/primitives/block/Line.js +28 -28
  76. package/dist/primitives/block/index.js +2 -2
  77. package/dist/primitives/cell/index.js +2 -2
  78. package/dist/primitives/choice/index.js +3 -3
  79. package/dist/primitives/date/Calendar.d.ts +7 -1
  80. package/dist/primitives/date/Calendar.js +13 -3
  81. package/dist/primitives/date/DatePicker.d.ts +4 -1
  82. package/dist/primitives/date/DatePicker.js +2 -2
  83. package/dist/primitives/date/index.js +3 -3
  84. package/dist/primitives/disclosure/index.js +1 -1
  85. package/dist/primitives/menu/Menu.d.ts +3 -3
  86. package/dist/primitives/notice/Callout.d.ts +30 -30
  87. package/dist/primitives/notice/Callout.js +6 -6
  88. package/dist/primitives/overlay/index.js +3 -3
  89. package/dist/primitives/picker/Picker.d.ts +6 -0
  90. package/dist/primitives/picker/Picker.js +27 -4
  91. package/dist/primitives/picker/index.js +2 -2
  92. package/dist/primitives/table/DataTable.d.ts +32 -32
  93. package/dist/primitives/table/DataTable.js +24 -24
  94. package/dist/primitives/table/EditableTable.d.ts +10 -10
  95. package/dist/primitives/table/EditableTable.js +9 -9
  96. package/dist/primitives/table/ReportTable.js +7 -7
  97. package/dist/primitives/table/SheetTable.d.ts +13 -13
  98. package/dist/primitives/table/SheetTable.js +14 -14
  99. package/dist/primitives/table/Table.js +8 -8
  100. package/dist/primitives/tabs/Tabs.d.ts +46 -46
  101. package/dist/primitives/tabs/Tabs.js +7 -7
  102. package/dist/primitives/tag/index.js +2 -2
  103. package/dist/primitives/toolbar/index.js +1 -1
  104. package/dist/primitives/value/Copyable.d.ts +22 -22
  105. package/dist/primitives/value/Copyable.js +9 -9
  106. package/dist/tokens.css +17 -17
  107. package/dist/views/list/List.d.ts +36 -36
  108. package/dist/views/list/List.js +19 -19
  109. package/dist/views/list/ListView.js +74 -74
  110. package/dist/views/list/columns.d.ts +10 -10
  111. package/dist/views/list/columns.js +10 -10
  112. package/dist/views/list/derive.d.ts +30 -30
  113. package/dist/views/list/derive.js +49 -49
  114. package/dist/views/list/index.js +2 -2
  115. package/dist/views/list/presentations.js +3 -3
  116. package/dist/views/list/types.d.ts +109 -109
  117. package/dist/views/record/Record.d.ts +14 -14
  118. package/dist/views/record/Record.js +24 -24
  119. package/dist/views/record/index.js +1 -1
  120. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- /* LAS FECHAS Y LAS HORAS — escritas por segmentos o elegidas en un calendario, con el orden
2
- del idioma de la copia. El valor es un ISO (`"2026-10-30"`, `"09:05"`,
3
- `"2026-10-30T09:05"`), lo que manda cualquier backend. */
1
+ /* DATES AND TIMES — written by segments or picked on a calendar, in the order
2
+ of the copy table's language. The value is an ISO string (`"2026-10-30"`, `"09:05"`,
3
+ `"2026-10-30T09:05"`), what any backend sends. */
4
4
  export { Calendar, RangeCalendar, } from "./Calendar.js";
5
5
  export { DateField, DatePicker, DateRangePicker, } from "./DatePicker.js";
6
6
  export { DateTimePicker, TimeField } from "./DateTime.js";
@@ -1,2 +1,2 @@
1
- /* LO QUE SE PLIEGA — una sección que se abre y se cierra, y un grupo de ellas. */
1
+ /* WHAT FOLDS — a section that opens and closes, and a group of them. */
2
2
  export { Accordion, Disclosure, } from "./Disclosure.js";
@@ -15,9 +15,9 @@ export interface MenuOption {
15
15
  * quarters, years— which are one group because they combine, but read as
16
16
  * three because they answer at three different zooms. */
17
17
  divider?: boolean;
18
- /** Cómo se SACA esta opción cuando se dibuja como ficha, si sacarla no es lo mismo que
19
- * volver a elegirla. El filtro a medida es el caso: elegirlo abre el constructor, y eso
20
- * no es lo que tiene que pasar al tocar su ×. */
18
+ /** How this option is REMOVED when drawn as a chip, if removing it is not the same as
19
+ * choosing it again. The custom filter is the case: choosing it opens the builder, and that
20
+ * is not what should happen when its × is tapped. */
21
21
  onRemove?: () => void;
22
22
  disabled?: boolean;
23
23
  /** Visual mark at the end of the label. A string is drawn as a pill
@@ -2,51 +2,51 @@ import type { Tone } from "../../foundations/types.js";
2
2
  import type { LucideIcon } from "lucide-react";
3
3
  import type { ReactNode } from "react";
4
4
  /**
5
- * UN AVISO sobre lo que se está mirando.
5
+ * A NOTICE about what is being looked at.
6
6
  *
7
- * Context: `Empty`, `Failed` y `Missing` dicen que NO HAY contenido y ocupan el
8
- * lugar de la vista. Esto es lo contrario: hay contenido, se ve, y hace falta
9
- * decir algo ADEMÁS —«hay asientos sin registrar en este período», «este período
10
- * está cerrado», «se guardó»—. Sin esta pieza, cada pantalla se lo inventaba
11
- * con un `div` y un color a ojo, y así es como el mismo grado de urgencia
12
- * terminaba pintado de tres maneras.
7
+ * Context: `Empty`, `Failed` and `Missing` say there is NO content and take the
8
+ * place of the view. This is the opposite: there is content, it is visible, and something
9
+ * ELSE has to be said —«there are unregistered entries in this period», «this period
10
+ * is closed», «saved»—. Without this piece, every screen invented its own
11
+ * with a `div` and a colour by eye, and that is how the same degree of urgency
12
+ * ended up painted in three ways.
13
13
  *
14
- * ── El tono es la ÚNICA decisión ────────────────────────────────────
14
+ * ── The tone is the ONLY decision ───────────────────────────────────
15
15
  *
16
- * info un dato que cambia cómo se lee lo de abajo
17
- * warn algo que conviene mirar antes de seguir
18
- * bad algo que está mal y ya tuvo consecuencias
19
- * good algo salió bien y no hay nada que hacer
16
+ * info a fact that changes how what is below is read
17
+ * warn something worth looking at before going on
18
+ * bad something that is wrong and has already had consequences
19
+ * good something went well and there is nothing to do
20
20
  *
21
- * El ícono sale del tono y no se elige: un aviso rojo con un tilde verde adentro
22
- * es una contradicción que alguien va a escribir si se lo dejamos escribir.
21
+ * The icon comes from the tone and is not chosen: a red notice with a green tick inside
22
+ * is a contradiction that someone will write if we let them write it.
23
23
  *
24
- * ── Lo que NO hace ──────────────────────────────────────────────────
24
+ * ── What it does NOT do ─────────────────────────────────────────────
25
25
  *
26
- * No se cierra solo, no tiene temporizador y no se apila. Un aviso que
27
- * desaparece a los cuatro segundos es un aviso que alguien no llegó a leer — eso
28
- * es un `Toast`, que es otra pieza y otra pregunta («pasó algo lejos de acá»).
29
- * Éste habla de lo que está en pantalla, así que se queda mientras sea cierto.
26
+ * It does not close by itself, has no timer and does not stack. A notice that
27
+ * disappears after four seconds is a notice someone did not get to read — that
28
+ * is a `Toast`, which is another piece and another question («something happened away from here»).
29
+ * This one speaks about what is on screen, so it stays as long as it is true.
30
30
  */
31
31
  export type CalloutProps = {
32
- /** Qué pasa. Una oración, en la voz del producto. */
32
+ /** What is happening. One sentence, in the product's voice. */
33
33
  children: ReactNode;
34
- /** Sin esto, `info`. */
34
+ /** Without this, `info`. */
35
35
  tone?: Extract<Tone, "info" | "warn" | "bad" | "good">;
36
- /** El encabezado, cuando la oración sola no alcanza. La mayoría no lo
37
- * necesita: un aviso de dos renglones con título es un cartel. */
36
+ /** The heading, when the sentence alone is not enough. Most do not
37
+ * need it: a two-line notice with a title is a poster. */
38
38
  title?: ReactNode;
39
- /** Lo que resuelve el aviso, si hay algo que apretar. */
39
+ /** What resolves the notice, if there is something to press. */
40
40
  action?: ReactNode;
41
- /** Presente = se puede cerrar. Ausente = no, porque lo que dice sigue siendo
42
- * cierto lo mire quien lo mire. */
41
+ /** Present = it can be closed. Absent = it cannot, because what it says stays
42
+ * true whoever looks at it. */
43
43
  onDismiss?: () => void;
44
- /** El rótulo accesible de la ×. */
44
+ /** The accessible label of the ×. */
45
45
  dismissLabel?: string;
46
- /** Un ícono propio, cuando el del tono no dice lo suficiente. */
46
+ /** An icon of its own, when the tone's does not say enough. */
47
47
  icon?: LucideIcon;
48
- /** Lo que se copia con «Copiar el error» cuando el tono es `bad`. Sin esto, la
49
- * oración (si es texto) con el título. Para un aviso con detalle técnico, pasarlo acá. */
48
+ /** What is copied with «Copiar el error» when the tone is `bad`. Without this, the
49
+ * sentence (if it is text) with the title. For a notice with technical detail, pass it here. */
50
50
  report?: string;
51
51
  };
52
52
  export declare function Callout({ children, tone, title, action, onDismiss, dismissLabel, icon, report, }: CalloutProps): import("react").JSX.Element;
@@ -9,9 +9,9 @@ const ICON = {
9
9
  bad: OctagonAlert,
10
10
  good: CheckCircle2,
11
11
  };
12
- /* El fondo es una capa del color sobre el papel y no un color propio: así el
13
- aviso se lee sobre el piso y sobre el papel blanco sin dos juegos de tokens, y
14
- sigue funcionando el día que cambie la paleta. */
12
+ /* The background is a layer of the colour over the paper and not a colour of its own: so the
13
+ notice reads on the floor and on white paper without two sets of tokens, and
14
+ keeps working the day the palette changes. */
15
15
  const SKIN = {
16
16
  info: "border-info/25 bg-info/8 text-info",
17
17
  warn: "border-warn/30 bg-warn/10 text-warn",
@@ -26,9 +26,9 @@ export function Callout({ children, tone = "info", title, action, onDismiss, dis
26
26
  const sentence = report ?? (typeof children === "string" ? children : "");
27
27
  const copyable = tone === "bad" && sentence !== "";
28
28
  return (_jsxs("div", {
29
- /* `status` y no `alert`: `alert` interrumpe al lector de pantalla y se
30
- reserva para lo que pasó JUSTO AHORA. Un aviso que ya estaba cuando la
31
- pantalla abrió no interrumpe nada. */
29
+ /* `status` and not `alert`: `alert` interrupts the screen reader and is
30
+ reserved for what happened RIGHT NOW. A notice that was already there when the
31
+ screen opened interrupts nothing. */
32
32
  role: "status", className: `flex min-w-0 items-start gap-2.5 rounded-box border ${SKIN[tone]} ${byDensity(d, "px-3 py-2.5", "px-2.5 py-2")}`, children: [_jsx(Icon, { className: "mt-0.5 size-(--size-icon-sm) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-start gap-x-3 gap-y-2", children: [_jsxs("div", { className: "flex min-w-0 flex-1 basis-(--container-name) flex-col gap-1", children: [title === undefined ? null : (_jsx("p", { className: "text-meta font-medium text-ink", children: title })), _jsx("div", { className: "min-w-0 text-meta text-ink", children: children })] }), action === undefined ? null : _jsx("span", { className: "shrink-0", children: action }), copyable ? (_jsx("span", { className: "shrink-0", children: _jsx(ErrorCopy, { report: () => errorReport({
33
33
  heading: typeof title === "string" ? title : "",
34
34
  sentence: typeof title === "string" ? sentence : undefined,
@@ -1,6 +1,6 @@
1
- /* LO QUE FLOTA anclado a algo: el calendario de un selector de fecha, la lista de un
2
- combobox, un formulario chico abierto desde un botón, el nombre de un ícono, el vistazo
3
- a un registro al pasar por su nombre. */
1
+ /* WHAT FLOATS anchored to something: the calendar of a date picker, a combobox's
2
+ list, a small form opened from a button, the name of an icon, a glance
3
+ at a record when hovering its name. */
4
4
  export { Popover } from "./Popover.js";
5
5
  export { PopoverTrigger, } from "./PopoverTrigger.js";
6
6
  export { Preview } from "./Preview.js";
@@ -55,6 +55,12 @@ export type PickerProps = {
55
55
  items: readonly PickerItem[];
56
56
  value?: string;
57
57
  onChange?: (id: string) => void;
58
+ /**
59
+ * The field may be empty: a × beside the chosen name empties it, and so does erasing the name
60
+ * and leaving the field — the way a person says «none». Without it the choice can only be
61
+ * changed, never removed (a required field).
62
+ */
63
+ onClear?: () => void;
58
64
  /**
59
65
  * The options are SEARCHED by whoever gives them — the server's literal search — and this
60
66
  * hears what is typed (and `""` when the list starts over). With it the picker filters
@@ -13,7 +13,7 @@ import { Menu } from "../menu/Menu.js";
13
13
  import { Popover } from "../overlay/Popover.js";
14
14
  import { MatchedText } from "./MatchedText.js";
15
15
  import { Avatar } from "../value/Person.js";
16
- import { AppWindow, Check, ChevronDown, Ellipsis, Eye, PanelRight, PictureInPicture2, SquareArrowOutUpRight, } from "lucide-react";
16
+ import { AppWindow, Check, ChevronDown, Ellipsis, Eye, PanelRight, PictureInPicture2, SquareArrowOutUpRight, X, } from "lucide-react";
17
17
  import { useContext, useMemo, useRef, useState } from "react";
18
18
  import { Collection, ComboBox as AriaComboBox, ComboBoxStateContext, Header, Input, ListBox, ListBoxItem, ListBoxLoadMoreItem, ListBoxSection, useFilter, } from "react-aria-components";
19
19
  /** The icon of each place a record opens — the same in every field and list. */
@@ -98,7 +98,7 @@ export function Picker({ mode, ...props }) {
98
98
  to be ABOVE the component that asks for it. */
99
99
  return (_jsx(AriaLocale, { children: _jsx(EditablePicker, { ...props }) }));
100
100
  }
101
- function EditablePicker({ id: ownId, items, value, onChange, onSearch, valueLabel, placeholder, onBrowseAll, onCreate, onCreateAndEdit, onOpen, openTargets = ["modal", "peek", "side", "page"], emptyText, searchPlaceholder, loading = false, loadingText, onLoadMore, loadingMore = false, renderOption, describedBy: ownDescribedBy, invalid: ownInvalid, disabled = false, "aria-label": ariaLabel, }) {
101
+ function EditablePicker({ id: ownId, items, value, onChange, onClear, onSearch, valueLabel, placeholder, onBrowseAll, onCreate, onCreateAndEdit, onOpen, openTargets = ["modal", "peek", "side", "page"], emptyText, searchPlaceholder, loading = false, loadingText, onLoadMore, loadingMore = false, renderOption, describedBy: ownDescribedBy, invalid: ownInvalid, disabled = false, "aria-label": ariaLabel, }) {
102
102
  const { id, labelledBy, describedBy, invalid } = useFieldIds({
103
103
  id: ownId,
104
104
  describedBy: ownDescribedBy,
@@ -169,6 +169,8 @@ function EditablePicker({ id: ownId, items, value, onChange, onSearch, valueLabe
169
169
  ];
170
170
  const listed = [...visible, ...actions];
171
171
  const closeList = useRef(null);
172
+ /** The person erased the chosen name (and did not take it back with Escape). */
173
+ const erased = useRef(false);
172
174
  const take = (key) => {
173
175
  if (key === null)
174
176
  return;
@@ -199,6 +201,8 @@ function EditablePicker({ id: ownId, items, value, onChange, onSearch, valueLabe
199
201
  onChange?.(next);
200
202
  };
201
203
  return (_jsxs(AriaComboBox, { id: id, "aria-labelledby": labelledBy, "aria-label": controlName(labelledBy, ariaLabel), "aria-describedby": describedBy, items: listed, value: value ?? null, onChange: take, inputValue: text, onInputChange: (next) => {
204
+ // What the person typed down to nothing — not a field whose name is still unknown.
205
+ erased.current = next.trim() === "" && text.trim() !== "";
202
206
  setText(next);
203
207
  setQuery(next);
204
208
  }, onOpenChange: (isOpen, trigger) => {
@@ -206,7 +210,18 @@ function EditablePicker({ id: ownId, items, value, onChange, onSearch, valueLabe
206
210
  if (isOpen && trigger !== "input")
207
211
  setQuery("");
208
212
  if (!isOpen) {
209
- setText(chosenName);
213
+ // The name erased BY THE PERSON and the field left: «none», when the field may be
214
+ // empty. Only then: a field passed through whose name is not known yet shows no text
215
+ // too, and Escape means «leave it as it was».
216
+ if (onClear !== undefined &&
217
+ erased.current &&
218
+ value !== undefined &&
219
+ value !== "" &&
220
+ text.trim() === "")
221
+ onClear();
222
+ else
223
+ setText(chosenName);
224
+ erased.current = false;
210
225
  setQuery("");
211
226
  }
212
227
  },
@@ -221,6 +236,10 @@ function EditablePicker({ id: ownId, items, value, onChange, onSearch, valueLabe
221
236
  onFocus: (event) => {
222
237
  if (!open)
223
238
  event.currentTarget.select();
239
+ }, onKeyDown: (event) => {
240
+ // Escape puts the name back: never an emptied choice.
241
+ if (event.key === "Escape")
242
+ erased.current = false;
224
243
  }, className: "h-full min-w-0 flex-1 bg-transparent px-2.5 text-meta text-ink outline-0 placeholder:text-muted disabled:cursor-not-allowed" }), value !== undefined &&
225
244
  value !== "" &&
226
245
  onOpen !== undefined &&
@@ -232,7 +251,11 @@ function EditablePicker({ id: ownId, items, value, onChange, onSearch, valueLabe
232
251
  icon: OPEN_ICON[to],
233
252
  })),
234
253
  },
235
- ], onSelect: (to) => onOpen(value, to) }))] })) : null, _jsx(FieldButton, { className: "mr-1", children: _jsx(ChevronDown, { "aria-hidden": true, className: "size-(--size-icon-md)", strokeWidth: 2 }) })] }), _jsxs(Popover, { placement: "bottom start", className: "flex w-(--trigger-width) flex-col overflow-hidden", children: [_jsx(PickerOptions, { items: listed, marks: hasMarks, hints: hasHints, remaining: remaining, query: query, emptyText: loading ? shownLoading : shownEmpty,
254
+ ], onSelect: (to) => onOpen(value, to) }))] })) : null, onClear === undefined || value === undefined || value === "" || disabled ? null : (_jsx(IconButton, { icon: X, label: copy.picker.clear, size: "sm", onClick: () => {
255
+ setText("");
256
+ setQuery("");
257
+ onClear();
258
+ } })), _jsx(FieldButton, { className: "mr-1", children: _jsx(ChevronDown, { "aria-hidden": true, className: "size-(--size-icon-md)", strokeWidth: 2 }) })] }), _jsxs(Popover, { placement: "bottom start", className: "flex w-(--trigger-width) flex-col overflow-hidden", children: [_jsx(PickerOptions, { items: listed, marks: hasMarks, hints: hasHints, remaining: remaining, query: query, emptyText: loading ? shownLoading : shownEmpty,
236
259
  /* Not while the first page loads: the sentinel of an empty list is in view and
237
260
  would ask for page two before page one arrived. */
238
261
  onLoadMore: loading ? undefined : onLoadMore, loadingMore: loadingMore, ...(renderOption === undefined ? {} : { renderOption }) }), remaining > 0 && !browsable ? (_jsxs("div", { className: "flex shrink-0 items-center gap-2 border-t border-line bg-ground px-2.5 py-1.5", children: [_jsx("span", { className: "text-micro tabular-nums text-muted", children: fillCopy(copy.picker.more, { count: remaining.toLocaleString(copy.locale) }) }), _jsx("span", { className: "text-micro text-muted", children: copy.picker.refine })] })) : null] })] }));
@@ -1,8 +1,8 @@
1
1
  /* CHOOSING RECORDS — one (`Picker`, the many2one) or several (`TagsField`, the many2many).
2
2
  The replacement for `<select>` when you have to SEE in order to choose. */
3
3
  export { Picker, } from "./Picker.js";
4
- /* Lo buscado, marcado: para que una opción propia (`renderOption`) lo diga como las demás. */
4
+ /* What was searched, marked: so an option of your own (`renderOption`) says it like the others do. */
5
5
  export { MatchedText } from "./MatchedText.js";
6
- /* El many2many: las fichas elegidas más una entrada que agrega la siguiente. */
6
+ /* The many2many: the chosen chips plus an input that adds the next one. */
7
7
  export {} from "./tagChoices.js";
8
8
  export { TagsField } from "./TagsField.js";
@@ -23,9 +23,9 @@ export declare function aggregateText<T>(column: DataColumn<T>, value: number):
23
23
  export interface DataColumn<T> {
24
24
  id: string;
25
25
  header: string;
26
- /** Qué campo del MODELO muestra esta columna, cuando no se llama igual que
27
- * él: «filas» muestra `row_count`. Lo lee `columnsFromModel` para no volver
28
- * a agregar, en crudo, un campo que esta columna ya contesta. */
26
+ /** Which field of the MODEL this column shows, when it is not named the same as
27
+ * it: «filas» shows `row_count`. `columnsFromModel` reads it so as not to add
28
+ * again, raw, a field this column already answers. */
29
29
  field?: string;
30
30
  /** The raw value: this is what sorting and grouping run on. */
31
31
  value: (row: T) => string | number | boolean | null;
@@ -35,14 +35,14 @@ export interface DataColumn<T> {
35
35
  * need it: they align with tabular figures in the same face as the rest of the row. */
36
36
  mono?: boolean;
37
37
  /**
38
- * Cómo se LEE la columna donde no se puede dibujar: la planilla, que es una
39
- * cuadrícula de texto y números y no puede recibir un nodo.
38
+ * How the column is READ where it cannot be drawn: the sheet, which is a
39
+ * grid of text and numbers and cannot take a node.
40
40
  *
41
- * Context: sin esto, la planilla caía a `value`, que es la clave de ORDEN y
42
- * no lo que una persona lee. La columna «estado» de Facturas mostraba
43
- * `posted` y `paid` —los valores del contrato— en vez de «publicada» y
44
- * «pagada», que es lo que dice la ficha de al lado en la tabla. Dos
45
- * presentaciones del mismo conjunto diciendo cosas distintas.
41
+ * Context: without this, the sheet fell back to `value`, which is the SORT key and
42
+ * not what a person reads. The «estado» column of Invoices showed
43
+ * `posted` and `paid` —the contract's values— instead of «publicada» and
44
+ * «pagada», which is what the card next to it in the table says. Two
45
+ * presentations of the same set saying different things.
46
46
  */
47
47
  text?: (row: T) => string;
48
48
  /** Paints the BACKGROUND of the cell, row by row. It is what turns a table
@@ -118,35 +118,35 @@ export type DataTableCreate<T> = {
118
118
  label?: string;
119
119
  };
120
120
  /**
121
- * El agregado de una columna sobre un conjunto de filas.
121
+ * The aggregate of a column over a set of rows.
122
122
  *
123
- * Vive afuera del componente porque lo preguntan tres lugares: el pie de la
124
- * tabla, la banda de un montón en la planilla, y la línea de un informe armado
125
- * a partir de los montones. Tres implementaciones de «cuánto suma esto» es que
126
- * el pie diga un número y el montón otro.
123
+ * It lives outside the component because three places ask for it: the table's
124
+ * foot, a pile's band in the sheet, and the line of a report built
125
+ * from the piles. Three implementations of «how much does this add up to» means
126
+ * the foot says one number and the pile another.
127
127
  *
128
- * `null` cuando la columna no declaró agregado, no es numérica, o no hay ningún
129
- * número que sumar — que es distinto de sumar cero.
128
+ * `null` when the column declared no aggregate, is not numeric, or there is no
129
+ * number to add — which is not the same as adding zero.
130
130
  */
131
131
  export declare function aggregateOf<T extends object>(column: DataColumn<T>, rows: readonly T[]): number | null;
132
132
  /**
133
- * UN NIVEL, como lo necesita una tabla.
133
+ * ONE LEVEL, as a table needs it.
134
134
  *
135
- * La identidad es la del NIVEL y no la del campo: un mismo `registered_at`
136
- * puesto por mes y por día son dos cortes, y con el nombre del campo serían el
137
- * mismo repetido. `keyOf` da la clave del motor —la misma que arman las otras
138
- * presentaciones, así que lo plegado vale para todas— y `labelOf` la lee en el
139
- * idioma activo.
135
+ * The identity is the LEVEL's and not the field's: one `registered_at`
136
+ * set by month and by day makes two cuts, and with the field's name they would be the
137
+ * same one repeated. `keyOf` gives the engine's key —the same one the other
138
+ * presentations build, so what is folded holds for all— and `labelOf` reads it in the
139
+ * active language.
140
140
  */
141
141
  export type GroupColumn<T> = {
142
- /** La identidad del nivel: `levelKey(level)`. */
142
+ /** The level's identity: `levelKey(level)`. */
143
143
  id: string;
144
- /** Cómo se llama el corte, a la izquierda del valor. Sin él, «Septiembre» no
145
- * dice si es cuándo se registró o cuándo se corrió. */
144
+ /** What the cut is called, to the left of the value. Without it, «Septiembre» does not
145
+ * say whether it is when it was registered or when it was run. */
146
146
  label: string;
147
- /** A qué montón va cada fila en este nivel. */
147
+ /** Which pile each row goes to at this level. */
148
148
  keyOf: (item: T) => string;
149
- /** Cómo se lee esa clave. */
149
+ /** How that key is read. */
150
150
  labelOf: (key: string) => string;
151
151
  };
152
152
  export declare function DataTable<T extends object>({ data, columns, getRowId, sort, onSortChange, levels, selected, onSelectedChange, height, onRowClick, rowActions, totals, collapsed, onGroupToggle, piles, onMore, create, copyable, }: {
@@ -158,11 +158,11 @@ export declare function DataTable<T extends object>({ data, columns, getRowId, s
158
158
  sort?: readonly SortState[];
159
159
  onSortChange?: (next: SortState[]) => void;
160
160
  /**
161
- * Los NIVELES por los que se parte, de afuera hacia adentro. Vacío o ausente
162
- * es «sin agrupar».
161
+ * The LEVELS the set is split by, from the outside in. Empty or absent
162
+ * means «not grouped».
163
163
  *
164
- * Varios, porque agrupar no es una pregunta: «por cliente y después por
165
- * mes» es un árbol y no una lista de montones. El orden ES la jerarquía.
164
+ * Several, because grouping is not one question: «by customer and then by
165
+ * month» is a tree and not a list of piles. The order IS the hierarchy.
166
166
  */
167
167
  levels?: readonly GroupColumn<T>[];
168
168
  selected?: ReadonlySet<string>;
@@ -92,15 +92,15 @@ const FEATURES = tableFeatures({
92
92
  aggregationFns,
93
93
  });
94
94
  /**
95
- * El agregado de una columna sobre un conjunto de filas.
95
+ * The aggregate of a column over a set of rows.
96
96
  *
97
- * Vive afuera del componente porque lo preguntan tres lugares: el pie de la
98
- * tabla, la banda de un montón en la planilla, y la línea de un informe armado
99
- * a partir de los montones. Tres implementaciones de «cuánto suma esto» es que
100
- * el pie diga un número y el montón otro.
97
+ * It lives outside the component because three places ask for it: the table's
98
+ * foot, a pile's band in the sheet, and the line of a report built
99
+ * from the piles. Three implementations of «how much does this add up to» means
100
+ * the foot says one number and the pile another.
101
101
  *
102
- * `null` cuando la columna no declaró agregado, no es numérica, o no hay ningún
103
- * número que sumar — que es distinto de sumar cero.
102
+ * `null` when the column declared no aggregate, is not numeric, or there is no
103
+ * number to add — which is not the same as adding zero.
104
104
  */
105
105
  export function aggregateOf(column, rows) {
106
106
  if (column.aggregate === undefined || column.numeric !== true)
@@ -214,22 +214,22 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
214
214
  id: c.id,
215
215
  header: c.header,
216
216
  enableSorting: c.sortable !== false,
217
- /* Ninguna columna agrupa. Lo que parte el conjunto son los NIVELES, y
218
- cada uno entra como una columna suya —abajo— que existe sólo para
219
- eso: nadie la dibuja y nadie la ordena. */
217
+ /* No column groups. What splits the set are the LEVELS, and
218
+ each one comes in as a column of its own —below— that exists only for
219
+ that: nobody draws it and nobody sorts it. */
220
220
  enableGrouping: false,
221
221
  aggregationFn: c.aggregate ?? "count",
222
222
  })),
223
- /* Una columna por NIVEL, no por campo. Es la única forma de que «por mes y
224
- adentro por día» sea dos cortes: con el id de la columna, los dos niveles
225
- de `registered_at` eran el mismo id repetido, y un mismo id no se puede
226
- agrupar dos veces.
223
+ /* One column per LEVEL, not per field. It is the only way for «by month and
224
+ inside it by day» to be two cuts: with the column's id, the two levels
225
+ of `registered_at` were the same id repeated, and one id cannot be
226
+ grouped twice.
227
227
 
228
- Y la clave la pone el nivel, no la columna: `value` es la clave de
229
- ORDEN —para una fecha, los milisegundos— y agrupar por ella deja un
230
- montón por instante, con «1789294903895» de rótulo. Acá entra la misma
231
- clave que arman las otras cinco presentaciones, así que los montones de
232
- la tabla son LOS MISMOS y lo plegado vale para todas. */
228
+ And the key is set by the level, not the column: `value` is the SORT
229
+ key —for a date, the milliseconds— and grouping by it leaves one
230
+ pile per instant, with «1789294903895» as its label. Here goes the same
231
+ key the other five presentations build, so the table's piles
232
+ are THE SAME ones and what is folded holds for all. */
233
233
  ...(levels ?? []).map((level) => helper.accessor((row) => level.keyOf(row), {
234
234
  id: level.id,
235
235
  header: level.label,
@@ -316,8 +316,8 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
316
316
  const key = pathKey(path);
317
317
  const depth = path.length - 1;
318
318
  const level = levels?.find((one) => one.id === row.groupingColumnId);
319
- /* La CLAVE del montón —la del motor— y el rótulo, que lo pone el nivel: son dos
320
- textos y sólo el segundo cambia con el idioma. */
319
+ /* The pile's KEY —the engine's— and the label, which the level sets: they are two
320
+ texts and only the second changes with the language. */
321
321
  const value = path[depth] ?? key;
322
322
  return {
323
323
  kind: "pile",
@@ -325,9 +325,9 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
325
325
  depth,
326
326
  level: level?.label,
327
327
  label: level === undefined ? value : level.labelOf(value),
328
- /* Las FILAS de adentro, no los subgrupos: `subRows` de un montón con niveles
329
- abajo son los montones del nivel siguiente, y contarlos decía «2» donde hay
330
- cuarenta filas. */
328
+ /* The rows INSIDE, not the subgroups: `subRows` of a pile with levels
329
+ below are the piles of the next level, and counting them said «2» where there are
330
+ forty rows. */
331
331
  count: row.getLeafRows().filter((leaf) => leaf.subRows.length === 0).length,
332
332
  detail: undefined,
333
333
  open: collapsed === undefined ? row.getIsExpanded() : !collapsed.includes(key),
@@ -167,9 +167,9 @@ export declare function EditableTable<T>({ rows, columns, getRowId, onChange, on
167
167
  * knows what adding up means in their domain —a percentage is not summed, it
168
168
  * is averaged. */
169
169
  totals, empty, grouping,
170
- /** El total de una columna DENTRO de un montón, ya formateado. Lo calcula quien
171
- * compone, por el mismo motivo que `totals`: sumar significa cosas distintas
172
- * según el dominio, y un porcentaje se promedia, no se suma. */
170
+ /** A column's total INSIDE a pile, already formatted. Whoever composes
171
+ * computes it, for the same reason as `totals`: adding up means different things
172
+ * depending on the domain, and a percentage is averaged, not added. */
173
173
  groupTotal, height, layout, onOpen, onDiscard, bands, adds, flag, onReorder, cellState, rowState, }: {
174
174
  rows: readonly T[];
175
175
  columns: readonly EditColumn<T>[];
@@ -188,14 +188,14 @@ groupTotal, height, layout, onOpen, onDiscard, bands, adds, flag, onReorder, cel
188
188
  totals?: readonly (ReactNode | null)[];
189
189
  empty?: string;
190
190
  /**
191
- * El agrupado, con el mismo contrato que el resto de las vistas de datos.
191
+ * Grouping, with the same contract as the rest of the data views.
192
192
  *
193
- * Editar y agrupar no se estorban: la fila que se edita sigue siendo una fila,
194
- * y el montón sólo decide dónde cae. Lo que no se hereda es el orden — las
195
- * filas de un montón quedan juntas, así que agregar una fila nueva la pone al
196
- * final de todo y no adentro del montón que estabas mirando, que es el
197
- * comportamiento honesto: todavía no tiene valor en el campo por el que se
198
- * agrupa.
193
+ * Editing and grouping do not get in each other's way: the row being edited is still a row,
194
+ * and the pile only decides where it lands. What is not inherited is the order — the
195
+ * rows of a pile stay together, so adding a new row puts it at the
196
+ * end of everything and not inside the pile you were looking at, which is the
197
+ * honest behaviour: it does not have a value yet in the field it is
198
+ * grouped by.
199
199
  */
200
200
  grouping?: Grouping<T>;
201
201
  groupTotal?: (column: EditColumn<T>, rows: readonly T[]) => ReactNode | null;
@@ -280,9 +280,9 @@ export function EditableTable({ rows, columns, getRowId, onChange, onRemove, onA
280
280
  * knows what adding up means in their domain —a percentage is not summed, it
281
281
  * is averaged. */
282
282
  totals, empty, grouping,
283
- /** El total de una columna DENTRO de un montón, ya formateado. Lo calcula quien
284
- * compone, por el mismo motivo que `totals`: sumar significa cosas distintas
285
- * según el dominio, y un porcentaje se promedia, no se suma. */
283
+ /** A column's total INSIDE a pile, already formatted. Whoever composes
284
+ * computes it, for the same reason as `totals`: adding up means different things
285
+ * depending on the domain, and a percentage is averaged, not added. */
286
286
  groupTotal, height, layout = "auto", onOpen, onDiscard, bands, adds, flag, onReorder, cellState, rowState, }) {
287
287
  const copy = useUiCopy();
288
288
  const bandOf = (row) => bands?.kind(row) ?? null;
@@ -367,8 +367,8 @@ groupTotal, height, layout = "auto", onOpen, onDiscard, bands, adds, flag, onReo
367
367
  const [arriving, setArriving] = useState(null);
368
368
  const addButton = useRef(null);
369
369
  const rowById = useMemo(() => new Map(rows.map((row) => [getRowId(row), row])), [rows, getRowId]);
370
- /* La secuencia que se dibuja: montones y filas intercalados. Sin agrupado, las
371
- filas tal cual — una tabla que no agrupa no paga nada por poder hacerlo. */
370
+ /* The sequence that gets drawn: piles and rows interleaved. Without grouping, the
371
+ rows as they are — a table that does not group pays nothing for being able to. */
372
372
  const drawn = useMemo(() => {
373
373
  const piles = pilesOf(rows, grouping);
374
374
  if (piles === null)
@@ -852,10 +852,10 @@ groupTotal, height, layout = "auto", onOpen, onDiscard, bands, adds, flag, onReo
852
852
  const inside = pile.piles.length === 0 ? pile.items : pileItems(pile.piles);
853
853
  return [
854
854
  gap,
855
- /* La banda respeta la cuadrícula: el rótulo en la primera
856
- columna y cada total bajo la suya. Un total en un rincón
857
- obliga a buscar de qué columna es; alineado no hay nada que
858
- buscar. */
855
+ /* The band respects the grid: the label in the first
856
+ column and each total under its own. A total in a corner
857
+ forces you to look for which column it belongs to; aligned there is nothing to
858
+ look for. */
859
859
  _jsxs("tr", { ...windowed, children: [reorderable ? _jsx("td", { className: "w-0 bg-ground" }) : null, columns.map((c, ci) => (_jsx("td", { className: `bg-ground text-meta ${cell} ${c.numeric === true ? "text-right tabular-nums" : ""}`, style: ci === 0 && pile.depth > 0
860
860
  ? {
861
861
  paddingLeft: `calc(var(--spacing-indent) * ${pile.depth} + 0.625rem)`,
@@ -97,12 +97,12 @@ defaultOpen, caption, height, }) {
97
97
  });
98
98
  }
99
99
  return (
100
- /* Misma decisión que las otras dos tablas, en el mismo lugar: con alto la
101
- caja scrollea y la pila arranca de cero adentro; sin alto y entrando, no
102
- hay caja y el encabezado se pega debajo de la barra de la lista. Antes
103
- esto era `overflow-auto` siempre, así que el encabezado heredaba el
104
- desplazamiento de la barra y quedaba empujado 68 px hacia adentro de su
105
- propia caja — banda en blanco arriba y títulos de columna cayendo entre
106
- las filas. */
100
+ /* Same decision as the other two tables, in the same place: with a height the
101
+ box scrolls and the stack starts from zero inside; without a height and fitting, there is no
102
+ box and the header sticks below the list's bar. This used
103
+ to be `overflow-auto` always, so the header inherited the
104
+ bar's offset and ended up pushed 68 px into its
105
+ own box — a blank band on top and column titles falling between
106
+ the rows. */
107
107
  _jsx("div", { ref: caja.ref, tabIndex: caja.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${caja.className}`, style: caja.style, children: _jsxs("table", { className: "w-full border-collapse px-1", children: [caption === undefined ? null : (_jsx("caption", { className: `text-left text-meta text-muted ${byDensity(d, "px-3 pb-2", "px-2 pb-1.5")}`, children: caption })), _jsx("thead", { className: "sticky z-20 bg-ground", style: stickyTop, children: _jsxs("tr", { className: "border-b border-line-strong", children: [_jsx("th", { className: `sticky left-0 z-10 bg-ground text-left ${compact ? "px-2 py-1.5" : "px-3 py-2"}`, children: _jsx("span", { className: "sr-only", children: copy.report.concept }) }), columns.map((c) => (_jsx("th", { scope: "col", className: `text-right ${HEADER_TEXT} ${compact ? "px-2 py-1.5" : "px-3 py-2"}`, children: c.header }, c.id))), _jsx("td", { className: "w-0" })] }) }), _jsx("tbody", { children: rows.map((r) => (_jsx(ReportLine, { row: r, columns: columns, open: open, onToggle: toggle, compact: compact }, r.id))) })] }) }));
108
108
  }