@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
@@ -2,7 +2,7 @@ import type { CriteriaJoin } from "./criteria.js";
2
2
  import type { Surface } from "../../foundations/types.js";
3
3
  export declare function JoinWord({ join, onChange, surface, }: {
4
4
  join: CriteriaJoin;
5
- /** Sin esto la palabra es un valor: dice cómo junta, y no se toca. */
5
+ /** Without this the word is a value: it says how it joins, and is not touched. */
6
6
  onChange?: (next: CriteriaJoin) => void;
7
7
  surface?: Surface;
8
8
  }): import("react").JSX.Element;
@@ -5,26 +5,26 @@ import { bySurface, useSurface } from "../../foundations/surface.js";
5
5
  import { Tags } from "../../primitives/tag/Tags.js";
6
6
  import { useState } from "react";
7
7
  /* ==================================================================== *
8
- * CÓMO SE JUNTA UN NODO, en una palabra que se toca.
8
+ * HOW A NODE IS JOINED, in a word you touch.
9
9
  *
10
- * Todas, cualquiera, ninguna. Son las tres y no dos: sin «ninguna», negar algo
11
- * sólo se podía escribir en el JSON, y una pregunta que el editor no sabe
12
- * construir es una pregunta que la mayoría no va a hacer.
10
+ * All, any, none. They are three and not two: without «ninguna», negating something
11
+ * could only be written in the JSON, and a question the editor does not know how to
12
+ * build is a question most people will not ask.
13
13
  *
14
- * ── Una palabra, no un símbolo ──────────────────────────────────────
14
+ * ── A word, not a symbol ────────────────────────────────────────────
15
15
  *
16
- * «Y» y «O» son de quien escribe consultas; «todas» y «cualquiera» son de quien
17
- * busca. Y son las de la copia, así que cambiarlas las cambia en los dos lados
18
- * a la vez.
16
+ * «Y» and «O» belong to whoever writes queries; «todas» and «cualquiera» belong to whoever
17
+ * searches. And they are the copy's, so changing them changes them on both sides
18
+ * at once.
19
19
  *
20
- * ── Se abre en sus opciones, no rota ────────────────────────────────
20
+ * ── It opens into its options, it does not rotate ──────────────────────
21
21
  *
22
- * Con tres, un botón que alterna no dice cuáles hay ni cuál está puesta: hay
23
- * que apretarlo para averiguarlo, y averiguarlo cambia lo que filtra.
22
+ * With three, a toggling button says neither which there are nor which is set: you
23
+ * have to press it to find out, and finding out changes what it filters.
24
24
  *
25
- * Vive acá y no adentro de la barra porque el constructor pregunta lo mismo. Un
26
- * `<select>` allá y una lista acá son dos controles para una decisión, y el que
27
- * aprendió uno no reconoce el otro.
25
+ * It lives here and not inside the bar because the builder asks the same. A
26
+ * `<select>` there and a list here are two controls for one decision, and whoever
27
+ * learned one does not recognise the other.
28
28
  * ==================================================================== */
29
29
  const OPTIONS = ["all", "any", "not"];
30
30
  export function JoinWord({ join, onChange, surface, }) {
@@ -1,19 +1,19 @@
1
- /** Un JSON acomodado, o el mismo texto si todavía no se puede leer.
1
+ /** A JSON laid out, or the same text if it cannot be read yet.
2
2
  *
3
3
  * in '{"all":[{"field":"a","operator":"=","value":1}]}'
4
- * out el mismo, con sangría de dos espacios y un campo por línea
4
+ * out the same, indented by two spaces and one field per line
5
5
  *
6
- * Separado del componente para que se pueda probar sin dibujar nada, que es lo único que
7
- * tiene lógica acá adentro. */
6
+ * Separated from the component so it can be tested without drawing anything, which is the only thing
7
+ * with logic in here. */
8
8
  export declare function formatJson(text: string): string;
9
9
  export declare function JsonEditor({ value, onChange, error, height, label, }: {
10
10
  value: string;
11
11
  onChange: (next: string) => void;
12
- /** Qué está mal con lo escrito más allá de la sintaxis — que sea JSON válido pero no un
13
- * filtro, por ejemplo. Los errores de sintaxis los marca el editor, en su lugar exacto. */
12
+ /** What is wrong with what was written beyond the syntax — that it is valid JSON but not a
13
+ * filter, for example. Syntax errors are marked by the editor, at their exact place. */
14
14
  error?: string | null;
15
15
  height?: string;
16
- /** Cómo se llama este editor. Sin esto dice sólo que es un editor de código,
17
- * que es lo único que se puede decir sin saber qué se escribe adentro. */
16
+ /** What this editor is called. Without this it says only that it is a code editor,
17
+ * which is the only thing that can be said without knowing what is written inside. */
18
18
  label?: string;
19
19
  }): import("react").JSX.Element;
@@ -10,26 +10,26 @@ import CodeMirror, { EditorView, Prec } from "@uiw/react-codemirror";
10
10
  import { Wand2 } from "lucide-react";
11
11
  import { useId } from "react";
12
12
  /* ====================================================================== *
13
- * UN JSON QUE SE ESCRIBE A MANO, EN UN EDITOR DE VERDAD.
13
+ * A JSON WRITTEN BY HAND, IN A REAL EDITOR.
14
14
  *
15
- * CodeMirror y no un `<textarea>` con colores encima: eso último llegó hasta
16
- * donde llegan cincuenta líneas —pintar las comillas— y se quedaba corto en
17
- * todo lo demás, que es lo que hace usable escribir un filtro a mano:
18
- * números de línea para saber dónde está el error, plegado para no perderse
19
- * en un `all` de seis condiciones, y el subrayado en el carácter exacto
20
- * donde el JSON se rompe en vez de un cartel que dice que algo está mal.
15
+ * CodeMirror and not a `<textarea>` with colours on top: the latter got as far
16
+ * as fifty lines go —painting the quotes— and fell short on
17
+ * everything else, which is what makes writing a filter by hand usable:
18
+ * line numbers to know where the error is, folding so you do not get lost
19
+ * in an `all` of six conditions, and the underline on the exact character
20
+ * where the JSON breaks instead of a sign saying something is wrong.
21
21
  *
22
- * El `linter` de abajo es el del propio paquete de JSON: marca el error
23
- * mientras se escribe. El aviso de afuera —`error`— sigue existiendo porque
24
- * dice otra cosa: que el JSON está bien escrito pero no es un filtro.
22
+ * The `linter` below is the JSON package's own: it marks the error
23
+ * as you type. The outer notice —`error`— still exists because it
24
+ * says something else: that the JSON is well written but is not a filter.
25
25
  * ====================================================================== */
26
- /** Un JSON acomodado, o el mismo texto si todavía no se puede leer.
26
+ /** A JSON laid out, or the same text if it cannot be read yet.
27
27
  *
28
28
  * in '{"all":[{"field":"a","operator":"=","value":1}]}'
29
- * out el mismo, con sangría de dos espacios y un campo por línea
29
+ * out the same, indented by two spaces and one field per line
30
30
  *
31
- * Separado del componente para que se pueda probar sin dibujar nada, que es lo único que
32
- * tiene lógica acá adentro. */
31
+ * Separated from the component so it can be tested without drawing anything, which is the only thing
32
+ * with logic in here. */
33
33
  export function formatJson(text) {
34
34
  try {
35
35
  return JSON.stringify(JSON.parse(text), null, 2);
@@ -63,8 +63,11 @@ export function JsonEditor({ value, onChange, error, height = "16rem", label, })
63
63
  /* The chrome is dark in both themes; the canvas follows the theme. */
64
64
  const dark = surface === "chrome" || resolved === "dark";
65
65
  return (_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { id: labelId, className: "text-micro text-muted", children: label ?? copy.builder.editor }), _jsxs(Button, { role: "ghost", size: "sm", disabled: value.trim() === "", onClick: () => onChange(formatJson(value)), children: [_jsx(Wand2, { className: "size-3" }), " ", copy.builder.format] })] }), _jsx("div", { className: `overflow-hidden rounded-control border ${error == null ? "border-ink/15" : "border-danger"}`, children: _jsx(CodeMirror, { value: value, onChange: onChange, height: height, theme: dark ? "dark" : "light", extensions: [
66
- /* The editable area is CodeMirror's own element: named here or nowhere. */
67
- EditorView.contentAttributes.of({ "aria-labelledby": labelId }),
66
+ /* The editable area is CodeMirror's own element: named here or nowhere. Marked
67
+ tabbable too: it is already reached with Tab, but its scroller (`tabindex=-1`)
68
+ is a scrollable region, and an accessibility check (axe,
69
+ `scrollable-region-focusable`) only counts content it can see is focusable. */
70
+ EditorView.contentAttributes.of({ "aria-labelledby": labelId, tabindex: "0" }),
68
71
  json(),
69
72
  linter(jsonParseLinter()),
70
73
  lintGutter(),
@@ -74,8 +77,8 @@ export function JsonEditor({ value, onChange, error, height = "16rem", label, })
74
77
  foldGutter: true,
75
78
  highlightActiveLine: true,
76
79
  autocompletion: false,
77
- /* El resaltado del par de llaves es lo que hace legible un filtro anidado: sin él,
78
- en un `any` adentro de un `all` hay que contar corchetes con el dedo. */
80
+ /* Highlighting the pair of braces is what makes a nested filter legible: without it,
81
+ in an `any` inside an `all` you have to count brackets with your finger. */
79
82
  bracketMatching: true,
80
83
  closeBrackets: true,
81
84
  } }) }), error == null ? null : _jsx("p", { className: "text-micro text-danger", children: error })] }));
@@ -3,71 +3,71 @@ import type { ModelDefinition } from "./model.js";
3
3
  import type { Surface } from "../../foundations/types.js";
4
4
  import type { MenuGroup } from "../../primitives/menu/Menu.js";
5
5
  import { type ReactNode } from "react";
6
- /** Dónde se puede buscar. Lo declara el dominio, no esta pieza. */
6
+ /** Where you can search. The domain declares it, not this piece. */
7
7
  export interface SearchFacet {
8
8
  id: string;
9
- /** Cómo se lee en la sugerencia y en la ficha: «nombre», «columnas». */
9
+ /** How it reads in the suggestion and on the chip: «nombre», «columnas». */
10
10
  label: string;
11
11
  }
12
12
  /**
13
- * La CONJUNCIÓN entre dos recortes: «y» o «o».
13
+ * The CONJUNCTION between two cuts: «y» or «o».
14
14
  *
15
- * Con `onToggle` se puede tocar, y eso no es un adorno: «vencidas Y de este
16
- * mes» y «vencidas O de este mes» son dos listas completamente distintas, y
17
- * hasta acá cuál de las dos era estaba decidido por dentro y no se podía cambiar
18
- * sin abrir el constructor. Sin `onToggle` es una palabra y nada más — que es lo
19
- * correcto entre dos ejes, donde la Y no es una opción.
15
+ * With `onToggle` it can be touched, and that is no ornament: «vencidas Y de este
16
+ * mes» and «vencidas O de este mes» are two completely different lists, and
17
+ * until now which of the two it was was decided inside and could not be changed
18
+ * without opening the builder. Without `onToggle` it is a word and nothing more — which is
19
+ * right between two axes, where AND is not an option.
20
20
  */
21
21
  /**
22
- * Lo que la barra necesita. Está aparte de la función porque es el contrato: lo
23
- * que una lista tiene que darle para que la barra pregunte, y nada más.
22
+ * What the bar needs. It is apart from the function because it is the contract: what
23
+ * a list has to give it for the bar to ask, and nothing more.
24
24
  */
25
25
  export type SearchBarProps = {
26
26
  facets: readonly SearchFacet[];
27
27
  /**
28
- * El modelo, cuando la lista lo tiene.
28
+ * The model, when the list has it.
29
29
  *
30
- * Es lo que convierte la barra de «buscar un texto en un campo» a «hacer una
31
- * pregunta»: de acá salen el tipo de cada campo —y con él qué se le puede
32
- * escribir—, los operadores que acepta, sus valores posibles si es un enum, y
33
- * por qué columna se busca un relacional. Sin esto, `facets` sigue funcionando
34
- * como siempre: cada faceta es un campo de texto.
30
+ * It is what turns the bar from «search a text in a field» into «ask a
31
+ * question»: from here come each field's type —and with it what can be
32
+ * written to it—, the operators it accepts, its possible values if it is an enum, and
33
+ * by which column a relational is searched. Without this, `facets` keeps working
34
+ * as always: each facet is a text field.
35
35
  */
36
36
  model?: ModelDefinition;
37
37
  /**
38
- * TODO lo que la barra tiene puesto: los niveles de agrupado y los filtros, en
39
- * una sola lista de instancias.
38
+ * EVERYTHING the bar has set: the grouping levels and the filters, in
39
+ * a single list of instances.
40
40
  *
41
- * Una sola y no tres porque son lo mismo con clases distintas —ver
42
- * `criteria.ts`—: lo que entra por el numeral, lo que se escribe a mano, lo
43
- * que un filtro declarado trae con nombre y lo que sale del constructor son
44
- * todas instancias, y por eso todas se leen, se tocan y se sacan igual.
41
+ * A single one and not three because they are the same with different kinds —see
42
+ * `criteria.ts`—: what enters through the hash sign, what is written by hand, what
43
+ * a declared filter brings with a name and what comes out of the builder are
44
+ * all instances, and that is why they are all read, touched and removed the same.
45
45
  */
46
46
  criteria: readonly SearchCriteria[];
47
47
  onCriteriaChange: (next: SearchCriteria[]) => void;
48
48
  placeholder?: string;
49
- /** Lo que el panel OFRECE. Lo puesto no sale de acá: sale de `criteria`. */
49
+ /** What the panel OFFERS. What is set does not come from here: it comes from `criteria`. */
50
50
  filters?: readonly MenuGroup[];
51
51
  /**
52
- * El editor de niveles de agrupado: `<GroupingLevels …/>`.
52
+ * The grouping levels editor: `<GroupingLevels …/>`.
53
53
  *
54
- * Va en la MISMA columna del panel donde están los filtros, porque es la misma
55
- * pregunta —«qué parte de esto estoy mirando»— y separarlos obliga a abrir dos
56
- * cosas para armar un recorte sin poder ver los dos estados a la vez.
54
+ * It goes in the SAME panel column where the filters are, because it is the same
55
+ * question —«which part of this am I looking at»— and separating them forces opening two
56
+ * things to build a cut without being able to see both states at once.
57
57
  */
58
58
  grouping?: ReactNode;
59
59
  /**
60
- * Alguien escribió `#and`, `#or` o `#not` y la barra abrió un nodo: esto avisa
61
- * cuál, por si quien compone quiere hacer algo más con eso.
60
+ * Somebody wrote `#and`, `#or` or `#not` and the bar opened a node: this says
61
+ * which, in case whoever composes wants to do something more with it.
62
62
  */
63
63
  onOpenGroup?: (join: CriteriaJoin) => void;
64
64
  favorites?: readonly MenuGroup[];
65
65
  onFilterSelect?: (id: string) => void;
66
66
  onFavoriteSelect?: (id: string) => void;
67
67
  /**
68
- * Abre el constructor. Recibe la RUTA de la instancia que se tocó, cuando se
69
- * tocó una: el constructor abre ahí, en vez de abrir en la primera regla y
70
- * obligar a buscar la que uno venía mirando entre doce.
68
+ * Opens the builder. It receives the PATH of the instance that was touched, when one
69
+ * was touched: the builder opens there, instead of opening on the first rule and
70
+ * forcing you to search for the one you were looking at among twelve.
71
71
  */
72
72
  onOpenBuilder?: (path?: CriteriaPath) => void;
73
73
  /**
@@ -80,12 +80,12 @@ export type SearchBarProps = {
80
80
  * enum's value, a number a numeric field answers): then that goes first and this after it.
81
81
  */
82
82
  literal?: (text: string) => BuiltCondition | BuiltFilter | null;
83
- /** Lo que va pegado al campo, a su derecha. */
83
+ /** What goes stuck to the field, on its right. */
84
84
  trailing?: ReactNode;
85
85
  /** How many facets the bar shows before folding the rest into «+N»; the grouping chain
86
86
  * counts as one. On a narrow bar only the first shows. `Infinity` never folds. */
87
87
  collapseAfter?: number;
88
- /** Por default la hereda de la superficie que la envuelve. */
88
+ /** By default it inherits it from the surface that wraps it. */
89
89
  surface?: Surface;
90
90
  };
91
91
  export declare function SearchBar({ facets, model, criteria, onCriteriaChange, placeholder, filters, grouping, onOpenGroup, favorites, onFilterSelect, onFavoriteSelect, onOpenBuilder, literal, trailing, collapseAfter, surface, }: SearchBarProps): import("react").JSX.Element;