@sincpro/web-ui 2.12.0 → 2.14.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.
- package/README.md +56 -21
- package/dist/components/gallery/Gallery.d.ts +29 -0
- package/dist/components/gallery/Gallery.js +78 -0
- package/dist/components/gallery/Lightbox.d.ts +28 -0
- package/dist/components/gallery/Lightbox.js +59 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/listing/BoardColumns.js +10 -6
- package/dist/components/listing/ColumnsMenu.js +4 -2
- package/dist/components/listing/Listing.js +3 -1
- package/dist/components/listing/ListingBar.d.ts +16 -94
- package/dist/components/listing/ListingBar.js +24 -2
- package/dist/components/listing/RecordCard.d.ts +41 -3
- package/dist/components/listing/RecordCard.js +63 -22
- package/dist/components/listing/Row.js +5 -2
- package/dist/components/listing/columns.d.ts +3 -0
- package/dist/components/listing/columns.js +4 -0
- package/dist/components/listing/index.d.ts +2 -2
- package/dist/components/listing/index.js +2 -2
- package/dist/components/listing/set.d.ts +1 -1
- package/dist/components/plans/PlanCard.d.ts +43 -0
- package/dist/components/plans/PlanCard.js +35 -0
- package/dist/components/plans/index.d.ts +1 -0
- package/dist/components/plans/index.js +2 -0
- package/dist/components/receipt/Receipt.d.ts +51 -0
- package/dist/components/receipt/Receipt.js +23 -0
- package/dist/components/receipt/index.d.ts +1 -0
- package/dist/components/receipt/index.js +3 -0
- package/dist/components/search/CriteriaChips.d.ts +14 -1
- package/dist/components/search/CriteriaChips.js +123 -13
- package/dist/components/search/JoinWord.js +8 -14
- package/dist/components/search/SearchBar.d.ts +10 -1
- package/dist/components/search/SearchBar.js +715 -176
- package/dist/components/search/WordChoice.d.ts +19 -0
- package/dist/components/search/WordChoice.js +8 -0
- package/dist/components/search/criteria.d.ts +27 -0
- package/dist/components/search/criteria.js +33 -0
- package/dist/components/search/index.d.ts +2 -2
- package/dist/components/search/index.js +2 -2
- package/dist/components/search/query.d.ts +24 -0
- package/dist/components/search/query.js +29 -0
- package/dist/components/shell/AppFrame.d.ts +4 -0
- package/dist/components/shell/AppFrame.js +4 -1
- package/dist/components/shell/Inbox.d.ts +53 -0
- package/dist/components/shell/Inbox.js +55 -0
- package/dist/components/shell/KioskFrame.d.ts +35 -0
- package/dist/components/shell/KioskFrame.js +39 -0
- package/dist/components/shell/SearchEntry.js +2 -3
- package/dist/components/shell/TopBar.d.ts +4 -2
- package/dist/components/shell/TopBar.js +3 -3
- package/dist/components/shell/index.d.ts +2 -0
- package/dist/components/shell/index.js +4 -0
- package/dist/foundations/clock.d.ts +3 -0
- package/dist/foundations/clock.js +41 -0
- package/dist/foundations/copy.es.js +86 -1
- package/dist/foundations/form.d.ts +7 -0
- package/dist/foundations/form.js +1 -0
- package/dist/foundations/idle.d.ts +1 -0
- package/dist/foundations/idle.js +34 -0
- package/dist/foundations/index.d.ts +3 -0
- package/dist/foundations/index.js +7 -0
- package/dist/foundations/pointer.d.ts +25 -0
- package/dist/foundations/pointer.js +28 -0
- package/dist/foundations/uiCopy.d.ts +123 -2
- package/dist/foundations/uiCopy.js +86 -1
- package/dist/primitives/choice/RadioGroup.d.ts +8 -1
- package/dist/primitives/choice/RadioGroup.js +38 -1
- package/dist/primitives/choice/Rating.d.ts +32 -0
- package/dist/primitives/choice/Rating.js +75 -0
- package/dist/primitives/choice/Slider.d.ts +19 -0
- package/dist/primitives/choice/Slider.js +27 -2
- package/dist/primitives/choice/index.d.ts +2 -1
- package/dist/primitives/choice/index.js +4 -1
- package/dist/primitives/choice/options.d.ts +7 -0
- package/dist/primitives/field/Field.js +1 -0
- package/dist/primitives/field/Keypad.d.ts +43 -0
- package/dist/primitives/field/Keypad.js +62 -0
- package/dist/primitives/field/Stepper.d.ts +28 -0
- package/dist/primitives/field/Stepper.js +52 -0
- package/dist/primitives/field/clipboard.js +1 -1
- package/dist/primitives/field/index.d.ts +3 -0
- package/dist/primitives/field/index.js +6 -0
- package/dist/primitives/field/keypadKeys.d.ts +24 -0
- package/dist/primitives/field/keypadKeys.js +80 -0
- package/dist/primitives/hint/Hint.js +1 -1
- package/dist/primitives/hint/Kbd.d.ts +23 -0
- package/dist/primitives/hint/Kbd.js +23 -0
- package/dist/primitives/hint/index.d.ts +1 -0
- package/dist/primitives/hint/index.js +2 -0
- package/dist/primitives/menu/ContextMenu.d.ts +29 -0
- package/dist/primitives/menu/ContextMenu.js +74 -0
- package/dist/primitives/menu/Menu.d.ts +4 -1
- package/dist/primitives/menu/Menu.js +2 -2
- package/dist/primitives/menu/index.d.ts +1 -0
- package/dist/primitives/menu/index.js +2 -0
- package/dist/primitives/notice/Banner.d.ts +27 -0
- package/dist/primitives/notice/Banner.js +21 -0
- package/dist/primitives/notice/Callout.d.ts +4 -4
- package/dist/primitives/notice/Callout.js +8 -19
- package/dist/primitives/notice/Flag.js +1 -1
- package/dist/primitives/notice/Notice.d.ts +38 -10
- package/dist/primitives/notice/Notice.js +48 -9
- package/dist/primitives/notice/Outcome.d.ts +28 -0
- package/dist/primitives/notice/Outcome.js +28 -0
- package/dist/primitives/notice/index.d.ts +4 -1
- package/dist/primitives/notice/index.js +5 -0
- package/dist/primitives/notice/tones.d.ts +8 -0
- package/dist/primitives/notice/tones.js +22 -0
- package/dist/primitives/table/CellCopy.js +1 -1
- package/dist/primitives/table/ReportTable.js +1 -1
- package/dist/primitives/table/RowActions.js +1 -1
- package/dist/primitives/table/Table.js +9 -5
- package/dist/primitives/tag/Tags.d.ts +22 -1
- package/dist/primitives/tag/Tags.js +57 -14
- package/dist/primitives/tag/index.d.ts +1 -1
- package/dist/primitives/value/Elapsed.d.ts +16 -0
- package/dist/primitives/value/Elapsed.js +37 -0
- package/dist/primitives/value/Price.d.ts +31 -0
- package/dist/primitives/value/Price.js +32 -0
- package/dist/primitives/value/QrCode.d.ts +32 -0
- package/dist/primitives/value/QrCode.js +53 -0
- package/dist/primitives/value/elapsedTime.d.ts +26 -0
- package/dist/primitives/value/elapsedTime.js +32 -0
- package/dist/primitives/value/index.d.ts +5 -0
- package/dist/primitives/value/index.js +10 -0
- package/dist/primitives/value/priceFormat.d.ts +12 -0
- package/dist/primitives/value/priceFormat.js +22 -0
- package/dist/tokens.css +126 -1
- package/dist/views/list/List.d.ts +11 -0
- package/dist/views/list/List.js +14 -3
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +48 -9
- package/dist/views/list/types.d.ts +15 -0
- package/dist/views/record/Record.js +1 -1
- package/package.json +3 -2
|
@@ -28,6 +28,7 @@ export const SPANISH_COPY = {
|
|
|
28
28
|
rows: "Filas",
|
|
29
29
|
table: "Tabla",
|
|
30
30
|
board: "Tablero",
|
|
31
|
+
tiles: "Mosaicos",
|
|
31
32
|
sheet: "Planilla",
|
|
32
33
|
report: "Reporte",
|
|
33
34
|
pivot: "Pivote",
|
|
@@ -190,7 +191,23 @@ export const SPANISH_COPY = {
|
|
|
190
191
|
recordsFailed: "No se pudo buscar",
|
|
191
192
|
moreRecords: "Buscar más…",
|
|
192
193
|
advanced: "Búsqueda avanzada…",
|
|
193
|
-
|
|
194
|
+
keys: {
|
|
195
|
+
move: "moverse",
|
|
196
|
+
put: "poner",
|
|
197
|
+
open: "abrir",
|
|
198
|
+
complete: "completar",
|
|
199
|
+
undo: "deshacer",
|
|
200
|
+
panel: "filtros",
|
|
201
|
+
advanced: "avanzada",
|
|
202
|
+
},
|
|
203
|
+
recent: "Recientes",
|
|
204
|
+
searchBy: "Buscar por",
|
|
205
|
+
removed: "Quitado: {label}",
|
|
206
|
+
undo: "Deshacer",
|
|
207
|
+
chipMarked: "{label} marcado. Supr lo quita, Enter lo edita, las flechas se mueven.",
|
|
208
|
+
editValue: "Cambiar el valor de {label}",
|
|
209
|
+
changeOp: "Comparar {field} de otra manera",
|
|
210
|
+
findIn: "Buscar en {column}",
|
|
194
211
|
landsHere: "acá cae lo próximo",
|
|
195
212
|
closeGroup: "Cerrar este grupo",
|
|
196
213
|
condition: "{field} {op} {value}",
|
|
@@ -566,6 +583,74 @@ export const SPANISH_COPY = {
|
|
|
566
583
|
addColumn: "Agregar etapa",
|
|
567
584
|
addColumnPlaceholder: "Nombre de la etapa… (Enter agrega)",
|
|
568
585
|
},
|
|
586
|
+
elapsed: {
|
|
587
|
+
label: "Esperando",
|
|
588
|
+
waiting: "Esperando hace {time}",
|
|
589
|
+
},
|
|
590
|
+
stepper: {
|
|
591
|
+
label: "Cantidad",
|
|
592
|
+
decrease: "Uno menos",
|
|
593
|
+
increase: "Uno más",
|
|
594
|
+
remove: "Quitar",
|
|
595
|
+
},
|
|
596
|
+
plans: {
|
|
597
|
+
current: "Tu plan",
|
|
598
|
+
included: "Incluye",
|
|
599
|
+
excluded: "No incluye",
|
|
600
|
+
onRequest: "A convenir",
|
|
601
|
+
},
|
|
602
|
+
range: {
|
|
603
|
+
min: "Mínimo",
|
|
604
|
+
max: "Máximo",
|
|
605
|
+
},
|
|
606
|
+
price: {
|
|
607
|
+
now: "Ahora",
|
|
608
|
+
before: "Antes",
|
|
609
|
+
free: "Gratis",
|
|
610
|
+
per: "por",
|
|
611
|
+
off: "{percent} % menos",
|
|
612
|
+
},
|
|
613
|
+
rating: {
|
|
614
|
+
label: "Calificación",
|
|
615
|
+
average: "{value} de {max}",
|
|
616
|
+
count: "{count} opiniones",
|
|
617
|
+
countOne: "{count} opinión",
|
|
618
|
+
none: "todavía sin calificar",
|
|
619
|
+
stars: "{value} de {max} estrellas",
|
|
620
|
+
},
|
|
621
|
+
gallery: {
|
|
622
|
+
label: "Imágenes",
|
|
623
|
+
roledescription: "galería",
|
|
624
|
+
previous: "Imagen anterior",
|
|
625
|
+
next: "Imagen siguiente",
|
|
626
|
+
position: "Imagen {index} de {total}",
|
|
627
|
+
open: "Ver en tamaño completo",
|
|
628
|
+
close: "Cerrar",
|
|
629
|
+
empty: "Todavía no hay imágenes",
|
|
630
|
+
},
|
|
631
|
+
inbox: {
|
|
632
|
+
label: "Notificaciones",
|
|
633
|
+
unread: "Sin leer",
|
|
634
|
+
unreadCount: "{count} sin leer",
|
|
635
|
+
markAllRead: "Marcar todo como leído",
|
|
636
|
+
seeAll: "Ver todas",
|
|
637
|
+
empty: "Nada nuevo por acá",
|
|
638
|
+
},
|
|
639
|
+
outcome: {
|
|
640
|
+
figure: "Número",
|
|
641
|
+
},
|
|
642
|
+
kiosk: {
|
|
643
|
+
reach: "Bajar la pantalla al alcance",
|
|
644
|
+
reachOff: "Volver a la altura completa",
|
|
645
|
+
start: "Tocá para empezar",
|
|
646
|
+
},
|
|
647
|
+
keypad: {
|
|
648
|
+
label: "Teclado numérico",
|
|
649
|
+
backspace: "Borrar el último dígito",
|
|
650
|
+
clear: "Borrar todo",
|
|
651
|
+
decimal: "Coma decimal",
|
|
652
|
+
sign: "Cambiar el signo",
|
|
653
|
+
},
|
|
569
654
|
timeline: {
|
|
570
655
|
prev: "Anterior",
|
|
571
656
|
next: "Siguiente",
|
|
@@ -15,6 +15,12 @@ export type FieldIds = {
|
|
|
15
15
|
/** The id of the field's label. A native input is named by `<label for>`; a React Aria
|
|
16
16
|
* control — a date picker, a combobox — is a group of elements, and is named by this. */
|
|
17
17
|
labelId: string;
|
|
18
|
+
/** The label's words. A control that is a group of inputs needs them as a NAME and not as
|
|
19
|
+
* a reference: React Aria names each slider thumb by pointing at the group, and a group
|
|
20
|
+
* named only through `aria-labelledby` is read by its whole text when pointed at (the
|
|
21
|
+
* accessible-name rules do not follow a reference twice) — the thumb said «Bs 50 – Bs 300
|
|
22
|
+
* Precio». With the words, the group carries them as `aria-label` too. */
|
|
23
|
+
label?: string;
|
|
18
24
|
describedBy: string | undefined;
|
|
19
25
|
invalid: boolean;
|
|
20
26
|
};
|
|
@@ -57,6 +63,7 @@ export declare function useFieldIds(own: {
|
|
|
57
63
|
}): {
|
|
58
64
|
id: string | undefined;
|
|
59
65
|
labelledBy: string | undefined;
|
|
66
|
+
label: string | undefined;
|
|
60
67
|
describedBy: string | undefined;
|
|
61
68
|
invalid: boolean;
|
|
62
69
|
};
|
package/dist/foundations/form.js
CHANGED
|
@@ -25,6 +25,7 @@ export function useFieldIds(own) {
|
|
|
25
25
|
return {
|
|
26
26
|
id: own.id ?? field?.id,
|
|
27
27
|
labelledBy: field?.labelId,
|
|
28
|
+
label: field?.label,
|
|
28
29
|
describedBy: own.describedBy ?? field?.describedBy ?? place?.describedBy,
|
|
29
30
|
invalid: own.invalid ?? field?.invalid ?? place?.invalid ?? false,
|
|
30
31
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIdle(seconds: number, onIdle: () => void, active?: boolean): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
/* ==================================================================== *
|
|
4
|
+
* IDLE — nobody has touched it for a while.
|
|
5
|
+
*
|
|
6
|
+
* Context: a kiosk is left half-way — two coffees in the order and the person gone — and the
|
|
7
|
+
* next one finds someone else's order. After `seconds` without a touch, a key or a scroll,
|
|
8
|
+
* `onIdle` runs once; the next touch starts the count again. Off while `active` is false (on
|
|
9
|
+
* the attract screen there is nothing to abandon).
|
|
10
|
+
* ==================================================================== */
|
|
11
|
+
const EVENTS = ["pointerdown", "keydown", "wheel", "touchstart"];
|
|
12
|
+
export function useIdle(seconds, onIdle, active = true) {
|
|
13
|
+
/* The latest callback, without restarting the count when the screen re-renders. */
|
|
14
|
+
const callback = useRef(onIdle);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
callback.current = onIdle;
|
|
17
|
+
});
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!active || seconds <= 0)
|
|
20
|
+
return;
|
|
21
|
+
let timer = setTimeout(() => callback.current(), seconds * 1000);
|
|
22
|
+
const restart = () => {
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
timer = setTimeout(() => callback.current(), seconds * 1000);
|
|
25
|
+
};
|
|
26
|
+
for (const name of EVENTS)
|
|
27
|
+
window.addEventListener(name, restart, { passive: true });
|
|
28
|
+
return () => {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
for (const name of EVENTS)
|
|
31
|
+
window.removeEventListener(name, restart);
|
|
32
|
+
};
|
|
33
|
+
}, [seconds, active]);
|
|
34
|
+
}
|
|
@@ -2,6 +2,8 @@ export { type CopyCatalog, createCopy } from "./catalog.js";
|
|
|
2
2
|
export { UiCopyProvider, useUiCopy } from "./copy.js";
|
|
3
3
|
export { type CopyOverride, mergeCopyOver } from "./copyStore.js";
|
|
4
4
|
export { DensityProvider, useDensity } from "./density.js";
|
|
5
|
+
export { useNow } from "./clock.js";
|
|
6
|
+
export { useIdle } from "./idle.js";
|
|
5
7
|
export { byDensity, bySurface } from "./pickBy.js";
|
|
6
8
|
export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, mergeCopy, type UiCopy, type UiCopyOverride, } from "./uiCopy.js";
|
|
7
9
|
export { useViewStyle, type ViewStyle, ViewStyleProvider, } from "./viewStyle.js";
|
|
@@ -9,6 +11,7 @@ export { controlName } from "./controlName.js";
|
|
|
9
11
|
export { FieldBoundary, type FieldIds, type FormMode, FormModeProvider, type FormStyle, FormStyleProvider, useFieldIds, useFormMode, useFormStyle, } from "./form.js";
|
|
10
12
|
export { type KeyPress, type Keys, keysAria, keysLabel, matchesKeys, type ModShortcut, modShortcut, needsModifier, type ParsedKeys, parseKeys, } from "./keys.js";
|
|
11
13
|
export { type KeyboardPlatform, type Shortcut, useKeyboardPlatform, useKeysHint, useShortcuts, } from "./shortcut.js";
|
|
14
|
+
export { isPointer, type Pointer, POINTER_ATTRIBUTE, pointerAttributes, POINTERS, } from "./pointer.js";
|
|
12
15
|
export { SurfaceProvider, useSurface } from "./surface.js";
|
|
13
16
|
export { applyTheme, ThemeProvider, type ThemeProviderProps, useTheme, } from "./theme.js";
|
|
14
17
|
export { isTheme, type ResolvedTheme, resolveTheme, type Theme, THEME_ATTRIBUTE, THEMES, } from "./themeChoice.js";
|
|
@@ -7,6 +7,10 @@ export { createCopy } from "./catalog.js";
|
|
|
7
7
|
export { UiCopyProvider, useUiCopy } from "./copy.js";
|
|
8
8
|
export { mergeCopyOver } from "./copyStore.js";
|
|
9
9
|
export { DensityProvider, useDensity } from "./density.js";
|
|
10
|
+
/* NOW, live — one shared ticking clock per interval, `null` on the server. */
|
|
11
|
+
export { useNow } from "./clock.js";
|
|
12
|
+
/* IDLE — nobody touched it for a while: a kiosk forgets the abandoned order. */
|
|
13
|
+
export { useIdle } from "./idle.js";
|
|
10
14
|
export { byDensity, bySurface } from "./pickBy.js";
|
|
11
15
|
export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, mergeCopy, } from "./uiCopy.js";
|
|
12
16
|
/* How a whole application draws its views — `traditional` or `modern` (the direction): the
|
|
@@ -21,6 +25,9 @@ export { FieldBoundary, FormModeProvider, FormStyleProvider, useFieldIds, useFor
|
|
|
21
25
|
mounted wins. A combination is written once («Alt+D», «Mod+S») and read by `foundations/keys`. */
|
|
22
26
|
export { keysAria, keysLabel, matchesKeys, modShortcut, needsModifier, parseKeys, } from "./keys.js";
|
|
23
27
|
export { useKeyboardPlatform, useKeysHint, useShortcuts, } from "./shortcut.js";
|
|
28
|
+
/* THE POINTER — a finger or a mouse, when the application knows better than the device (a till
|
|
29
|
+
is a touch monitor with a mouse plugged in). `tokens.css` reads `data-pointer`. */
|
|
30
|
+
export { isPointer, POINTER_ATTRIBUTE, pointerAttributes, POINTERS, } from "./pointer.js";
|
|
24
31
|
/* THE THEME — light, dark or the operating system's. The palettes live in `tokens.css`; this
|
|
25
32
|
only writes `data-theme`. */
|
|
26
33
|
export { SurfaceProvider, useSurface } from "./surface.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE POINTER — what the person presses with, when the application knows better than the
|
|
3
|
+
* device.
|
|
4
|
+
*
|
|
5
|
+
* Context: the stylesheet sizes every control for a finger under `pointer: coarse`, and that
|
|
6
|
+
* is the browser's answer for the PRIMARY pointer. A till is a touch monitor with a mouse
|
|
7
|
+
* plugged in, a kiosk a touch screen the browser may report as a mouse: there the cashier gets
|
|
8
|
+
* 30 px targets. The application says it instead — `data-pointer` on `<html>` (or on a zone):
|
|
9
|
+
*
|
|
10
|
+
* touch sized for a finger, whatever the device reports
|
|
11
|
+
* fine sized for a mouse, even on a tablet (a back office driven with a trackpad)
|
|
12
|
+
* auto the device decides — the same as writing nothing
|
|
13
|
+
*
|
|
14
|
+
* Pure and without `"use client"`: a server layout writes `<html data-pointer>` itself, so the
|
|
15
|
+
* first paint already has the right sizes.
|
|
16
|
+
*/
|
|
17
|
+
export type Pointer = "auto" | "touch" | "fine";
|
|
18
|
+
export declare const POINTERS: readonly Pointer[];
|
|
19
|
+
/** The attribute the stylesheet reads. */
|
|
20
|
+
export declare const POINTER_ATTRIBUTE = "data-pointer";
|
|
21
|
+
/** True for one of the three values — what comes from a setting or a URL is a string. */
|
|
22
|
+
export declare function isPointer(value: unknown): value is Pointer;
|
|
23
|
+
/** The attributes to spread on an element (`<html {...pointerAttributes("touch")}>`): `auto`
|
|
24
|
+
* writes none, so the device decides. */
|
|
25
|
+
export declare function pointerAttributes(pointer: Pointer): Record<string, string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE POINTER — what the person presses with, when the application knows better than the
|
|
3
|
+
* device.
|
|
4
|
+
*
|
|
5
|
+
* Context: the stylesheet sizes every control for a finger under `pointer: coarse`, and that
|
|
6
|
+
* is the browser's answer for the PRIMARY pointer. A till is a touch monitor with a mouse
|
|
7
|
+
* plugged in, a kiosk a touch screen the browser may report as a mouse: there the cashier gets
|
|
8
|
+
* 30 px targets. The application says it instead — `data-pointer` on `<html>` (or on a zone):
|
|
9
|
+
*
|
|
10
|
+
* touch sized for a finger, whatever the device reports
|
|
11
|
+
* fine sized for a mouse, even on a tablet (a back office driven with a trackpad)
|
|
12
|
+
* auto the device decides — the same as writing nothing
|
|
13
|
+
*
|
|
14
|
+
* Pure and without `"use client"`: a server layout writes `<html data-pointer>` itself, so the
|
|
15
|
+
* first paint already has the right sizes.
|
|
16
|
+
*/
|
|
17
|
+
export const POINTERS = ["auto", "touch", "fine"];
|
|
18
|
+
/** The attribute the stylesheet reads. */
|
|
19
|
+
export const POINTER_ATTRIBUTE = "data-pointer";
|
|
20
|
+
/** True for one of the three values — what comes from a setting or a URL is a string. */
|
|
21
|
+
export function isPointer(value) {
|
|
22
|
+
return value === "auto" || value === "touch" || value === "fine";
|
|
23
|
+
}
|
|
24
|
+
/** The attributes to spread on an element (`<html {...pointerAttributes("touch")}>`): `auto`
|
|
25
|
+
* writes none, so the device decides. */
|
|
26
|
+
export function pointerAttributes(pointer) {
|
|
27
|
+
return pointer === "auto" ? {} : { [POINTER_ATTRIBUTE]: pointer };
|
|
28
|
+
}
|
|
@@ -26,6 +26,7 @@ export type UiCopy = {
|
|
|
26
26
|
rows: string;
|
|
27
27
|
table: string;
|
|
28
28
|
board: string;
|
|
29
|
+
tiles: string;
|
|
29
30
|
/** The sheet: the raw data, with the file's columns. */
|
|
30
31
|
sheet: string;
|
|
31
32
|
/** The one that SUMS: a hierarchy that ends in totals. */
|
|
@@ -287,8 +288,30 @@ export type UiCopy = {
|
|
|
287
288
|
moreRecords: string;
|
|
288
289
|
/** The way into the builder — in the dropdown, under what is offered, and in the panel. */
|
|
289
290
|
advanced: string;
|
|
290
|
-
/** The keys of the dropdown, said once at its foot
|
|
291
|
-
|
|
291
|
+
/** The keys of the dropdown, said once at its foot: each word goes beside its key, drawn
|
|
292
|
+
* the way this keyboard writes it. */
|
|
293
|
+
keys: {
|
|
294
|
+
move: string;
|
|
295
|
+
put: string;
|
|
296
|
+
open: string;
|
|
297
|
+
complete: string;
|
|
298
|
+
undo: string;
|
|
299
|
+
panel: string;
|
|
300
|
+
advanced: string;
|
|
301
|
+
};
|
|
302
|
+
/** The bar offers before anything is typed: what was searched lately, and by what. */
|
|
303
|
+
recent: string;
|
|
304
|
+
searchBy: string;
|
|
305
|
+
/** A removed instance, said where it can be taken back. */
|
|
306
|
+
removed: string;
|
|
307
|
+
undo: string;
|
|
308
|
+
/** A chip marked from the keyboard (← on the empty bar): what it is and what can be done. */
|
|
309
|
+
chipMarked: string;
|
|
310
|
+
/** The parts of a chip, each touched on its own. */
|
|
311
|
+
editValue: string;
|
|
312
|
+
changeOp: string;
|
|
313
|
+
/** The box that narrows a long column of the panel. */
|
|
314
|
+
findIn: string;
|
|
292
315
|
placeholder: string;
|
|
293
316
|
/** The titles of the three columns of the tools panel. */
|
|
294
317
|
filters: string;
|
|
@@ -844,6 +867,104 @@ export type UiCopy = {
|
|
|
844
867
|
addColumn: string;
|
|
845
868
|
addColumnPlaceholder: string;
|
|
846
869
|
};
|
|
870
|
+
/** How long something has been waiting (`Elapsed`, a card's `elapsed`). */
|
|
871
|
+
elapsed: {
|
|
872
|
+
/** Read before the figure by a screen reader: «Esperando 4:05». */
|
|
873
|
+
label: string;
|
|
874
|
+
/** The figure's title. `{time}` is «4:05». */
|
|
875
|
+
waiting: string;
|
|
876
|
+
};
|
|
877
|
+
/** A quantity with «−» and «+» (`Stepper`). The unit goes after: «Sumar uno: Capuchino». */
|
|
878
|
+
stepper: {
|
|
879
|
+
label: string;
|
|
880
|
+
decrease: string;
|
|
881
|
+
increase: string;
|
|
882
|
+
/** «−» at the minimum, when it takes the line away. */
|
|
883
|
+
remove: string;
|
|
884
|
+
};
|
|
885
|
+
/** An offer's plans (`PlanCard`). */
|
|
886
|
+
plans: {
|
|
887
|
+
/** The tag on the plan the person is on. */
|
|
888
|
+
current: string;
|
|
889
|
+
/** Said before a feature, for a screen reader: the icon says it to the eye. */
|
|
890
|
+
included: string;
|
|
891
|
+
excluded: string;
|
|
892
|
+
/** Where the price goes when there is none. */
|
|
893
|
+
onRequest: string;
|
|
894
|
+
};
|
|
895
|
+
/** The two ends of a `RangeSlider`, each thumb's own name after the field's. */
|
|
896
|
+
range: {
|
|
897
|
+
min: string;
|
|
898
|
+
max: string;
|
|
899
|
+
};
|
|
900
|
+
/** A price as a shelf says it (`Price`). Each figure is named for a screen reader. */
|
|
901
|
+
price: {
|
|
902
|
+
now: string;
|
|
903
|
+
before: string;
|
|
904
|
+
/** What a price of zero says. */
|
|
905
|
+
free: string;
|
|
906
|
+
/** Between the price and its unit — «Bs 120,00 por mes» — said, not drawn. */
|
|
907
|
+
per: string;
|
|
908
|
+
/** The discount tag's title. `{percent}` is the whole number. */
|
|
909
|
+
off: string;
|
|
910
|
+
};
|
|
911
|
+
/** Stars for how good (`Rating`). */
|
|
912
|
+
rating: {
|
|
913
|
+
label: string;
|
|
914
|
+
/** `{value}` is «4,5», `{max}` is 5. */
|
|
915
|
+
average: string;
|
|
916
|
+
/** `{count}` opinions, already written in the locale — and the one for a single one. */
|
|
917
|
+
count: string;
|
|
918
|
+
countOne: string;
|
|
919
|
+
none: string;
|
|
920
|
+
/** Each star of the question: «3 de 5 estrellas». */
|
|
921
|
+
stars: string;
|
|
922
|
+
};
|
|
923
|
+
/** The images of one thing (`Gallery`, `Lightbox`). */
|
|
924
|
+
gallery: {
|
|
925
|
+
label: string;
|
|
926
|
+
/** What assistive technology calls the group. */
|
|
927
|
+
roledescription: string;
|
|
928
|
+
previous: string;
|
|
929
|
+
next: string;
|
|
930
|
+
/** `{index}` of `{total}`. */
|
|
931
|
+
position: string;
|
|
932
|
+
open: string;
|
|
933
|
+
close: string;
|
|
934
|
+
empty: string;
|
|
935
|
+
};
|
|
936
|
+
/** The notifications (`Inbox`, `InboxList`). */
|
|
937
|
+
inbox: {
|
|
938
|
+
label: string;
|
|
939
|
+
unread: string;
|
|
940
|
+
/** Beside the title: «3 sin leer». */
|
|
941
|
+
unreadCount: string;
|
|
942
|
+
markAllRead: string;
|
|
943
|
+
seeAll: string;
|
|
944
|
+
empty: string;
|
|
945
|
+
};
|
|
946
|
+
/** A finished operation, said big (`Outcome`). */
|
|
947
|
+
outcome: {
|
|
948
|
+
/** Read before the figure: «Tu número: 118». */
|
|
949
|
+
figure: string;
|
|
950
|
+
};
|
|
951
|
+
/** A self-service frame (`KioskFrame`). */
|
|
952
|
+
kiosk: {
|
|
953
|
+
/** The button that brings the content down to a seated person's reach. */
|
|
954
|
+
reach: string;
|
|
955
|
+
reachOff: string;
|
|
956
|
+
/** The attract screen's call, when the application gives none. */
|
|
957
|
+
start: string;
|
|
958
|
+
};
|
|
959
|
+
/** The on-screen number pad of a till or a kiosk (`Keypad`). */
|
|
960
|
+
keypad: {
|
|
961
|
+
/** The pad's name when nothing names it. */
|
|
962
|
+
label: string;
|
|
963
|
+
backspace: string;
|
|
964
|
+
clear: string;
|
|
965
|
+
decimal: string;
|
|
966
|
+
sign: string;
|
|
967
|
+
};
|
|
847
968
|
/** A timeline of records and its toolbar (`RecordTimeline`, `TimelineToolbar`). */
|
|
848
969
|
timeline: {
|
|
849
970
|
prev: string;
|
|
@@ -5,6 +5,7 @@ export const ENGLISH_COPY = {
|
|
|
5
5
|
rows: "Rows",
|
|
6
6
|
table: "Table",
|
|
7
7
|
board: "Board",
|
|
8
|
+
tiles: "Tiles",
|
|
8
9
|
sheet: "Sheet",
|
|
9
10
|
report: "Report",
|
|
10
11
|
pivot: "Pivot",
|
|
@@ -166,7 +167,23 @@ export const ENGLISH_COPY = {
|
|
|
166
167
|
recordsFailed: "The search could not be done",
|
|
167
168
|
moreRecords: "Search more…",
|
|
168
169
|
advanced: "Advanced search…",
|
|
169
|
-
|
|
170
|
+
keys: {
|
|
171
|
+
move: "move",
|
|
172
|
+
put: "set",
|
|
173
|
+
open: "open",
|
|
174
|
+
complete: "complete",
|
|
175
|
+
undo: "undo",
|
|
176
|
+
panel: "filters",
|
|
177
|
+
advanced: "advanced",
|
|
178
|
+
},
|
|
179
|
+
recent: "Recent",
|
|
180
|
+
searchBy: "Search by",
|
|
181
|
+
removed: "Removed: {label}",
|
|
182
|
+
undo: "Undo",
|
|
183
|
+
chipMarked: "{label} marked. Delete removes it, Enter edits it, arrows move.",
|
|
184
|
+
editValue: "Change the value of {label}",
|
|
185
|
+
changeOp: "Compare {field} another way",
|
|
186
|
+
findIn: "Search in {column}",
|
|
170
187
|
placeholder: "search…",
|
|
171
188
|
filters: "Filters",
|
|
172
189
|
groupBy: "Group by",
|
|
@@ -551,6 +568,74 @@ export const ENGLISH_COPY = {
|
|
|
551
568
|
addColumn: "Add a stage",
|
|
552
569
|
addColumnPlaceholder: "Stage name… (Enter adds)",
|
|
553
570
|
},
|
|
571
|
+
elapsed: {
|
|
572
|
+
label: "Waiting",
|
|
573
|
+
waiting: "Waiting for {time}",
|
|
574
|
+
},
|
|
575
|
+
stepper: {
|
|
576
|
+
label: "Quantity",
|
|
577
|
+
decrease: "One less",
|
|
578
|
+
increase: "One more",
|
|
579
|
+
remove: "Remove",
|
|
580
|
+
},
|
|
581
|
+
plans: {
|
|
582
|
+
current: "Your plan",
|
|
583
|
+
included: "Included",
|
|
584
|
+
excluded: "Not included",
|
|
585
|
+
onRequest: "On request",
|
|
586
|
+
},
|
|
587
|
+
range: {
|
|
588
|
+
min: "Minimum",
|
|
589
|
+
max: "Maximum",
|
|
590
|
+
},
|
|
591
|
+
price: {
|
|
592
|
+
now: "Now",
|
|
593
|
+
before: "Before",
|
|
594
|
+
free: "Free",
|
|
595
|
+
per: "per",
|
|
596
|
+
off: "{percent}% off",
|
|
597
|
+
},
|
|
598
|
+
rating: {
|
|
599
|
+
label: "Rating",
|
|
600
|
+
average: "{value} out of {max}",
|
|
601
|
+
count: "{count} reviews",
|
|
602
|
+
countOne: "{count} review",
|
|
603
|
+
none: "not rated yet",
|
|
604
|
+
stars: "{value} of {max} stars",
|
|
605
|
+
},
|
|
606
|
+
gallery: {
|
|
607
|
+
label: "Images",
|
|
608
|
+
roledescription: "gallery",
|
|
609
|
+
previous: "Previous image",
|
|
610
|
+
next: "Next image",
|
|
611
|
+
position: "Image {index} of {total}",
|
|
612
|
+
open: "Open full size",
|
|
613
|
+
close: "Close",
|
|
614
|
+
empty: "No images yet",
|
|
615
|
+
},
|
|
616
|
+
inbox: {
|
|
617
|
+
label: "Notifications",
|
|
618
|
+
unread: "Unread",
|
|
619
|
+
unreadCount: "{count} unread",
|
|
620
|
+
markAllRead: "Mark all as read",
|
|
621
|
+
seeAll: "See all",
|
|
622
|
+
empty: "Nothing new",
|
|
623
|
+
},
|
|
624
|
+
outcome: {
|
|
625
|
+
figure: "Number",
|
|
626
|
+
},
|
|
627
|
+
kiosk: {
|
|
628
|
+
reach: "Bring it down within reach",
|
|
629
|
+
reachOff: "Back to full height",
|
|
630
|
+
start: "Touch to start",
|
|
631
|
+
},
|
|
632
|
+
keypad: {
|
|
633
|
+
label: "Number pad",
|
|
634
|
+
backspace: "Delete the last digit",
|
|
635
|
+
clear: "Clear",
|
|
636
|
+
decimal: "Decimal point",
|
|
637
|
+
sign: "Change the sign",
|
|
638
|
+
},
|
|
554
639
|
timeline: {
|
|
555
640
|
prev: "Previous",
|
|
556
641
|
next: "Next",
|
|
@@ -14,5 +14,12 @@ export type RadioGroupProps = {
|
|
|
14
14
|
invalid?: boolean;
|
|
15
15
|
/** Forces the mode. By default it inherits the form's: in read mode it draws the label. */
|
|
16
16
|
mode?: FormMode;
|
|
17
|
+
/**
|
|
18
|
+
* `cards` draws each option as a box pressed whole, with its icon — the payment methods of
|
|
19
|
+
* a till, «Comer aquí / Para llevar» on a kiosk, the shipping of a shop: few options, chosen
|
|
20
|
+
* by a finger, where the dot of a list is too small a target. The grid fits as many as the
|
|
21
|
+
* width takes. It is still one radio group: arrows move, one is chosen.
|
|
22
|
+
*/
|
|
23
|
+
look?: "list" | "cards" | "swatches";
|
|
17
24
|
};
|
|
18
|
-
export declare function RadioGroup({ value, onChange, options, orientation, disabled, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, mode, }: RadioGroupProps): import("react").JSX.Element;
|
|
25
|
+
export declare function RadioGroup({ value, onChange, options, orientation, disabled, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, mode, look, }: RadioGroupProps): import("react").JSX.Element;
|
|
@@ -33,7 +33,33 @@ const mark = tv({
|
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* A product's variants: a colour as its swatch, a size as a small box with its word.
|
|
38
|
+
*
|
|
39
|
+
* Context: the third way to show one-of-few, for a shop's page and a catalogue's line — the
|
|
40
|
+
* colour is seen, not read, so the option IS the colour (`ChoiceOption.swatch`); a size has no
|
|
41
|
+
* colour, so it is its word in a box. Colour is never alone: each swatch is named by its label
|
|
42
|
+
* (and shows it on hover), and the chosen one is WRITTEN after the swatches («Roble»). One not
|
|
43
|
+
* in stock stays in sight, struck through — knowing it exists is part of the choice — and its
|
|
44
|
+
* `description` («Sin stock en tu talla») is its title. Still one radio group: arrows move.
|
|
45
|
+
*/
|
|
46
|
+
function Swatches({ value, onChange, options, id, labelledBy, describedBy, invalid, disabled, }) {
|
|
47
|
+
const colours = options.some((o) => o.swatch !== undefined);
|
|
48
|
+
const chosen = labelOf(options, value);
|
|
49
|
+
/* On what is drawn, not on the radio: React Aria's button does not pass a `title` on. */
|
|
50
|
+
const titleOf = (o) => o.description === undefined ? o.label : `${o.label} · ${o.description}`;
|
|
51
|
+
return (_jsxs(AriaRadioGroup, { id: id, "aria-labelledby": labelledBy, "aria-describedby": describedBy, value: value, onChange: (next) => onChange?.(next), orientation: "horizontal", isInvalid: invalid, isDisabled: disabled, "data-ui": "radio-group", "data-look": "swatches", className: "flex min-w-0 flex-wrap items-center gap-2 py-1", children: [options.map((o) => (_jsx(RadioField, { value: o.value, isDisabled: o.disabled, className: "flex", children: _jsx(RadioButton, { "data-ui": "radio-group.swatch", className: ({ isSelected, isFocusVisible, isDisabled }) => `relative flex shrink-0 cursor-pointer items-center justify-center transition-colors duration-(--duration-instant) ${o.swatch === undefined
|
|
52
|
+
? `h-(--size-control-md) min-w-(--size-control-md) rounded-ui-control border px-3 text-meta font-medium ${isSelected
|
|
53
|
+
? "border-primary bg-primary/6 text-ink ring-1 ring-primary"
|
|
54
|
+
: "border-line-strong bg-surface text-ink hover:border-ink/40"}`
|
|
55
|
+
: `size-(--size-control-md) rounded-pill border-2 p-0.5 ${isSelected
|
|
56
|
+
? "border-primary"
|
|
57
|
+
: "border-transparent hover:border-line-strong"}`} ${isFocusVisible ? "outline-2 outline-offset-2 outline-primary" : ""} ${isDisabled ? "cursor-not-allowed text-muted" : ""}`, children: ({ isDisabled }) => (_jsxs(_Fragment, { children: [o.swatch === undefined ? (_jsx("span", { title: titleOf(o), className: isDisabled ? "line-through" : "", children: o.label })) : (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, title: titleOf(o), className: "size-full rounded-pill border border-ink/15", style: { background: o.swatch } }), _jsx("span", { className: "sr-only", children: o.label })] })), isDisabled && o.swatch !== undefined ? (
|
|
58
|
+
/* Struck through, not hidden: a colour out of stock is still a colour that
|
|
59
|
+
exists. */
|
|
60
|
+
_jsx("span", { "aria-hidden": true, className: "absolute inset-x-1 top-1/2 h-0.5 -rotate-45 rounded-pill bg-ink/55" })) : null] })) }) }, o.value))), colours && chosen !== null ? (_jsx("span", { "aria-hidden": true, "data-ui": "radio-group.chosen", className: "ml-1 text-meta text-muted", children: chosen })) : null] }));
|
|
61
|
+
}
|
|
62
|
+
export function RadioGroup({ value, onChange, options, orientation = "vertical", disabled = false, id: ownId, describedBy: ownDescribedBy, invalid: ownInvalid, mode, look = "list", }) {
|
|
37
63
|
const { id, labelledBy, describedBy, invalid } = useFieldIds({
|
|
38
64
|
id: ownId,
|
|
39
65
|
describedBy: ownDescribedBy,
|
|
@@ -41,6 +67,17 @@ export function RadioGroup({ value, onChange, options, orientation = "vertical",
|
|
|
41
67
|
});
|
|
42
68
|
if (useFormMode(mode) === "read")
|
|
43
69
|
return _jsx(ReadValue, { value: labelOf(options, value) });
|
|
70
|
+
if (look === "swatches") {
|
|
71
|
+
return (_jsx(Swatches, { value: value, onChange: onChange, options: options, id: id, labelledBy: labelledBy, describedBy: describedBy, invalid: invalid, disabled: disabled }));
|
|
72
|
+
}
|
|
73
|
+
if (look === "cards") {
|
|
74
|
+
return (_jsx(AriaRadioGroup, { id: id, "aria-labelledby": labelledBy, "aria-describedby": describedBy, value: value, onChange: (next) => onChange?.(next), isInvalid: invalid, isDisabled: disabled, "data-ui": "radio-group", "data-look": "cards", className: "grid min-w-0 grid-cols-(--grid-tiles-sm) gap-2", children: options.map((o) => {
|
|
75
|
+
const Icon = o.icon;
|
|
76
|
+
return (_jsx(RadioField, { value: o.value, isDisabled: o.disabled, className: "flex min-w-0", children: _jsx(RadioButton, { "data-ui": "radio-group.card", className: ({ isSelected, isFocusVisible, isDisabled }) => `relative flex min-h-(--size-control-lg) w-full min-w-0 cursor-pointer flex-col items-start gap-1 rounded-ui-record-card border p-3 text-left transition-colors duration-(--duration-instant) ${isSelected
|
|
77
|
+
? "border-primary bg-primary/6 ring-1 ring-primary"
|
|
78
|
+
: "border-line-strong bg-surface hover:border-ink/40"} ${isFocusVisible ? "outline-2 outline-offset-2 outline-primary" : ""} ${isDisabled ? "cursor-not-allowed opacity-45" : ""}`, children: (state) => (_jsxs(_Fragment, { children: [_jsx("span", { className: `absolute top-3 right-3 ${mark(state)}`, children: _jsx("span", { className: `size-1.5 rounded-pill bg-surface transition-transform duration-(--duration-instant) ${state.isSelected ? "scale-100" : "scale-0"}` }) }), Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, className: `size-(--size-icon-lg) ${state.isSelected ? "text-primary" : "text-muted"}`, strokeWidth: 1.75 })), _jsx("span", { className: "min-w-0 pr-6 text-body font-medium text-ink", children: o.label }), o.description === undefined ? null : (_jsx("span", { className: "min-w-0 text-micro text-muted", children: o.description }))] })) }) }, o.value));
|
|
79
|
+
}) }));
|
|
80
|
+
}
|
|
44
81
|
return (_jsx(AriaRadioGroup, { id: id, "aria-labelledby": labelledBy, "aria-describedby": describedBy, value: value, onChange: (next) => onChange?.(next), orientation: orientation, isInvalid: invalid, isDisabled: disabled,
|
|
45
82
|
/* `py-2` puts the first label on the same line a text input's would sit on, so the
|
|
46
83
|
field does not look shorter than its neighbours in the same row. */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const STAR: {
|
|
2
|
+
readonly sm: "size-(--size-icon-sm)";
|
|
3
|
+
readonly md: "size-(--size-icon-md)";
|
|
4
|
+
readonly lg: "size-(--size-icon-lg)";
|
|
5
|
+
};
|
|
6
|
+
export type RatingProps = {
|
|
7
|
+
/** The average shown (`4.5`), or the stars given when it asks. 0 is «sin calificar». */
|
|
8
|
+
value: number;
|
|
9
|
+
/** How many stars. Five by default. */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** How many opinions the average comes from — written after it: «4,5 (128)». */
|
|
12
|
+
count?: number;
|
|
13
|
+
/** Present = it asks: a star per radio, arrows move. Absent = it shows. */
|
|
14
|
+
onChange?: (next: number) => void;
|
|
15
|
+
/** The group's name when it is not inside a `Field` and not «Calificación». */
|
|
16
|
+
label?: string;
|
|
17
|
+
size?: keyof typeof STAR;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Stars: an average of opinions shown (a product, a supplier, a technician), or the opinion
|
|
21
|
+
* asked (a survey, closing a ticket).
|
|
22
|
+
*
|
|
23
|
+
* Context: `Priority` is the sibling — Odoo's three stars of urgency, whole, no figure. This is
|
|
24
|
+
* the other question, «how good»: an average, so it draws half stars, and the FIGURE beside
|
|
25
|
+
* them, because «4,5» is read where four and a half stars are only estimated; and how many
|
|
26
|
+
* opinions, because 5 out of 2 is not 4,6 out of 900. Shown, it is one image with one name —
|
|
27
|
+
* «Calificación: 4,5 de 5, 128 opiniones» — so it is never colour alone. Asked, it is a radio
|
|
28
|
+
* group named by its `Field`, one tab stop and the arrows inside; in read mode it is shown.
|
|
29
|
+
* In `warn` like `Priority`: the gold is the screen's primary action.
|
|
30
|
+
*/
|
|
31
|
+
export declare function Rating({ value, max, count, onChange, label, size }: RatingProps): import("react").JSX.Element;
|
|
32
|
+
export {};
|