@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,65 +1,65 @@
1
1
  "use client";
2
2
  import { useLayoutEffect, useRef, useState } from "react";
3
3
  /* ==================================================================== *
4
- * LA PILA DE COSAS PEGADAS
4
+ * THE STACK OF STICKY THINGS
5
5
  *
6
- * Tres bandas se quedan arriba mientras se scrollea una vista larga, y cada
7
- * una tiene que quedar DEBAJO de la anterior:
6
+ * Three bands stay at the top while a long view is scrolled, and each
7
+ * one has to sit BELOW the previous one:
8
8
  *
9
9
  * ┌─ TopNav ─────────────────────────────────┐ top: 0
10
- * ├─ barra de la lista ──────────────────────┤ top: alto del TopNav
10
+ * ├─ list bar ───────────────────────────────┤ top: height of the TopNav
11
11
  * │ 🔍 buscar… ⚙3 1–80 / 187 ‹ › │
12
- * ├─ encabezado de la tabla ─────────────────┤ top: los dos de arriba
12
+ * ├─ table header ───────────────────────────┤ top: the two above
13
13
  * │ número │ cliente │ fecha │ total │
14
14
  * ├──────────────────────────────────────────┤
15
- * │ …las filas, que sí se van… │
15
+ * │ …the rows, which do scroll away… │
16
16
  *
17
- * **Ninguna de las tres tiene alto fijo.** El `TopNav` crece cuando envuelve;
18
- * la barra de la lista tiene dos renglones, o uno en compacto, o tres cuando
19
- * las fichas del buscador envuelven. Un `top-[52px]` escrito a mano acierta en
20
- * una ventana y deja un hueco o un solapamiento en las otras — y es la clase
21
- * de número que nadie vuelve a tocar cuando la barra cambia.
17
+ * **None of the three has a fixed height.** The `TopNav` grows when it wraps;
18
+ * the list bar has two lines, or one when compact, or three when
19
+ * the search chips wrap. A hand-written `top-[52px]` is right in
20
+ * one window and leaves a gap or an overlap in the others — and it is the kind
21
+ * of number nobody touches again when the bar changes.
22
22
  *
23
- * Por eso cada banda MIDE lo que ocupa y lo suma a `--sticky-top` para lo que
24
- * venga abajo. La variable cascadea, así que cada capa lee la de arriba sin
25
- * que ninguna sepa cuántas capas hay.
23
+ * That is why each band MEASURES what it takes and adds it to `--sticky-top` for whatever
24
+ * comes below. The variable cascades, so each layer reads the one above without
25
+ * any of them knowing how many layers there are.
26
26
  *
27
- * ── La regla del que abre una caja con scroll propio ────────────────
27
+ * ── The rule for whoever opens a box with its own scroll ────────────
28
28
  *
29
- * Adentro de una caja con alto y `overflow`, el que scrollea es la caja y no
30
- * la página, así que lo pegado se pega al borde de la caja: ahí la pila
31
- * arranca de cero otra vez. Eso es `stickyReset()`.
29
+ * Inside a box with a height and `overflow`, it is the box that scrolls and not
30
+ * the page, so what is sticky sticks to the box's edge: there the stack
31
+ * starts from zero again. That is `stickyReset()`.
32
32
  * ==================================================================== */
33
- /** La variable que dice a qué altura arranca lo próximo que se pegue. */
33
+ /** The variable that says at what height the next thing to stick starts. */
34
34
  export const STICKY_TOP = "--sticky-top";
35
- /** Lo que va en `style` de algo pegajoso: se pega debajo de lo que ya hay. */
35
+ /** What goes in the `style` of something sticky: it sticks below what is already there. */
36
36
  export const stickyTop = { top: `var(${STICKY_TOP}, 0px)` };
37
- /** Para una caja con scroll propio: adentro, la pila arranca de cero. */
37
+ /** For a box with its own scroll: inside, the stack starts from zero. */
38
38
  export function stickyReset() {
39
39
  return { [STICKY_TOP]: "0px" };
40
40
  }
41
41
  /**
42
- * LA CAJA DE UNA TABLA: cuándo tiene que ser un contenedor de scroll y cuándo no.
42
+ * A TABLE'S BOX: when it has to be a scroll container and when not.
43
43
  *
44
- * Las tres tablas del sistema tienen el mismo dilema y lo resolvían con tres
45
- * copias de la misma medición. El dilema es de CSS y no se puede esquivar:
46
- * `overflow-x: auto` **obliga** a `overflow-y: auto` —la especificación dice que
47
- * `visible` junto a un valor que no sea `visible` ni `clip` computa a `auto`—,
48
- * así que en cuanto la caja permite scroll horizontal pasa a ser el scroller, y
49
- * el encabezado pegajoso se pega a SU borde en vez de al de la página.
44
+ * The system's three tables have the same dilemma and used to solve it with three
45
+ * copies of the same measurement. The dilemma is CSS's and cannot be dodged:
46
+ * `overflow-x: auto` **forces** `overflow-y: auto` —the specification says that
47
+ * `visible` next to a value that is neither `visible` nor `clip` computes to `auto`—,
48
+ * so as soon as the box allows horizontal scroll it becomes the scroller, and
49
+ * the sticky header sticks to ITS edge instead of the page's.
50
50
  *
51
- * De ahí salen los tres casos, y son los únicos:
51
+ * From there come the three cases, and they are the only ones:
52
52
  *
53
- * alto propio la caja scrollea de verdad. `auto`, y la pila de cosas
54
- * pegadas arranca de cero adentro.
55
- * sin alto, entra no hace falta ninguna caja. `clip` —recorta las esquinas
56
- * redondeadas sin ser un scroller— y el encabezado se pega
57
- * a la página, debajo de la barra de la lista.
58
- * sin alto, no entra vuelve el scroll horizontal, y el encabezado se va
59
- * con las filas. Es el precio, y es el que hay.
53
+ * own height the box really scrolls. `auto`, and the stack of sticky
54
+ * things starts from zero inside.
55
+ * no height, fits no box is needed. `clip` —trims the rounded corners
56
+ * without being a scroller— and the header sticks
57
+ * to the page, below the list bar.
58
+ * no height, does not fit horizontal scroll comes back, and the header goes
59
+ * away with the rows. It is the price, and it is what there is.
60
60
  *
61
- * Devuelve la clase y el estilo ya resueltos para que ninguna tabla vuelva a
62
- * decidirlo por su cuenta.
61
+ * Returns the class and the style already resolved so that no table has to
62
+ * decide it on its own again.
63
63
  */
64
64
  export function useScrollBox(options) {
65
65
  const ref = useRef(null);
@@ -69,11 +69,11 @@ export function useScrollBox(options) {
69
69
  const node = ref.current;
70
70
  if (node === null || !crece)
71
71
  return;
72
- /* Se mide el CONTENIDO y no la caja, y es la diferencia entre que esto
73
- funcione y que se trabe: con `overflow: clip` la caja deja de ser un
74
- contenedor de scroll, así que su `scrollWidth` pasa a ser su propio ancho
75
- y nunca volvería a reportar desborde. Una vez recortada, se quedaría
76
- recortada para siempre. El hijo sí sabe cuánto mide de verdad. */
72
+ /* The CONTENT is measured and not the box, and that is the difference between this
73
+ working and getting stuck: with `overflow: clip` the box stops being a
74
+ scroll container, so its `scrollWidth` becomes its own width
75
+ and would never report overflow again. Once clipped, it would stay
76
+ clipped forever. The child does know how wide it really is. */
77
77
  const dentro = node.firstElementChild;
78
78
  const medir = () => {
79
79
  const ancho = dentro === null ? node.scrollWidth : dentro.getBoundingClientRect().width;
@@ -84,8 +84,8 @@ export function useScrollBox(options) {
84
84
  return;
85
85
  const observer = new ResizeObserver(medir);
86
86
  observer.observe(node);
87
- /* También el contenido: las columnas cambian de ancho sin que la caja
88
- cambie de tamaño. */
87
+ /* The content too: the columns change width without the box
88
+ changing size. */
89
89
  if (dentro !== null)
90
90
  observer.observe(dentro);
91
91
  return () => observer.disconnect();
@@ -104,12 +104,12 @@ export function useScrollBox(options) {
104
104
  };
105
105
  }
106
106
  /**
107
- * Mide el alto de un elemento y devuelve el estilo que empuja la pila para sus
108
- * hermanos de abajo.
107
+ * Measures an element's height and returns the style that pushes the stack for its
108
+ * siblings below.
109
109
  *
110
- * `useLayoutEffect` y `ResizeObserver` y no un alto declarado: el alto depende
111
- * de si las fichas del buscador envolvieron, y eso recién se sabe después de
112
- * pintar.
110
+ * `useLayoutEffect` and `ResizeObserver` and not a declared height: the height depends
111
+ * on whether the search chips wrapped, and that is only known after
112
+ * painting.
113
113
  */
114
114
  export function useStickyLayer() {
115
115
  const ref = useRef(null);
@@ -118,12 +118,12 @@ export function useStickyLayer() {
118
118
  const node = ref.current;
119
119
  if (node === null)
120
120
  return;
121
- /* El valor de abajo se calcula en JS y se escribe en PÍXELES, no como
122
- `calc(var(--sticky-top) + 44px)`. Context: esa forma parece la natural y
123
- no funciona — poner `--sticky-top` en un elemento leyendo `var(--sticky-top)`
124
- del MISMO elemento es un ciclo, CSS lo declara inválido, y los
125
- descendientes heredan «nada»: todo se pegaba en 0 y las bandas se
126
- superponían. Se midió en el navegador, no se dedujo. */
121
+ /* The value below is computed in JS and written in PIXELS, not as
122
+ `calc(var(--sticky-top) + 44px)`. Context: that form looks natural and
123
+ does not work — setting `--sticky-top` on an element while reading `var(--sticky-top)`
124
+ from the SAME element is a cycle, CSS declares it invalid, and the
125
+ descendants inherit «nothing»: everything stuck at 0 and the bands
126
+ overlapped. It was measured in the browser, not deduced. */
127
127
  const measure = () => {
128
128
  const inherited = Number.parseFloat(getComputedStyle(node).getPropertyValue(STICKY_TOP));
129
129
  const above = Number.isFinite(inherited) ? inherited : 0;
@@ -134,9 +134,9 @@ export function useStickyLayer() {
134
134
  return;
135
135
  const observer = new ResizeObserver(measure);
136
136
  observer.observe(node);
137
- /* La altura de una capa de ARRIBA cambia sin que este observador se entere
138
- —el `TopNav` envuelve al angostar—, así que también se remide al cambiar
139
- el tamaño de la ventana, que es cuando eso pasa. */
137
+ /* The height of a layer ABOVE changes without this observer noticing
138
+ —the `TopNav` wraps when narrowed—, so it is also re-measured when the
139
+ window is resized, which is when that happens. */
140
140
  window.addEventListener("resize", measure);
141
141
  return () => {
142
142
  observer.disconnect();
@@ -1,54 +1,54 @@
1
1
  /**
2
- * ESCRIBIR UNA PLANILLA DE EXCEL, sin librería.
2
+ * WRITING AN EXCEL SPREADSHEET, with no library.
3
3
  *
4
- * ── Por qué no hay dependencia ──────────────────────────────────────
4
+ * ── Why there is no dependency ──────────────────────────────────────
5
5
  *
6
- * Un `.xlsx` es un ZIP con seis XML adentro, y el ZIP sólo se pone difícil
7
- * cuando hay que comprimir. **No hay que comprimir**: el formato admite entradas
8
- * `stored` —método 0, los bytes tal cual— y Excel las abre igual. Lo único que
9
- * queda del ZIP es un CRC32 y tres encabezados de posiciones fijas.
6
+ * An `.xlsx` is a ZIP with six XML files inside, and the ZIP only gets hard
7
+ * when it has to compress. **There is nothing to compress**: the format admits
8
+ * `stored` entries —method 0, the bytes as they are— and Excel opens them all the same. All that
9
+ * is left of the ZIP is a CRC32 and three headers of fixed positions.
10
10
  *
11
- * Del otro lado, las librerías del rubro pesan entre medio mega y uno, traen su
12
- * propio modelo de libro, de estilos y de fórmulas, y este sistema de diseño se
13
- * publica como fuente para que lo compile quien lo consuma — incluido, algún
14
- * día, un teléfono. Un mega de escritor de planillas adentro de un paquete de
15
- * componentes lo carga todo el que importe un botón.
11
+ * On the other side, the libraries of the trade weigh between half a megabyte and one, bring their
12
+ * own model of workbook, styles and formulas, and this design system is
13
+ * published as source for whoever consumes it to compile — including, some
14
+ * day, a phone. A megabyte of spreadsheet writer inside a package of
15
+ * components is carried by everyone who imports a button.
16
16
  *
17
- * ── Qué hace y qué no ───────────────────────────────────────────────
17
+ * ── What it does and what it does not ───────────────────────────────
18
18
  *
19
- * Hace lo que una grilla necesita para no mentir al salir: texto y números en su
20
- * tipo real, celdas combinadas, formato de número por celda, negrita, ancho de
21
- * columna y paneles congelados. **Una celda ausente no se escribe**, que es como
22
- * el formato dice «acá no hay nada» — un agujero sigue siendo un agujero
23
- * adentro del archivo.
19
+ * It does what a grid needs in order not to lie on the way out: text and numbers in their
20
+ * real type, merged cells, number format per cell, bold, column
21
+ * width and frozen panes. **An absent cell is not written**, which is how
22
+ * the format says «there is nothing here» — a hole is still a hole
23
+ * inside the file.
24
24
  *
25
- * No hace fórmulas, ni colores, ni bordes, ni varias hojas. El día que alguna de
26
- * esas haga falta se agrega acá; ninguna cambia la forma de lo que ya está.
25
+ * It does no formulas, colors, borders, or multiple sheets. The day one of
26
+ * those is needed it is added here; none changes the shape of what is already there.
27
27
  *
28
- * ── Dónde termina esto y empieza el navegador ───────────────────────
28
+ * ── Where this ends and the browser begins ──────────────────────────
29
29
  *
30
- * `writeXlsx` devuelve BYTES y no un archivo: `Uint8Array` existe en todos
31
- * lados, y así lo mismo sirve para bajar un archivo, para mandarlo por la red o
32
- * para escribirlo en una prueba. Bajarlo es `downloadXlsx`, que es la única
33
- * función de este archivo que necesita un navegador.
30
+ * `writeXlsx` returns BYTES and not a file: `Uint8Array` exists
31
+ * everywhere, and so the same thing serves to download a file, to send it over the network or
32
+ * to write it in a test. Downloading it is `downloadXlsx`, which is the only
33
+ * function of this file that needs a browser.
34
34
  */
35
- /** Una celda. La posición va en la celda y no en una matriz porque una grilla
36
- * con agujeros es mayormente vacío, y una matriz de 288 posiciones para 40
37
- * valores es una matriz que hay que rellenar con algo. */
35
+ /** A cell. The position goes in the cell and not in a matrix because a grid
36
+ * with holes is mostly empty, and a matrix of 288 positions for 40
37
+ * values is a matrix that has to be filled with something. */
38
38
  export type XlsxCell = {
39
- /** Desde cero, como los índices de todo lo demás. */
39
+ /** Zero-based, like the indices of everything else. */
40
40
  row: number;
41
41
  column: number;
42
- /** Un número entra como número: sin eso, Excel recibe texto y no suma, que es
43
- * la primera cosa que alguien intenta hacer con una planilla exportada. */
42
+ /** A number goes in as a number: without that, Excel receives text and does not sum, which is
43
+ * the first thing somebody tries to do with an exported spreadsheet. */
44
44
  value: string | number;
45
45
  bold?: boolean;
46
- /** El código de formato de Excel —`#,##0.00`, `0.0%`, `#,##0 "Bs."`—, que es
47
- * otra cosa que una función de JavaScript: un archivo no puede llevarse una
48
- * función adentro. */
46
+ /** The Excel format code —`#,##0.00`, `0.0%`, `#,##0 "Bs."`—, which is
47
+ * something other than a JavaScript function: a file cannot carry a
48
+ * function inside. */
49
49
  format?: string;
50
50
  };
51
- /** Una combinación: desde dónde, y cuántas filas y columnas cubre. */
51
+ /** A merge: from where, and how many rows and columns it covers. */
52
52
  export type XlsxMerge = {
53
53
  row: number;
54
54
  column: number;
@@ -56,31 +56,31 @@ export type XlsxMerge = {
56
56
  columns: number;
57
57
  };
58
58
  export type XlsxSheet = {
59
- /** El nombre de la pestaña. Excel prohíbe `[]:*?/\` y más de 31 caracteres, y
60
- * un nombre inválido no da un error: da un archivo que no abre. Se recorta
61
- * acá. */
59
+ /** The name of the tab. Excel forbids `[]:*?/\` and more than 31 characters, and
60
+ * an invalid name does not give an error: it gives a file that does not open. It is trimmed
61
+ * here. */
62
62
  name: string;
63
63
  cells: readonly XlsxCell[];
64
64
  merges?: readonly XlsxMerge[];
65
- /** El ancho de cada columna, en caracteres. Faltantes = el ancho por omisión. */
65
+ /** The width of each column, in characters. Missing = the default width. */
66
66
  widths?: readonly number[];
67
- /** Cuántas filas de arriba y columnas de la izquierda se quedan quietas al
68
- * desplazarse. Es lo mismo que hace `sticky` en la grilla, y por la misma
69
- * razón: un número sin su rótulo es un número suelto. */
67
+ /** How many rows from the top and columns from the left stay still when
68
+ * scrolling. It is the same as what `sticky` does in the grid, and for the same
69
+ * reason: a number without its label is a loose number. */
70
70
  freeze?: {
71
71
  rows: number;
72
72
  columns: number;
73
73
  };
74
74
  };
75
- /** El nombre de una columna en la notación de Excel: 0 → A, 25 → Z, 26 → AA. */
75
+ /** The name of a column in Excel notation: 0 → A, 25 → Z, 26 → AA. */
76
76
  export declare function columnName(index: number): string;
77
- /** Los bytes de un `.xlsx` con una hoja. */
77
+ /** The bytes of an `.xlsx` with one sheet. */
78
78
  export declare function writeXlsx(sheet: XlsxSheet): Uint8Array<ArrayBuffer>;
79
79
  /**
80
- * Bajar los bytes como archivo.
80
+ * Download the bytes as a file.
81
81
  *
82
- * Es la única función de este archivo que necesita un navegador, y por eso está
83
- * separada de `writeXlsx`: lo que se escribe y lo que se baja son dos cosas, y
84
- * del otro lado —el servidor, un teléfono, una prueba— la segunda no existe.
82
+ * It is the only function of this file that needs a browser, and that is why it is
83
+ * separate from `writeXlsx`: what is written and what is downloaded are two things, and
84
+ * on the other side —the server, a phone, a test— the second does not exist.
85
85
  */
86
86
  export declare function downloadXlsx(name: string, bytes: Uint8Array): void;
Binary file
@@ -1,12 +1,12 @@
1
1
  import type { ReactNode } from "react";
2
2
  export declare function Line({ start, center, end,
3
3
  /**
4
- * Lo que PIDE cada lado antes de que la línea se parta. Los dos piden lo
5
- * mismo —es lo que centra el centro— así que es un solo valor y no dos.
4
+ * What each side ASKS for before the line splits. Both ask for the
5
+ * same —it is what centres the centre— so it is a single value and not two.
6
6
  */
7
7
  asks,
8
- /** Lo que pide el centro. `auto` es «lo que mida»; un campo de búsqueda pide
9
- * su ancho tope, que es lo que hace que no se estire a 700 px. */
8
+ /** What the centre asks for. `auto` is «whatever it measures»; a search field asks for
9
+ * its maximum width, which is what keeps it from stretching to 700 px. */
10
10
  centerAsks, gap, align, }: {
11
11
  start?: ReactNode;
12
12
  center?: ReactNode;
@@ -1,45 +1,45 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* ==================================================================== *
3
- * LA LÍNEA DE TRES ZONAS — y por qué el centro se centra contra la LÍNEA.
3
+ * THE THREE-ZONE LINE — and why the centre is centred against the LINE.
4
4
  *
5
- * Es la forma de las dos bandas del producto: la del registro —de dónde
6
- * vengo · lo que cuelga de esto · cuál de ochenta soy— y la de la lista —de
7
- * dónde vengo · qué estoy buscando · qué página—. Las dos tienen el mismo
8
- * problema y por eso tienen una sola solución.
5
+ * It is the shape of the product's two bands: the record's —where I
6
+ * come from · what hangs from this · which of eighty I am— and the list's —where
7
+ * I come from · what I am looking for · which page—. Both have the same
8
+ * problem and so they have a single solution.
9
9
  *
10
- * ── El problema: el centro no estaba en el centro ───────────────────
10
+ * ── The problem: the centre was not in the centre ───────────────────
11
11
  *
12
- * Con `mx-auto`, o con una grilla `auto 1fr max-content`, el centro queda
13
- * donde SOBRA lugar. Y entonces un nombre de cincuenta caracteres a la
14
- * izquierda —que en este producto es lo normal— empuja los botones contra el
15
- * borde derecho, y la misma pantalla con un nombre corto los dibuja en otro
16
- * lado. Dos registros seguidos ponen sus controles en dos lugares distintos:
17
- * eso no es un centro, es un resto.
12
+ * With `mx-auto`, or with an `auto 1fr max-content` grid, the centre ends up
13
+ * wherever there is room LEFT OVER. And then a fifty-character name on the
14
+ * left —which in this product is normal— pushes the buttons against the
15
+ * right edge, and the same screen with a short name draws them somewhere
16
+ * else. Two records in a row put their controls in two different places:
17
+ * that is not a centre, it is a remainder.
18
18
  *
19
- * ── La regla: los dos lados PIDEN lo mismo ──────────────────────────
19
+ * ── The rule: both sides ASK for the same thing ─────────────────────
20
20
  *
21
- * Los lados piden el mismo ancho y crecen parejo, así que lo que sobra se
22
- * reparte en dos mitades iguales y el centro cae en el medio de la línea, con
23
- * o sin migas, con o sin paginador. Lo que no entra en una mitad se recorta
24
- * adentro de su mitad —para eso `min-w-0`— en vez de empujar al vecino.
21
+ * The sides ask for the same width and grow evenly, so what is left over is
22
+ * split in two equal halves and the centre falls in the middle of the line, with
23
+ * or without breadcrumbs, with or without a pager. What does not fit in a half is clipped
24
+ * inside its half —that is what `min-w-0` is for— instead of pushing the neighbour.
25
25
  *
26
- * ── Y se parte sola ─────────────────────────────────────────────────
26
+ * ── And it splits by itself ─────────────────────────────────────────
27
27
  *
28
- * No hay ningún umbral acá: ni consulta de medios, ni de contenedor, ni una
29
- * rama por densidad. Cada zona declara lo que PIDE y `flex-wrap` decide: en
30
- * una banda angosta el centro ya no entra al lado de las migas y baja entero
31
- * al renglón siguiente, con el paginador atrás. Es lo mismo que hace una fila
32
- * de lista, y por la misma razón: un umbral no sabe si la línea trae tres
33
- * contadores o nueve.
28
+ * There is no threshold here: no media query, no container query, no branch
29
+ * per density. Each zone declares what it ASKS for and `flex-wrap` decides: in
30
+ * a narrow band the centre no longer fits beside the breadcrumbs and drops whole
31
+ * to the next row, with the pager behind it. It is what a list row does,
32
+ * and for the same reason: a threshold does not know whether the line carries three
33
+ * counters or nine.
34
34
  * ==================================================================== */
35
35
  export function Line({ start, center, end,
36
36
  /**
37
- * Lo que PIDE cada lado antes de que la línea se parta. Los dos piden lo
38
- * mismo —es lo que centra el centro— así que es un solo valor y no dos.
37
+ * What each side ASKS for before the line splits. Both ask for the
38
+ * same —it is what centres the centre— so it is a single value and not two.
39
39
  */
40
40
  asks = "var(--container-trail)",
41
- /** Lo que pide el centro. `auto` es «lo que mida»; un campo de búsqueda pide
42
- * su ancho tope, que es lo que hace que no se estire a 700 px. */
41
+ /** What the centre asks for. `auto` is «whatever it measures»; a search field asks for
42
+ * its maximum width, which is what keeps it from stretching to 700 px. */
43
43
  centerAsks = "auto", gap = "gap-x-4 gap-y-2", align = "items-center", }) {
44
44
  return (_jsxs("div", { className: `flex min-w-0 flex-wrap ${align} ${gap}`, children: [_jsx("div", { className: "flex min-w-0 flex-1 items-center", style: { flexBasis: asks }, children: start }), _jsx("div", { className: "flex min-w-0 shrink items-center justify-center", style: { flexBasis: centerAsks, flexGrow: 0 }, children: center }), _jsx("div", { className: "flex min-w-0 flex-1 items-center justify-end", style: { flexBasis: asks }, children: end })] }));
45
45
  }
@@ -1,7 +1,7 @@
1
1
  /* The structure of a view: where each section starts and ends. */
2
2
  export { Block, Rule, } from "./Block.js";
3
3
  export { FullWidth, SectionGrid } from "./SectionGrid.js";
4
- /* La línea de tres zonas: lo que centra el centro contra la LÍNEA y no contra
5
- lo que sobra. La usan las dos bandas — la del registro y la de la lista. */
4
+ /* The three-zone line: what centres the centre against the LINE and not against
5
+ what is left over. Both bands use it — the record's and the list's. */
6
6
  export { Line } from "./Line.js";
7
7
  export { Step, Steps, useSteps, } from "./Steps.js";
@@ -1,3 +1,3 @@
1
- /* LOS WIDGETS DE CELDA — lo que va adentro de una celda, una fila o una tarjeta con jerarquía:
2
- lo principal en tinta, lo que lo distingue chico y callado, y la foto si la hay. */
1
+ /* THE CELL WIDGETS — what goes inside a cell, a row or a card with hierarchy:
2
+ the main thing in ink, what tells it apart small and quiet, and the photo if there is one. */
3
3
  export { CellStack, Thumb } from "./CellStack.js";
@@ -1,6 +1,6 @@
1
- /* LAS ELECCIONES — elegir uno de muchos escribiendo (ComboBox), uno de pocos a la vista
2
- (RadioGroup, SegmentedControl), prender o apagar (Switch), un valor en un rango (Slider)
3
- y buscar un texto suelto (SearchField). El valor es siempre un dato plano. */
1
+ /* THE CHOICES — pick one of many by typing (ComboBox), one of a few in sight
2
+ (RadioGroup, SegmentedControl), turn on or off (Switch), a value in a range (Slider)
3
+ and search for loose text (SearchField). The value is always plain data. */
4
4
  export { ComboBox } from "./ComboBox.js";
5
5
  export { KanbanState, } from "./KanbanState.js";
6
6
  export {} from "./options.js";
@@ -7,10 +7,16 @@ export type CalendarProps = {
7
7
  max?: string;
8
8
  /** A day that cannot be chosen — a holiday, a closed day. Receives the ISO date. */
9
9
  isUnavailable?: (date: string) => boolean;
10
+ /**
11
+ * The day it is for the business, as an ISO date: marked as today, and where the calendar
12
+ * opens when nothing is chosen. Without it, the browser's own day — which is another one when
13
+ * the company is in another zone, or past midnight somewhere else.
14
+ */
15
+ today?: string;
10
16
  "aria-label"?: string;
11
17
  };
12
18
  /** One month, to pick one day. */
13
- export declare function Calendar({ value, onChange, min, max, isUnavailable, ...rest }: CalendarProps): import("react").JSX.Element;
19
+ export declare function Calendar({ value, onChange, min, max, isUnavailable, today, ...rest }: CalendarProps): import("react").JSX.Element;
14
20
  export type RangeCalendarProps = {
15
21
  /** The chosen span, as ISO dates. */
16
22
  value?: {
@@ -6,7 +6,8 @@ import { focusRing, tv } from "../../foundations/variants.js";
6
6
  import { listOptionStyles } from "../field/aria.js";
7
7
  import { Popover } from "../overlay/Popover.js";
8
8
  import { ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
9
- import { Button as AriaButton, Calendar as AriaCalendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, CalendarMonthPicker, CalendarYearPicker, ListBox, ListBoxItem, RangeCalendar as AriaRangeCalendar, Select as AriaSelect, SelectValue, useLocale, } from "react-aria-components";
9
+ import { useContext } from "react";
10
+ import { Button as AriaButton, Calendar as AriaCalendar, CalendarCell, CalendarContext, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, CalendarMonthPicker, CalendarYearPicker, ListBox, ListBoxItem, RangeCalendar as AriaRangeCalendar, Select as AriaSelect, SelectValue, useLocale, } from "react-aria-components";
10
11
  /**
11
12
  * The month grid — on its own, or inside the popover of a date picker.
12
13
  *
@@ -84,7 +85,8 @@ function defined(props) {
84
85
  return Object.fromEntries(Object.entries(props).filter(([, v]) => v !== undefined));
85
86
  }
86
87
  /** One month, to pick one day. */
87
- export function Calendar({ value, onChange, min, max, isUnavailable, ...rest }) {
88
+ export function Calendar({ value, onChange, min, max, isUnavailable, today, ...rest }) {
89
+ const inPicker = useContext(CalendarContext) != null;
88
90
  const props = defined({
89
91
  value: iso(value),
90
92
  onChange: onChange === undefined ? undefined : (next) => onChange(next.toString()),
@@ -93,8 +95,16 @@ export function Calendar({ value, onChange, min, max, isUnavailable, ...rest })
93
95
  isDateUnavailable: isUnavailable === undefined
94
96
  ? undefined
95
97
  : (date) => isUnavailable(date.toString()),
98
+ // Loose, it opens on the business's today when nothing is chosen. Inside a picker the value
99
+ // comes from React Aria's context, not from `value`: opening on today there would hide the
100
+ // chosen day (the picker opens on it, and on `today` only when empty — its placeholder).
101
+ defaultFocusedValue: inPicker || value ? undefined : (iso(today) ?? undefined),
96
102
  });
97
- return (_jsx(AriaLocale, { children: _jsxs(AriaCalendar, { ...rest, ...props, className: "w-fit", children: [_jsx(Header, { jump: true }), _jsxs(CalendarGrid, { className: "border-separate border-spacing-0.5", children: [_jsx(WeekDays, {}), _jsx(CalendarGridBody, { children: (date) => _jsx(CalendarCell, { date: date, className: dayCell }) })] })] }) }));
103
+ return (_jsx(AriaLocale, { children: _jsxs(AriaCalendar, { ...rest, ...props, className: "w-fit", children: [_jsx(Header, { jump: true }), _jsxs(CalendarGrid, { className: "border-separate border-spacing-0.5", children: [_jsx(WeekDays, {}), _jsx(CalendarGridBody, { children: (date) => (_jsx(CalendarCell, { date: date, className: (state) => dayCell({
104
+ ...state,
105
+ // React Aria's «today» is the browser's; the business's, when it is given.
106
+ isToday: today === undefined ? state.isToday : date.toString() === today,
107
+ }) })) })] })] }) }));
98
108
  }
99
109
  const rangeDay = tv({
100
110
  extend: focusRing,
@@ -25,9 +25,12 @@ export declare function DateField({ value, onChange, id: ownId, describedBy: own
25
25
  onChange?: (next: string | null) => void;
26
26
  }): import("react").JSX.Element;
27
27
  /** A date typed by segments, or picked on a calendar from the button. */
28
- export declare function DatePicker({ value, onChange, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, disabled, min, max, mode, "aria-label": ariaLabel, }: Shared & {
28
+ export declare function DatePicker({ value, onChange, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, disabled, min, max, mode, today, "aria-label": ariaLabel, }: Shared & {
29
29
  value: string | null;
30
30
  onChange?: (next: string | null) => void;
31
+ /** The day it is for the business, as an ISO date — what its calendar marks as today
32
+ * (`Calendar today`). Without it, the browser's. */
33
+ today?: string;
31
34
  }): import("react").JSX.Element;
32
35
  export type DateRangeValue = {
33
36
  start: string;
@@ -74,7 +74,7 @@ export function DateField({ value, onChange, id: ownId, describedBy: ownDescribe
74
74
  return (_jsx(AriaLocale, { children: _jsx(AriaDateField, { id: id, "aria-labelledby": labelledBy, "aria-label": controlName(labelledBy, ariaLabel), "aria-describedby": describedBy, value: parse(value), onChange: (next) => onChange?.(next === null ? null : next.toString()), minValue: parse(min) ?? undefined, maxValue: parse(max) ?? undefined, isInvalid: invalid, isDisabled: disabled, className: "w-full", children: _jsx(FieldGroup, { children: _jsx(Segments, {}) }) }) }));
75
75
  }
76
76
  /** A date typed by segments, or picked on a calendar from the button. */
77
- export function DatePicker({ value, onChange, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, disabled = false, min, max, mode, "aria-label": ariaLabel, }) {
77
+ export function DatePicker({ value, onChange, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, disabled = false, min, max, mode, today, "aria-label": ariaLabel, }) {
78
78
  const { id, labelledBy, describedBy, invalid } = useFieldIds({
79
79
  id: ownId,
80
80
  describedBy: ownDescribedBy,
@@ -83,7 +83,7 @@ export function DatePicker({ value, onChange, id: ownId, describedBy: ownDescrib
83
83
  const read = useReadDate();
84
84
  if (useFormMode(mode) === "read")
85
85
  return _jsx(ReadValue, { value: read(value) });
86
- return (_jsx(AriaLocale, { children: _jsxs(AriaDatePicker, { id: id, "aria-labelledby": labelledBy, "aria-label": controlName(labelledBy, ariaLabel), "aria-describedby": describedBy, value: parse(value), onChange: (next) => onChange?.(next === null ? null : next.toString()), minValue: parse(min) ?? undefined, maxValue: parse(max) ?? undefined, isInvalid: invalid, isDisabled: disabled, className: "w-full", children: [_jsxs(FieldGroup, { children: [_jsx(Segments, {}), _jsx(FieldButton, { className: "mr-1 ml-auto", children: _jsx(CalendarDays, { "aria-hidden": true, className: "size-(--size-icon-md)", strokeWidth: 2 }) })] }), _jsx(Popover, { placement: "bottom end", children: _jsx(Dialog, { className: "p-3 outline-0", children: _jsx(Calendar, {}) }) })] }) }));
86
+ return (_jsx(AriaLocale, { children: _jsxs(AriaDatePicker, { id: id, "aria-labelledby": labelledBy, "aria-label": controlName(labelledBy, ariaLabel), "aria-describedby": describedBy, value: parse(value), onChange: (next) => onChange?.(next === null ? null : next.toString()), minValue: parse(min) ?? undefined, maxValue: parse(max) ?? undefined, ...(today === undefined ? {} : { placeholderValue: parse(today) ?? undefined }), isInvalid: invalid, isDisabled: disabled, className: "w-full", children: [_jsxs(FieldGroup, { children: [_jsx(Segments, {}), _jsx(FieldButton, { className: "mr-1 ml-auto", children: _jsx(CalendarDays, { "aria-hidden": true, className: "size-(--size-icon-md)", strokeWidth: 2 }) })] }), _jsx(Popover, { placement: "bottom end", children: _jsx(Dialog, { className: "p-3 outline-0", children: _jsx(Calendar, { ...(today === undefined ? {} : { today }) }) }) })] }) }));
87
87
  }
88
88
  /** A span of days — a period of a report, the validity of a contract — typed or picked on
89
89
  * two months at once. */