@aurea-uds/react 0.62.0 → 0.63.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 +47 -47
- package/dist/graph.js +3 -0
- package/dist/inputs-client.d.ts +2 -1
- package/dist/inputs-client.js +2 -2
- package/dist/markup.d.ts +3 -1
- package/dist/markup.js +3 -2
- package/dist/system.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
# @aurea-uds/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The React components of the **Aurea Universal Design System**.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
pnpm add @aurea-uds/react @aurea-uds/core @aurea-uds/fonts @aurea-uds/icons
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Usage
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Load the fonts **before** the stylesheet — the core does not embed any font.
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
14
|
import "@aurea-uds/fonts/css";
|
|
15
15
|
import "@aurea-uds/core/css";
|
|
16
|
-
import {AureaProvider, Button
|
|
16
|
+
import {AureaProvider, Button} from "@aurea-uds/react";
|
|
17
17
|
|
|
18
18
|
export default () => (
|
|
19
|
-
<AureaProvider spriteUrl="/aurea-icons.svg"
|
|
20
|
-
<Button variant="primary">
|
|
19
|
+
<AureaProvider spriteUrl="/aurea-icons.svg">
|
|
20
|
+
<Button variant="primary">Send</Button>
|
|
21
21
|
</AureaProvider>
|
|
22
22
|
);
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
`spriteUrl`
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
`spriteUrl` points to the file from `@aurea-uds/icons` — copy it to where your app serves static files.
|
|
26
|
+
It is configuration, so it lives on the provider, not on each component that draws an icon. The default
|
|
27
|
+
strings are in English; `strings={ptBR}` swaps them for the Portuguese ones.
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Import by category
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
The main entry point works, but each category is also an entry point of its own, so you can take one
|
|
32
|
+
part of the system without the rest:
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
import {Button} from "@aurea-uds/react/actions";
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
`Button`
|
|
38
|
+
Six modules bring an optional engine and therefore stay **out of the main entry point** — importing a
|
|
39
|
+
`Button` must never pull in a dependency you did not install:
|
|
40
40
|
|
|
41
|
-
|
|
|
41
|
+
| Import | Requires you to install |
|
|
42
42
|
|---|---|
|
|
43
|
-
| `@aurea-uds/react/code-editor` | `codemirror`
|
|
43
|
+
| `@aurea-uds/react/code-editor` | `codemirror` and the `@codemirror/*` packages |
|
|
44
44
|
| `@aurea-uds/react/data-grid` | `@tanstack/react-table` |
|
|
45
45
|
| `@aurea-uds/react/qrcode` | `qr` |
|
|
46
46
|
| `@aurea-uds/react/calendar` | `react-day-picker` |
|
|
47
47
|
| `@aurea-uds/react/chart` | `recharts` |
|
|
48
48
|
| `@aurea-uds/react/graph` | `@xyflow/react` |
|
|
49
49
|
|
|
50
|
-
###
|
|
50
|
+
### The graph (`DependencyGraph`) and its three optional pieces
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
Each one is loaded only when its feature is requested. Without it, the graph warns once in the console
|
|
53
|
+
and carries on without the feature — it does not break the screen.
|
|
54
54
|
|
|
55
|
-
|
|
|
55
|
+
| For | Install |
|
|
56
56
|
|---|---|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
57
|
+
| layered, tree or circular layout (`layout="layered"`, `"tree"`, `"radial"`) | `elkjs` |
|
|
58
|
+
| the edge that routes around a node after manual arranging | `@tisoap/react-flow-smart-edge` |
|
|
59
|
+
| an image of the graph (`toPng()`, `toSvg()`) | `modern-screenshot` |
|
|
60
60
|
|
|
61
|
-
**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
**Layout off the main thread (`layoutWorker`).** On a large graph, the layout can freeze the screen for a
|
|
62
|
+
few seconds. The graph accepts a Web Worker that the app creates — every bundler creates workers its own
|
|
63
|
+
way, so the app is the one that supplies it. Aurea publishes the worker on its own entry point,
|
|
64
|
+
`@aurea-uds/react/graph-worker`, which brings the `elkjs` worker (the optional peer) along — the app does
|
|
65
|
+
not import the engine separately. In Vite:
|
|
66
66
|
|
|
67
67
|
```js
|
|
68
68
|
import TrabalhadorDoMapa from "@aurea-uds/react/graph-worker?worker";
|
|
@@ -70,42 +70,42 @@ import TrabalhadorDoMapa from "@aurea-uds/react/graph-worker?worker";
|
|
|
70
70
|
<DependencyGraph layout="layered" layoutWorker={() => new TrabalhadorDoMapa()} … />
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
In any other bundler, the way that always works: copy `node_modules/elkjs/lib/elk-worker.min.js` to the
|
|
74
|
+
app's public folder and pass `layoutWorker={() => new Worker("/elk-worker.min.js")}`.
|
|
75
75
|
|
|
76
76
|
## Hooks
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Four are public, and they are the part of the API that **has no page in the catalog** — the catalog
|
|
79
|
+
documents components, and a hook is not a component. Until that changes, this is where they are written
|
|
80
|
+
down.
|
|
81
81
|
|
|
82
82
|
```js
|
|
83
83
|
import {AureaProvider, useToast} from "@aurea-uds/react";
|
|
84
84
|
|
|
85
85
|
function BotaoSalvar() {
|
|
86
|
-
const toast = useToast(); //
|
|
86
|
+
const toast = useToast(); // inside AureaProvider
|
|
87
87
|
return <Button onClick={() => toast.add({
|
|
88
|
-
title: "
|
|
89
|
-
description: "
|
|
88
|
+
title: "Saved",
|
|
89
|
+
description: "Two files uploaded.",
|
|
90
90
|
type: "success", // info | success | warning | danger
|
|
91
|
-
})}>
|
|
91
|
+
})}>Save</Button>;
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
The stack draws itself: `AureaProvider` already mounts the toast viewport, so there is no `<Toaster/>` to
|
|
96
|
+
place and no second provider to install.
|
|
97
97
|
|
|
98
|
-
| Hook |
|
|
98
|
+
| Hook | What it returns |
|
|
99
99
|
|---|---|
|
|
100
|
-
| `useToast()` | `add({title, description, type})`,
|
|
101
|
-
| `useAureaTheme()` |
|
|
102
|
-
| `useAureaStrings()` |
|
|
103
|
-
| `useSpriteUrl()` |
|
|
100
|
+
| `useToast()` | `add({title, description, type})`, plus `close(id)` and the live list. The queue is Base UI's |
|
|
101
|
+
| `useAureaTheme()` | reads and changes **both** axes on `<html>`: `theme` (`dark`/`light`) and `density`. `theme` is `null` on the server — do not render what depends on the theme until it stops being `null` |
|
|
102
|
+
| `useAureaStrings()` | the string dictionary, merged with what you passed to the provider |
|
|
103
|
+
| `useSpriteUrl()` | where the icon sprite is being loaded from |
|
|
104
104
|
|
|
105
|
-
##
|
|
105
|
+
## Requirements
|
|
106
106
|
|
|
107
|
-
React 19
|
|
107
|
+
React 19 or newer. In React 19 `ref` is a regular prop, and the types depend on that.
|
|
108
108
|
|
|
109
|
-
##
|
|
109
|
+
## License
|
|
110
110
|
|
|
111
111
|
Apache-2.0.
|
package/dist/graph.js
CHANGED
|
@@ -88,6 +88,9 @@ const ESCALA_MINIMA = 0.1;
|
|
|
88
88
|
// do texto comum, e é ele que entra. Mais os 2 × 4px do fundo do rótulo (padrão do motor) e uma
|
|
89
89
|
// folga de 16px de cada lado para a linha aparecer antes e depois dele. Nunca encolhe abaixo de
|
|
90
90
|
// `VAO_X`: grafo sem rótulo sai idêntico ao de antes.
|
|
91
|
+
// ⚠ A MEDIDA É DA FONTE DE ANTES (anotado em 09/11/2026): a IBM Plex Sans saiu na 0.13.0, e a fonte do texto é a
|
|
92
|
+
// Inter desde a 0.39.0 (ADR-0077). O 0,6 não foi medido de novo com ela — trocar o número muda o arranjo do mapa,
|
|
93
|
+
// e isso é mudança de aparência, com imagem antes.
|
|
91
94
|
const FONTE_DO_ROTULO = 13, GLIFO_DO_ROTULO = 0.6, FUNDO_X = 8, FOLGA_X = 32;
|
|
92
95
|
const vaoEntreColunas = (edges) => Math.max(VAO_X, ...edges.map(e => e.label ? Math.ceil(e.label.length * FONTE_DO_ROTULO * GLIFO_DO_ROTULO) + FUNDO_X + FOLGA_X : 0));
|
|
93
96
|
const medidasDoNo = (texto) => texto === "lg"
|
package/dist/inputs-client.d.ts
CHANGED
|
@@ -316,7 +316,7 @@ export declare function OTPField({ length, value, defaultValue, onValueChange, m
|
|
|
316
316
|
variant?: "primary" | "secondary";
|
|
317
317
|
}): React.JSX.Element;
|
|
318
318
|
export type SegmentedControlSelectedStyle = "current" | "neutral" | "contrast" | "brand" | "ring" | "dot" | "emphasis";
|
|
319
|
-
export declare function SegmentedControl({ items, value, onChange, label, fullWidth, size, selectedStyle, wrap, orientation }: {
|
|
319
|
+
export declare function SegmentedControl({ items, value, onChange, label, fullWidth, size, selectedStyle, wrap, orientation, className }: {
|
|
320
320
|
items: Array<{
|
|
321
321
|
value: string;
|
|
322
322
|
label: ReactNode;
|
|
@@ -331,6 +331,7 @@ export declare function SegmentedControl({ items, value, onChange, label, fullWi
|
|
|
331
331
|
selectedStyle?: SegmentedControlSelectedStyle;
|
|
332
332
|
wrap?: boolean;
|
|
333
333
|
orientation?: "horizontal" | "vertical";
|
|
334
|
+
className?: string;
|
|
334
335
|
}): React.JSX.Element;
|
|
335
336
|
export interface ComboboxOption {
|
|
336
337
|
value: string;
|
package/dist/inputs-client.js
CHANGED
|
@@ -732,13 +732,13 @@ export function OTPField({ length, value, defaultValue, onValueChange, mask, dis
|
|
|
732
732
|
}
|
|
733
733
|
// O SITE B (aprovado pela bancada em 01/11/2026, os itens 3 e 8): `items[].icon` (o escolhido troca sozinho para a forma
|
|
734
734
|
// cheia), `size="2xl"` (segmento de 48), `wrap` (quebra linha, o trilho com canto 22) e `orientation="vertical"` (em pé).
|
|
735
|
-
export function SegmentedControl({ items, value, onChange, label, fullWidth, size = "md", selectedStyle, wrap, orientation = "horizontal" }) {
|
|
735
|
+
export function SegmentedControl({ items, value, onChange, label, fullWidth, size = "md", selectedStyle, wrap, orientation = "horizontal", className }) {
|
|
736
736
|
const s = useAureaStrings();
|
|
737
737
|
// S-04 (05/11/2026): o escolhido DESLIZA de um segmento ao outro, em vez de pular (`useDeslize`, no `internal`). Só na
|
|
738
738
|
// escolha: com `href` a troca é de página, e a página nova já nasce com o escolhido no lugar.
|
|
739
739
|
const fila = React.useRef(null);
|
|
740
740
|
useDeslize(fila, ".active", value);
|
|
741
|
-
const classe = cx("segmented", fullWidth && "segmented-full", size === "sm" && "segmented-sm", size === "lg" && "segmented-lg", size === "xl" && "segmented-xl", size === "2xl" && "segmented-2xl", wrap && orientation !== "vertical" && "segmented-wrap", orientation === "vertical" && "segmented-vertical");
|
|
741
|
+
const classe = cx("segmented", fullWidth && "segmented-full", size === "sm" && "segmented-sm", size === "lg" && "segmented-lg", size === "xl" && "segmented-xl", size === "2xl" && "segmented-2xl", wrap && orientation !== "vertical" && "segmented-wrap", orientation === "vertical" && "segmented-vertical", className);
|
|
742
742
|
const miolo = (i) => i.icon ? _jsxs(_Fragment, { children: [_jsx(Icon, { name: i.icon, weight: i.value === value ? "fill" : "regular" }), i.label] }) : i.label;
|
|
743
743
|
if (items.length > 0 && items.every(i => i.href != null))
|
|
744
744
|
return _jsx("nav", { className: classe, "data-segment-style": selectedStyle, "aria-label": label ?? s.optionsLabel, children: items.map(i => _jsx("a", { href: i.href, className: i.value === value ? "active" : undefined, "aria-current": i.value === value ? "page" : undefined, children: miolo(i) }, i.value)) });
|
package/dist/markup.d.ts
CHANGED
|
@@ -465,10 +465,12 @@ export declare function AspectRatio({ ratio, className, style, ...props }: HTMLA
|
|
|
465
465
|
export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>, RefAttributes<HTMLAnchorElement> {
|
|
466
466
|
/** Abre noutra aba e mostra a seta. */
|
|
467
467
|
external?: boolean;
|
|
468
|
+
/** O aviso que o leitor de tela ouve num link `external`. Padrão: "(opens in a new tab)". */
|
|
469
|
+
externalLabel?: string;
|
|
468
470
|
/** Não navega: sai sem `href` e com `aria-disabled`. */
|
|
469
471
|
disabled?: boolean;
|
|
470
472
|
}
|
|
471
|
-
export declare function Link({ external, disabled, href, target, rel, className, children, ...props }: LinkProps): React.JSX.Element;
|
|
473
|
+
export declare function Link({ external, externalLabel, disabled, href, target, rel, className, children, ...props }: LinkProps): React.JSX.Element;
|
|
472
474
|
export type ColorSwatchSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
473
475
|
export interface ColorSwatchProps extends HTMLAttributes<HTMLSpanElement>, RefAttributes<HTMLSpanElement> {
|
|
474
476
|
/** Qualquer cor do CSS: `#f0c200`, `oklch(…)`, `var(--primary)`. */
|
package/dist/markup.js
CHANGED
|
@@ -311,8 +311,9 @@ export function InputGroupAddon({ side = "start", layout = "inline", className,
|
|
|
311
311
|
// escreve o `padding-top: 56.25%` de 2015, ou esquece o `min-width: 0` que impede a caixa de
|
|
312
312
|
// estourar dentro de um grid.
|
|
313
313
|
export function AspectRatio({ ratio = 1, className, style, ...props }) { return _jsx("div", { className: cx("aspect-ratio", className), style: { aspectRatio: ratio, ...style }, ...props }); }
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
const AVISO_DE_NOVA_ABA = "(opens in a new tab)";
|
|
315
|
+
export function Link({ external, externalLabel, disabled, href, target, rel, className, children, ...props }) {
|
|
316
|
+
return _jsxs("a", { className: cx("link", className), href: disabled ? undefined : href, "aria-disabled": disabled || undefined, target: external ? target ?? "_blank" : target, rel: external ? rel ?? "noopener noreferrer" : rel, ...props, children: [children, external && _jsx("span", { className: "link-external", "aria-hidden": "true" }), external && _jsx("span", { className: "sr-only", children: " " + (externalLabel ?? AVISO_DE_NOVA_ABA) })] });
|
|
316
317
|
}
|
|
317
318
|
// Transparente quando o texto diz alfa abaixo de 1 (hex de 4 ou 8 dígitos, `rgba()`, `hsla()`…). Cor de token ou
|
|
318
319
|
// `oklch()` a marcação não lê: fica sem xadrez.
|
package/dist/system.js
CHANGED
|
@@ -60,7 +60,12 @@ export function AureaProvider({ children, strings, direction = "ltr", spriteUrl
|
|
|
60
60
|
// GAR-14: os avisos presos a um botão vivem num gerenciador do MÓDULO (ver `avisosAncorados`), então
|
|
61
61
|
// só o provedor de FORA monta o hospedeiro deles — com dois, cada aviso apareceria duas vezes.
|
|
62
62
|
const deFora = !React.useContext(DentroDoProviderContext);
|
|
63
|
-
|
|
63
|
+
// 2-C (a), 0.63.0: a REGIÃO DE AVISOS também é só do provedor de fora. Com um provedor dentro de outro, cada um montava
|
|
64
|
+
// a sua — duas regiões "Notifications" na página (o `landmark-unique` do axe). O de dentro não abre gerenciador nem
|
|
65
|
+
// região: o `useToast()` dele cai no gerenciador de fora, e o aviso aparece na pilha de fora (o `toastPlacement` do de
|
|
66
|
+
// dentro não vale).
|
|
67
|
+
const miolo = _jsxs(BaseTooltip.Provider, { children: [children, deFora && _jsx(AureaToastViewport, { placement: toastPlacement }), deFora && _jsx(BaseToast.Provider, { toastManager: avisosAncorados, children: _jsx(AvisosAncorados, {}) })] });
|
|
68
|
+
return _jsx(DentroDoProviderContext.Provider, { value: true, children: _jsx(StringsContext.Provider, { value: value, children: _jsx(SpriteContext.Provider, { value: spriteUrl, children: _jsx(PortalContext.Provider, { value: portalContainer, children: _jsx(ThemeContext.Provider, { value: tema, children: _jsx(DensityContext.Provider, { value: dens, children: _jsx(DirectionProvider, { direction: direction, children: deFora ? _jsx(BaseToast.Provider, { timeout: TEMPO_DO_AVISO, children: miolo }) : miolo }) }) }) }) }) }) });
|
|
64
69
|
}
|
|
65
70
|
// O esquema do sistema, para a preferência `"system"`. Sem `matchMedia` (servidor, jsdom), claro.
|
|
66
71
|
const ESQUEMA_ESCURO = "(prefers-color-scheme: dark)";
|