@sincpro/web-ui 2.0.0 → 2.2.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 (143) hide show
  1. package/README.md +45 -0
  2. package/dist/components/activity/Activity.d.ts +13 -14
  3. package/dist/components/activity/Activity.js +1 -1
  4. package/dist/components/activity/Messages.d.ts +5 -5
  5. package/dist/components/activity/Messages.js +8 -8
  6. package/dist/components/attachments/Attachments.d.ts +7 -1
  7. package/dist/components/attachments/Attachments.js +8 -2
  8. package/dist/components/board/Board.d.ts +32 -2
  9. package/dist/components/board/Board.js +27 -4
  10. package/dist/components/board/index.d.ts +1 -1
  11. package/dist/components/board/index.js +2 -1
  12. package/dist/components/form/Form.js +6 -6
  13. package/dist/components/form/index.js +2 -2
  14. package/dist/components/frame/FrameView.d.ts +5 -5
  15. package/dist/components/frame/FrameView.js +4 -4
  16. package/dist/components/listing/GroupingLevels.d.ts +22 -22
  17. package/dist/components/listing/GroupingLevels.js +9 -9
  18. package/dist/components/listing/Listing.d.ts +11 -11
  19. package/dist/components/listing/Listing.js +11 -11
  20. package/dist/components/listing/ListingBar.js +11 -11
  21. package/dist/components/listing/Row.d.ts +19 -19
  22. package/dist/components/listing/Row.js +27 -27
  23. package/dist/components/listing/SortMenu.d.ts +36 -36
  24. package/dist/components/listing/SortMenu.js +6 -6
  25. package/dist/components/listing/grouping.d.ts +16 -16
  26. package/dist/components/listing/grouping.js +6 -6
  27. package/dist/components/listing/index.js +1 -1
  28. package/dist/components/listing/modelColumns.d.ts +25 -25
  29. package/dist/components/listing/modelColumns.js +24 -24
  30. package/dist/components/listing/pages.js +4 -4
  31. package/dist/components/listing/set.d.ts +18 -18
  32. package/dist/components/navigation/NavigationTree.js +2 -2
  33. package/dist/components/navigation/index.js +2 -2
  34. package/dist/components/record/RecordSkeleton.js +7 -7
  35. package/dist/components/search/CriteriaBuilder.d.ts +22 -22
  36. package/dist/components/search/CriteriaBuilder.js +31 -31
  37. package/dist/components/search/CriteriaChips.d.ts +9 -9
  38. package/dist/components/search/CriteriaChips.js +12 -12
  39. package/dist/components/search/FilterBuilder.d.ts +67 -67
  40. package/dist/components/search/FilterBuilder.js +104 -104
  41. package/dist/components/search/JoinWord.d.ts +1 -1
  42. package/dist/components/search/JoinWord.js +14 -14
  43. package/dist/components/search/JsonEditor.d.ts +8 -8
  44. package/dist/components/search/JsonEditor.js +16 -16
  45. package/dist/components/search/SearchBar.d.ts +34 -34
  46. package/dist/components/search/SearchBar.js +140 -117
  47. package/dist/components/search/criteria.d.ts +61 -61
  48. package/dist/components/search/criteria.js +39 -39
  49. package/dist/components/search/datePeriods.d.ts +47 -48
  50. package/dist/components/search/datePeriods.js +29 -29
  51. package/dist/components/search/dateRanges.d.ts +27 -27
  52. package/dist/components/search/dateRanges.js +16 -16
  53. package/dist/components/search/index.js +13 -13
  54. package/dist/components/search/model.d.ts +28 -28
  55. package/dist/components/search/model.js +21 -21
  56. package/dist/components/search/query.d.ts +71 -71
  57. package/dist/components/search/query.js +119 -119
  58. package/dist/components/shell/AppFrame.d.ts +9 -2
  59. package/dist/components/shell/AppFrame.js +102 -14
  60. package/dist/components/shell/Sidebar.d.ts +34 -0
  61. package/dist/components/shell/Sidebar.js +32 -0
  62. package/dist/components/shell/TopBar.d.ts +2 -0
  63. package/dist/components/shell/TopBar.js +13 -9
  64. package/dist/components/shell/index.d.ts +2 -0
  65. package/dist/components/shell/index.js +5 -1
  66. package/dist/components/shell/sidebarDrawer.d.ts +26 -0
  67. package/dist/components/shell/sidebarDrawer.js +22 -0
  68. package/dist/foundations/calendar.d.ts +27 -27
  69. package/dist/foundations/calendar.js +72 -72
  70. package/dist/foundations/chart.d.ts +57 -57
  71. package/dist/foundations/chart.js +27 -27
  72. package/dist/foundations/copy.d.ts +109 -94
  73. package/dist/foundations/copy.es.js +10 -2
  74. package/dist/foundations/copy.js +10 -2
  75. package/dist/foundations/grouping.d.ts +175 -175
  76. package/dist/foundations/grouping.js +0 -0
  77. package/dist/foundations/index.d.ts +1 -1
  78. package/dist/foundations/index.js +21 -21
  79. package/dist/foundations/pivot.d.ts +133 -131
  80. package/dist/foundations/pivot.js +54 -54
  81. package/dist/foundations/pivotSheet.d.ts +36 -36
  82. package/dist/foundations/pivotSheet.js +0 -0
  83. package/dist/foundations/slots.d.ts +38 -38
  84. package/dist/foundations/slots.js +18 -18
  85. package/dist/foundations/sticky.d.ts +28 -28
  86. package/dist/foundations/sticky.js +59 -59
  87. package/dist/foundations/xlsx.d.ts +47 -47
  88. package/dist/foundations/xlsx.js +0 -0
  89. package/dist/primitives/block/Line.d.ts +4 -4
  90. package/dist/primitives/block/Line.js +28 -28
  91. package/dist/primitives/block/index.js +2 -2
  92. package/dist/primitives/cell/index.js +2 -2
  93. package/dist/primitives/choice/index.js +3 -3
  94. package/dist/primitives/date/Calendar.d.ts +7 -1
  95. package/dist/primitives/date/Calendar.js +13 -3
  96. package/dist/primitives/date/DatePicker.d.ts +4 -1
  97. package/dist/primitives/date/DatePicker.js +2 -2
  98. package/dist/primitives/date/index.js +3 -3
  99. package/dist/primitives/disclosure/index.js +1 -1
  100. package/dist/primitives/field/DropZone.d.ts +22 -3
  101. package/dist/primitives/field/DropZone.js +33 -12
  102. package/dist/primitives/menu/Menu.d.ts +10 -6
  103. package/dist/primitives/menu/Menu.js +4 -3
  104. package/dist/primitives/notice/Callout.d.ts +30 -30
  105. package/dist/primitives/notice/Callout.js +6 -6
  106. package/dist/primitives/overlay/index.js +3 -3
  107. package/dist/primitives/picker/Picker.d.ts +6 -0
  108. package/dist/primitives/picker/Picker.js +27 -4
  109. package/dist/primitives/picker/index.js +2 -2
  110. package/dist/primitives/table/DataTable.d.ts +32 -32
  111. package/dist/primitives/table/DataTable.js +24 -24
  112. package/dist/primitives/table/EditableTable.d.ts +10 -10
  113. package/dist/primitives/table/EditableTable.js +9 -9
  114. package/dist/primitives/table/ReportTable.js +7 -7
  115. package/dist/primitives/table/SheetTable.d.ts +13 -13
  116. package/dist/primitives/table/SheetTable.js +14 -14
  117. package/dist/primitives/table/Table.js +8 -8
  118. package/dist/primitives/tabs/Tabs.d.ts +46 -46
  119. package/dist/primitives/tabs/Tabs.js +4 -30
  120. package/dist/primitives/tag/Count.d.ts +23 -0
  121. package/dist/primitives/tag/Count.js +59 -0
  122. package/dist/primitives/tag/index.d.ts +1 -0
  123. package/dist/primitives/tag/index.js +5 -2
  124. package/dist/primitives/toolbar/index.js +1 -1
  125. package/dist/primitives/value/Copyable.d.ts +22 -22
  126. package/dist/primitives/value/Copyable.js +9 -9
  127. package/dist/primitives/value/Metric.d.ts +7 -2
  128. package/dist/primitives/value/Metric.js +12 -4
  129. package/dist/tokens.css +164 -57
  130. package/dist/views/list/List.d.ts +36 -36
  131. package/dist/views/list/List.js +19 -19
  132. package/dist/views/list/ListView.js +74 -74
  133. package/dist/views/list/columns.d.ts +10 -10
  134. package/dist/views/list/columns.js +10 -10
  135. package/dist/views/list/derive.d.ts +30 -30
  136. package/dist/views/list/derive.js +49 -49
  137. package/dist/views/list/index.js +2 -2
  138. package/dist/views/list/presentations.js +3 -3
  139. package/dist/views/list/types.d.ts +109 -109
  140. package/dist/views/record/Record.d.ts +14 -14
  141. package/dist/views/record/Record.js +24 -24
  142. package/dist/views/record/index.js +1 -1
  143. 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";
@@ -17,8 +17,17 @@ import { type FormMode } from "../../foundations/form.js";
17
17
  * say a dragged file's extension until it lands, and a drop that silently does
18
18
  * nothing reads as a broken zone. The file reaches `onFile`, and the consumer
19
19
  * answers with `error` when it cannot read it.
20
+ *
21
+ * ── One file, or several ─────────────────────────────────────────────
22
+ *
23
+ * `multiple` takes every file of a drop or of the dialog in ONE call to `onFiles` —
24
+ * a gallery gets its thirty photos as one batch, not thirty events. Listing what
25
+ * was chosen, with its thumbnails and per-file removal, is `Attachments`, which
26
+ * draws this zone: the zone takes files, it does not keep them. `max` caps the
27
+ * batch: the first `max` go through and the zone SAYS how many were left out — a
28
+ * silent cut is a photo nobody knows is missing.
20
29
  */
21
- export type DropZoneProps = {
30
+ type DropZoneCommon = {
22
31
  /** The browser's `accept` list: extensions and MIME types, comma-separated
23
32
  * (`".pdf,application/pdf"`). */
24
33
  accept?: string;
@@ -29,7 +38,6 @@ export type DropZoneProps = {
29
38
  fileName?: string;
30
39
  fileDetail?: string;
31
40
  error?: string | null;
32
- onFile: (file: File) => void;
33
41
  onCancel?: () => void;
34
42
  onRetry?: () => void;
35
43
  id?: string;
@@ -39,4 +47,15 @@ export type DropZoneProps = {
39
47
  * file's name. */
40
48
  mode?: FormMode;
41
49
  };
42
- export declare function DropZone({ accept, label, busy, progress, fileName, fileDetail, error, onFile, onCancel, onRetry, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, mode, }: DropZoneProps): import("react").JSX.Element;
50
+ export type DropZoneProps = DropZoneCommon & ({
51
+ multiple?: false;
52
+ onFile: (file: File) => void;
53
+ } | {
54
+ multiple: true;
55
+ /** Every file of one drop, paste or choice, in their order. */
56
+ onFiles: (files: File[]) => void;
57
+ /** At most this many per batch; the rest are left out, and the zone says so. */
58
+ max?: number;
59
+ });
60
+ export declare function DropZone(props: DropZoneProps): import("react").JSX.Element;
61
+ export {};
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useUiCopy } from "../../foundations/copy.js";
3
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
4
  import { useFieldIds } from "../../foundations/form.js";
5
5
  import { useFormMode } from "../../foundations/form.js";
6
6
  import { cn } from "../../foundations/variants.js";
@@ -8,9 +8,13 @@ import { Button, buttonClasses } from "../button/Button.js";
8
8
  import { ReadValue } from "./Field.js";
9
9
  import { Failed } from "../notice/Notice.js";
10
10
  import { ProgressBar } from "../value/ProgressBar.js";
11
+ import { useState } from "react";
11
12
  import { Button as AriaButton, DropZone as AriaDropZone, FileTrigger, } from "react-aria-components";
12
- export function DropZone({ accept, label, busy = false, progress, fileName, fileDetail, error, onFile, onCancel, onRetry, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, mode, }) {
13
+ export function DropZone(props) {
14
+ const { accept, label, busy = false, progress, fileName, fileDetail, error, onCancel, onRetry, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, mode, } = props;
13
15
  const copy = useUiCopy();
16
+ /* How many the last batch left out, said under the zone until the next batch. */
17
+ const [leftOut, setLeftOut] = useState(null);
14
18
  const { id, labelledBy, describedBy, invalid } = useFieldIds({
15
19
  id: ownId,
16
20
  describedBy: ownDescribedBy,
@@ -19,20 +23,36 @@ export function DropZone({ accept, label, busy = false, progress, fileName, file
19
23
  const readMode = useFormMode(mode) === "read";
20
24
  if (readMode)
21
25
  return _jsx(ReadValue, { value: fileName ?? null });
22
- const sentence = label ?? copy.field.drop;
26
+ const many = props.multiple === true;
27
+ const sentence = label ?? (many ? copy.field.dropMany : copy.field.drop);
23
28
  const types = accept
24
29
  ?.split(",")
25
30
  .map((t) => t.trim())
26
31
  .filter((t) => t !== "");
32
+ function take(files) {
33
+ if (files.length === 0)
34
+ return;
35
+ if (props.multiple !== true) {
36
+ props.onFile(files[0]);
37
+ return;
38
+ }
39
+ const max = props.max;
40
+ const taken = max === undefined ? files : files.slice(0, max);
41
+ setLeftOut(taken.length < files.length ? { taken: taken.length, of: files.length } : null);
42
+ props.onFiles([...taken]);
43
+ }
27
44
  async function onDrop(items) {
28
45
  if (busy)
29
46
  return;
47
+ const files = [];
30
48
  for (const item of items) {
31
- if (item.kind === "file") {
32
- onFile(await item.getFile());
33
- return;
34
- }
49
+ if (item.kind !== "file")
50
+ continue;
51
+ files.push(await item.getFile());
52
+ if (!many)
53
+ break;
35
54
  }
55
+ take(files);
36
56
  }
37
57
  return (_jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [_jsxs(AriaDropZone, { ...(labelledBy === undefined
38
58
  ? { "aria-label": sentence }
@@ -40,11 +60,12 @@ export function DropZone({ accept, label, busy = false, progress, fileName, file
40
60
  ? "border-primary bg-primary/8 forced-colors:border-[Highlight]"
41
61
  : invalid
42
62
  ? "border-danger bg-surface"
43
- : "border-line-strong bg-surface", isFocusVisible ? "outline-2" : "outline-0"), children: [_jsx("p", { className: "text-body text-muted", children: sentence }), busy ? (_jsxs("div", { className: "flex w-full max-w-sm flex-col items-center gap-2", children: [fileName === undefined ? null : (_jsx("p", { className: "max-w-full truncate text-body text-ink", children: fileName })), _jsx("div", { className: "w-full", children: _jsx(ProgressBar, { value: progress ?? 0, label: copy.field.uploadProgress, width: "w-full" }) }), fileDetail === undefined ? null : (_jsx("p", { className: "text-meta text-muted", children: fileDetail }))] })) : (_jsxs("div", { className: "flex flex-wrap items-center justify-center gap-3", children: [_jsx(FileTrigger, { ...(types === undefined ? {} : { acceptedFileTypes: types }), onSelect: (files) => {
44
- const file = files?.[0];
45
- if (file !== undefined)
46
- onFile(file);
47
- }, children: _jsx(AriaButton, { id: id, "data-emphasis": "secondary", className: buttonClasses("secondary", "md"), children: copy.field.chooseFile }) }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.field.cancel }))] }))] }), error === undefined || error === null ? null : (_jsx(Failed, { heading: copy.field.fileUnreadable, sentence: error, ...(onRetry === undefined
63
+ : "border-line-strong bg-surface", isFocusVisible ? "outline-2" : "outline-0"), children: [_jsx("p", { className: "text-body text-muted", children: sentence }), busy ? (_jsxs("div", { className: "flex w-full max-w-sm flex-col items-center gap-2", children: [fileName === undefined ? null : (_jsx("p", { className: "max-w-full truncate text-body text-ink", children: fileName })), _jsx("div", { className: "w-full", children: _jsx(ProgressBar, { value: progress ?? 0, label: copy.field.uploadProgress, width: "w-full" }) }), fileDetail === undefined ? null : (_jsx("p", { className: "text-meta text-muted", children: fileDetail }))] })) : (_jsxs("div", { className: "flex flex-wrap items-center justify-center gap-3", children: [_jsx(FileTrigger, { ...(types === undefined ? {} : { acceptedFileTypes: types }), allowsMultiple: many, onSelect: (files) => take(files === null ? [] : Array.from(files)), children: _jsx(AriaButton, { id: id, "data-emphasis": "secondary", className: buttonClasses("secondary", "md"), children: many ? copy.field.chooseFiles : copy.field.chooseFile }) }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.field.cancel }))] }))] }), _jsx("p", { role: "status", className: leftOut === null ? "sr-only" : "text-meta text-warn", children: leftOut === null
64
+ ? null
65
+ : fillCopy(copy.field.tooManyFiles, {
66
+ max: leftOut.taken.toLocaleString(copy.locale),
67
+ count: leftOut.of.toLocaleString(copy.locale),
68
+ }) }), error === undefined || error === null ? null : (_jsx(Failed, { heading: copy.field.fileUnreadable, sentence: error, ...(onRetry === undefined
48
69
  ? {}
49
70
  : {
50
71
  action: (_jsx(Button, { role: "ghost", onClick: onRetry, children: copy.field.tryAnother })),
@@ -15,14 +15,14 @@ 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
24
- * —"maqueta", "nuevo"—; anything else is drawn as is, which is how a status
25
- * `Tag` or an already formatted counter comes in. */
24
+ * —"maqueta", "nuevo"—; a number as a `Count` —«Por aprobar 3», no zero—;
25
+ * anything else is drawn as is, which is how a status `Tag` comes in. */
26
26
  badge?: ReactNode;
27
27
  /** What THIS option does. It exists on top of the menu's `onSelect` because a
28
28
  * menu built from a registry —twenty-five operations, each one with its own
@@ -84,7 +84,7 @@ export declare function menuTriggerClasses({ variant, surface, active, open, foc
84
84
  export declare function Menu({ label, groups, onSelect, surface, align, icon: Trigger,
85
85
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
86
86
  * actions `⋯` does not, because the icon already says there is more. */
87
- chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, size, title, closeOnSelect, }: {
87
+ chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, size, title, closeOnSelect, count, }: {
88
88
  label: string;
89
89
  groups: readonly MenuGroup[];
90
90
  onSelect?: (id: string) => void;
@@ -126,6 +126,10 @@ chevron, active, iconOnly, variant, searchPlaceholder, emptyText, width, role, s
126
126
  /** Column and filter menus toggle several options in a row. Closing after
127
127
  * each click turns three hides into three open-close round trips. */
128
128
  closeOnSelect?: boolean;
129
+ /** What is waiting inside, on the trigger: «Pagos 5» in an application bar says it
130
+ * without opening the menu. Zero is not drawn. Not with `iconOnly`, where there is no
131
+ * label for it to belong to. */
132
+ count?: number;
129
133
  }): import("react").JSX.Element;
130
134
  /**
131
135
  * The panel of a `Menu`: its groups and rows, and the submenus hanging from them. Internal —
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useUiCopy } from "../../foundations/copy.js";
4
4
  import { buttonClasses, } from "../button/Button.js";
5
5
  import { Popover } from "../overlay/Popover.js";
6
+ import { Count } from "../tag/Count.js";
6
7
  import { Check, ChevronDown, ChevronRight } from "lucide-react";
7
8
  import { Autocomplete, Button as AriaButton, Header, Input, Keyboard, Menu as AriaMenu, MenuItem, MenuSection, MenuTrigger, SearchField, Separator, SubmenuTrigger, useFilter, } from "react-aria-components";
8
9
  const WIDTH = {
@@ -52,7 +53,7 @@ export function menuTriggerClasses({ variant = "button", surface = "canvas", act
52
53
  export function Menu({ label, groups, onSelect, surface = "canvas", align = "start", icon: Trigger,
53
54
  /** The menu as a control of a list ("filters ▾") carries the chevron; the
54
55
  * actions `⋯` does not, because the icon already says there is more. */
55
- chevron = true, active = false, iconOnly = false, variant = "button", searchPlaceholder, emptyText, width = "md", role, size = "md", title, closeOnSelect = true, }) {
56
+ chevron = true, active = false, iconOnly = false, variant = "button", searchPlaceholder, emptyText, width = "md", role, size = "md", title, closeOnSelect = true, count, }) {
56
57
  const copy = useUiCopy();
57
58
  const { contains } = useFilter({ sensitivity: "base" });
58
59
  const byId = indexOptions(groups.flatMap((g) => g.options));
@@ -70,7 +71,7 @@ chevron = true, active = false, iconOnly = false, variant = "button", searchPlac
70
71
  focusVisible: isFocusVisible,
71
72
  iconOnly,
72
73
  })
73
- : `${buttonClasses(role, size, surface)} gap-1.5`, children: _jsxs("span", { className: "contents", title: title ?? (iconOnly ? label : undefined), children: [Trigger === undefined ? (iconOnly ? (_jsx(ChevronDown, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true })) : null) : (_jsx(Trigger, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true })), iconOnly ? null : label, chevron && !iconOnly ? (_jsx(ChevronDown, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true })) : null] }) }), _jsx(Popover, { placement: align === "end" ? "bottom end" : "bottom start", className: WIDTH[width], children: searchPlaceholder === undefined ? (menu) : (
74
+ : `${buttonClasses(role, size, surface)} gap-1.5`, children: _jsxs("span", { className: "contents", title: title ?? (iconOnly ? label : undefined), children: [Trigger === undefined ? (iconOnly ? (_jsx(ChevronDown, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true })) : null) : (_jsx(Trigger, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true })), iconOnly ? null : label, iconOnly || count === undefined ? null : _jsx(Count, { value: count, surface: surface }), chevron && !iconOnly ? (_jsx(ChevronDown, { className: "size-(--size-icon-sm)", strokeWidth: 2, "aria-hidden": true })) : null] }) }), _jsx(Popover, { placement: align === "end" ? "bottom end" : "bottom start", className: WIDTH[width], children: searchPlaceholder === undefined ? (menu) : (
74
75
  /* The search box stays at the top: in a menu of twenty-five entries,
75
76
  scrolling loses exactly the control that explains why only three are
76
77
  visible. It filters on label AND hint — half the entries of this
@@ -91,7 +92,7 @@ export function MenuList({ label, groups, onAction, closeOnSelect, emptyText, wi
91
92
  const Icon = o.icon;
92
93
  const opens = o.items !== undefined;
93
94
  const checked = !opens && o.checked === true;
94
- return (_jsxs(MenuItem, { id: o.id, textValue: o.hint === undefined ? o.label : `${o.label} ${o.hint}`, isDisabled: o.disabled, className: `flex w-full cursor-default rounded-control ${hasHints ? "items-start py-1.5" : "items-center py-1"} gap-2 px-2 text-left outline-0 transition-colors duration-(--duration-instant) data-focused:bg-primary/8 data-open:bg-primary/8 disabled:opacity-45`, children: [hasMarks ? (_jsx("span", { className: `${hasHints ? "mt-0.5" : ""} flex size-(--size-icon-sm) shrink-0 items-center justify-center`, children: checked ? (_jsx(Check, { className: "size-(--size-icon-sm) text-primary", strokeWidth: 2.5, "aria-hidden": true })) : Icon !== undefined ? (_jsx(Icon, { className: "size-(--size-icon-sm) text-muted", strokeWidth: 2, "aria-hidden": true })) : null })) : null, _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: `truncate text-meta ${checked ? "font-medium text-ink" : "text-ink"}`, children: o.label }), o.badge === undefined ? null : typeof o.badge === "string" ? (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-warn/30 bg-warn/10 px-2 py-0.5 text-micro text-warn", children: o.badge })) : (_jsx("span", { className: "ml-auto shrink-0", children: o.badge }))] }), o.hint === undefined ? null : (_jsx("span", { className: "mt-0.5 block truncate text-micro text-muted", children: o.hint }))] }), o.shortcut === undefined ? null : (_jsx(Keyboard, { className: "shrink-0 self-center pl-3 font-mono text-micro text-muted", children: o.shortcut })), opens ? (_jsx(ChevronRight, { className: "size-(--size-icon-sm) shrink-0 self-center text-muted", strokeWidth: 2, "aria-hidden": true })) : null] }, o.id));
95
+ return (_jsxs(MenuItem, { id: o.id, textValue: o.hint === undefined ? o.label : `${o.label} ${o.hint}`, isDisabled: o.disabled, className: `flex w-full cursor-default rounded-control ${hasHints ? "items-start py-1.5" : "items-center py-1"} gap-2 px-2 text-left outline-0 transition-colors duration-(--duration-instant) data-focused:bg-primary/8 data-open:bg-primary/8 disabled:opacity-45`, children: [hasMarks ? (_jsx("span", { className: `${hasHints ? "mt-0.5" : ""} flex size-(--size-icon-sm) shrink-0 items-center justify-center`, children: checked ? (_jsx(Check, { className: "size-(--size-icon-sm) text-primary", strokeWidth: 2.5, "aria-hidden": true })) : Icon !== undefined ? (_jsx(Icon, { className: "size-(--size-icon-sm) text-muted", strokeWidth: 2, "aria-hidden": true })) : null })) : null, _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: `truncate text-meta ${checked ? "font-medium text-ink" : "text-ink"}`, children: o.label }), o.badge === undefined ? null : typeof o.badge === "number" ? (_jsx("span", { className: "ml-auto flex shrink-0", children: _jsx(Count, { value: o.badge }) })) : typeof o.badge === "string" ? (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-warn/30 bg-warn/10 px-2 py-0.5 text-micro text-warn", children: o.badge })) : (_jsx("span", { className: "ml-auto shrink-0", children: o.badge }))] }), o.hint === undefined ? null : (_jsx("span", { className: "mt-0.5 block truncate text-micro text-muted", children: o.hint }))] }), o.shortcut === undefined ? null : (_jsx(Keyboard, { className: "shrink-0 self-center pl-3 font-mono text-micro text-muted", children: o.shortcut })), opens ? (_jsx(ChevronRight, { className: "size-(--size-icon-sm) shrink-0 self-center text-muted", strokeWidth: 2, "aria-hidden": true })) : null] }, o.id));
95
96
  };
96
97
  return (_jsx(AriaMenu, { "aria-label": label, shouldCloseOnSelect: closeOnSelect, onAction: onAction, renderEmptyState: () => (_jsx("p", { className: "px-3 py-3 text-meta text-muted italic", children: emptyText })), className: "max-h-[inherit] overflow-y-auto p-1 outline-0", children: groups.map((g, gi) => (_jsxs(MenuSection, { className: "[&:not(:first-child)]:mt-1 [&:not(:first-child)]:border-t [&:not(:first-child)]:border-line [&:not(:first-child)]:pt-1", children: [g.label === undefined ? null : (
97
98
  /* Same skeleton as the row: the label sits on the text column. */
@@ -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>;