@aurea-uds/native 0.46.0 → 0.48.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/dist/actions.d.ts +12 -2
- package/dist/actions.js +21 -5
- package/dist/display.d.ts +6 -1
- package/dist/display.js +8 -3
- package/dist/estilos.d.ts +21 -0
- package/dist/estilos.js +14 -1
- package/dist/index.d.ts +1 -1
- package/dist/theme.d.ts +10 -2
- package/dist/theme.js +5 -4
- package/dist/tokens.d.ts +8 -1
- package/dist/tokens.js +9 -4
- package/package.json +2 -2
package/dist/actions.d.ts
CHANGED
|
@@ -47,6 +47,16 @@ export interface ButtonProps extends Omit<PressableProps, "children" | "style">
|
|
|
47
47
|
* "Link copiado" pelo `ToastHost`, e dizer ao leitor de tela.
|
|
48
48
|
*/
|
|
49
49
|
share?: AureaShareData;
|
|
50
|
+
/**
|
|
51
|
+
* O brilho (ADR-0086, 28/10/2026), o mesmo da web: no botão principal (`appearance="solid" tone="brand"`), uma
|
|
52
|
+
* sombra difusa embaixo, na cor dele a 40%. É acabamento que o app escolhe. Nos outros botões, não desenha nada.
|
|
53
|
+
*/
|
|
54
|
+
glow?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* O fio (ADR-0086), o mesmo da web: em volta do botão de fundo suave (`outline`, que no "sem linha" é o tom a 16%), o
|
|
57
|
+
* tom a 30%, por dentro — a sombra por dentro do `aroDoEstilo`, que não muda a medida. Nos outros, não desenha nada.
|
|
58
|
+
*/
|
|
59
|
+
ring?: boolean;
|
|
50
60
|
}
|
|
51
61
|
/** O que o `Button share` compartilha (GAR-14). Os nomes são os da web. */
|
|
52
62
|
export interface AureaShareData {
|
|
@@ -64,7 +74,7 @@ export interface AureaShareData {
|
|
|
64
74
|
* lida por ninguém. Aqui não há o dilema, então não há o par `aria-disabled` — um só basta.
|
|
65
75
|
*/
|
|
66
76
|
export declare function Button(props: ButtonProps): React.JSX.Element;
|
|
67
|
-
export interface LinkButtonProps extends Omit<ButtonProps, "appearance" | "fullWidth"> {
|
|
77
|
+
export interface LinkButtonProps extends Omit<ButtonProps, "appearance" | "fullWidth" | "glow" | "ring"> {
|
|
68
78
|
}
|
|
69
79
|
/** Botão-texto sem recuo nem caixa, alinhado com o texto em volta. O `LinkButton` da referência. */
|
|
70
80
|
export declare function LinkButton(props: LinkButtonProps): React.JSX.Element;
|
|
@@ -93,7 +103,7 @@ export declare function IconButton(props: IconButtonProps): React.JSX.Element;
|
|
|
93
103
|
*/
|
|
94
104
|
export declare function folgaDoToque(t: AureaTokens, size?: AureaButtonSize): number;
|
|
95
105
|
/** Fechado: sem `appearance` e sem `tone`, porque a cor é a do glifo. */
|
|
96
|
-
export interface ThemeToggleProps extends Omit<IconButtonProps, "name" | "label" | "onPress" | "appearance" | "tone" | "share"> {
|
|
106
|
+
export interface ThemeToggleProps extends Omit<IconButtonProps, "name" | "label" | "onPress" | "appearance" | "tone" | "share" | "glow" | "ring"> {
|
|
97
107
|
}
|
|
98
108
|
export declare function ThemeToggle(props: ThemeToggleProps): React.JSX.Element;
|
|
99
109
|
export interface CloseButtonProps {
|
package/dist/actions.js
CHANGED
|
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
// do Lote 3. Aparência sem consumidor é a ADR-0034 ("ter a variante não é usar").
|
|
23
23
|
import * as React from "react";
|
|
24
24
|
import { AccessibilityInfo, Platform, Pressable, Share, View } from "react-native";
|
|
25
|
-
import { canto, comOpacidade, criarFolha, misturaOpaca, preenchimento, REACAO_AO_TOQUE, estadoAcessivel } from "./estilos.js";
|
|
25
|
+
import { brilhoDoBotao, canto, comOpacidade, criarFolha, fioDoAcabamento, misturaOpaca, preenchimento, REACAO_AO_TOQUE, estadoAcessivel } from "./estilos.js";
|
|
26
26
|
import { Icon } from "./icon.js";
|
|
27
27
|
import { Text } from "./text.js";
|
|
28
28
|
import { AvisosContext, useAureaStrings, useAureaTheme, useAureaTokens, useSobreAMarca } from "./theme.js";
|
|
@@ -218,8 +218,21 @@ function useToqueComShare(share, onPress) {
|
|
|
218
218
|
export function Button(props) {
|
|
219
219
|
return _jsx(CorpoDoBotao, { ...props });
|
|
220
220
|
}
|
|
221
|
+
/** Os acabamentos (ADR-0086) do `Button` e do `IconButton`: o brilho só no principal, o fio só no de fundo suave. A marca
|
|
222
|
+
* no navegador (`dataSet`) é a mesma da web (`data-glow`, `data-ring`), e a varredura do site reconhece o fio. */
|
|
223
|
+
function acabamentoDoBotao(t, glow, ring, appearance, tone, disabled, corDoTexto) {
|
|
224
|
+
const comBrilho = !!glow && appearance === "solid" && tone === "brand" && !disabled;
|
|
225
|
+
const comFio = !!ring && appearance === "outline";
|
|
226
|
+
const acabamento = comBrilho || comFio
|
|
227
|
+
? { boxShadow: [...(comBrilho ? [brilhoDoBotao(t)] : []), ...(comFio ? [fioDoAcabamento(t, tone, corDoTexto)] : [])] }
|
|
228
|
+
: null;
|
|
229
|
+
const marcaDoAcabamento = glow !== undefined || ring !== undefined
|
|
230
|
+
? { dataSet: { ...(glow !== undefined ? { glow: String(glow) } : null), ...(ring !== undefined ? { ring: String(ring) } : null) } }
|
|
231
|
+
: {};
|
|
232
|
+
return { acabamento, marcaDoAcabamento };
|
|
233
|
+
}
|
|
221
234
|
/** O corpo do `Button`. `semRecuo` é só do `LinkButton`: sem recuo, sem borda e sem altura. */
|
|
222
|
-
function CorpoDoBotao({ children, appearance = "solid", tone = "neutral", size = "md", leadingIcon, trailingIcon, leading, trailing, icons, fullWidth = false, pressed, disabled, accessibilityLabel, semRecuo = false, share, onPress, ...rest }) {
|
|
235
|
+
function CorpoDoBotao({ children, appearance = "solid", tone = "neutral", size = "md", leadingIcon, trailingIcon, leading, trailing, icons, fullWidth = false, pressed, disabled, accessibilityLabel, semRecuo = false, share, glow, ring, onPress, ...rest }) {
|
|
223
236
|
const t = useAureaTokens();
|
|
224
237
|
const aoTocar = useToqueComShare(share, onPress);
|
|
225
238
|
const s = folha(t);
|
|
@@ -245,10 +258,11 @@ function CorpoDoBotao({ children, appearance = "solid", tone = "neutral", size =
|
|
|
245
258
|
...(semRecuo ? { height: undefined, paddingHorizontal: 0, borderWidth: 0 } : null),
|
|
246
259
|
}), [medida.altura, medida.recheio, medida.vao, appearance, cor.solido, cor.contorno, corDaBorda, fullWidth, semRecuo, marca, tone, t]);
|
|
247
260
|
const corDoTexto = appearance === "solid" ? cor.texto : corDaLetra(t, tone, appearance, marca, cor.sobre);
|
|
261
|
+
const { acabamento, marcaDoAcabamento } = acabamentoDoBotao(t, glow, ring, appearance, tone, disabled, corDoTexto);
|
|
248
262
|
return (_jsx(Pressable, { disabled: disabled, onPress: aoTocar, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, ...estadoAcessivel({ disabled: !!disabled, pressed }), style: ({ pressed: tocando }) => [
|
|
249
263
|
s.alvo, fullWidth && s.alvoLargura,
|
|
250
264
|
tocando && s.pressionado, disabled && s.inerte,
|
|
251
|
-
], ...rest, children: _jsxs(View, { style: [s.caixa, caixa], children: [leading ?? null, leadingIcon ? _jsx(Icon, { name: leadingIcon, size: ICONE[size], color: corDoTexto, icons: icons }) : null, typeof children === "string"
|
|
265
|
+
], ...rest, children: _jsxs(View, { style: [s.caixa, caixa, acabamento], ...marcaDoAcabamento, children: [leading ?? null, leadingIcon ? _jsx(Icon, { name: leadingIcon, size: ICONE[size], color: corDoTexto, icons: icons }) : null, typeof children === "string"
|
|
252
266
|
// E1 (25/09/2026): entrelinha NORMAL (1,5), como o rótulo do botão da referência
|
|
253
267
|
// (a folha do botão dela usa a entrelinha de cada degrau da escala). Era `none` (1,0), e a letra
|
|
254
268
|
// precisa de 1,3 em para caber inteira — a IBM Plex subia 1,025 e descia 0,275; a
|
|
@@ -292,7 +306,7 @@ export function folgaDoToque(t, size = "md") {
|
|
|
292
306
|
}
|
|
293
307
|
/** O corpo do `IconButton`. A cor própria do ícone (`corDoIcone`) é só do `ThemeToggle`: o
|
|
294
308
|
* `IconButton` público não tem cor solta, e dentro do cartão da marca ela não vale (a tinta vence). */
|
|
295
|
-
function BotaoDeIcone({ name, label, appearance = "ghost", tone = "neutral", size = "md", icons, pressed, disabled, corDoIcone, pesoDoIcone, share, onPress, ...comSobras }) {
|
|
309
|
+
function BotaoDeIcone({ name, label, appearance = "ghost", tone = "neutral", size = "md", icons, pressed, disabled, corDoIcone, pesoDoIcone, share, glow, ring, onPress, ...comSobras }) {
|
|
296
310
|
// Quem chama de JavaScript, sem o tipo, ainda pode mandar `leading`/`trailing`: elas não descem ao `Pressable`.
|
|
297
311
|
const { leading: _antes, trailing: _depois, ...rest } = comSobras;
|
|
298
312
|
const t = useAureaTokens();
|
|
@@ -303,6 +317,8 @@ function BotaoDeIcone({ name, label, appearance = "ghost", tone = "neutral", siz
|
|
|
303
317
|
const corDaBorda = marca?.tinta ?? t.color.border;
|
|
304
318
|
// O círculo tem a altura do botão do mesmo tamanho (o só-ícone da referência: `aspect-ratio: 1`).
|
|
305
319
|
const lado = MEDIDA[size](t.size).altura;
|
|
320
|
+
const corDaLetraDoIcone = corDoIcone && !marca ? corDoIcone : appearance === "solid" ? cor.texto : corDaLetra(t, tone, appearance, marca, cor.sobre);
|
|
321
|
+
const { acabamento, marcaDoAcabamento } = acabamentoDoBotao(t, glow, ring, appearance, tone, disabled, corDaLetraDoIcone);
|
|
306
322
|
const caixa = React.useMemo(() => ({
|
|
307
323
|
height: lado, width: lado, paddingHorizontal: 0,
|
|
308
324
|
...canto(t.size.radiusControl),
|
|
@@ -318,7 +334,7 @@ function BotaoDeIcone({ name, label, appearance = "ghost", tone = "neutral", siz
|
|
|
318
334
|
// nem numa coluna sem alinhamento. O alvo é o maior entre o desenho e o `targetMin`.
|
|
319
335
|
s.alvo, { width: Math.max(lado, t.size.targetMin), alignItems: "center" },
|
|
320
336
|
tocando && s.pressionado, disabled && s.inerte,
|
|
321
|
-
], ...rest, children: _jsx(View, { style: [s.caixa, caixa], children: _jsx(Icon, { name: name, size: ICONE[size], icons: icons, weight: pesoDoIcone, color:
|
|
337
|
+
], ...rest, children: _jsx(View, { style: [s.caixa, caixa, acabamento], ...marcaDoAcabamento, children: _jsx(Icon, { name: name, size: ICONE[size], icons: icons, weight: pesoDoIcone, color: corDaLetraDoIcone }) }) }));
|
|
322
338
|
}
|
|
323
339
|
export function ThemeToggle(props) {
|
|
324
340
|
const { theme, toggleTheme } = useAureaTheme();
|
package/dist/display.d.ts
CHANGED
|
@@ -61,9 +61,14 @@ export interface BadgeProps extends ViewProps {
|
|
|
61
61
|
/** O que o selo mostra quando `anchor` está em uso (aí `children` é o que ele decora). */
|
|
62
62
|
badgeContent?: React.ReactNode;
|
|
63
63
|
invisible?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* O fio (ADR-0086, 28/10/2026), o mesmo da web: em volta do selo que não é cheio, o tom a 30%, por dentro — a sombra
|
|
66
|
+
* por dentro do `aroDoEstilo`, que não muda a medida. No `solid`, não desenha nada.
|
|
67
|
+
*/
|
|
68
|
+
ring?: boolean;
|
|
64
69
|
children?: React.ReactNode;
|
|
65
70
|
}
|
|
66
|
-
export declare function Badge({ tone, emphasis, size, dot, count, max, showZero, leading, trailing, fit, anchor, badgeContent, invisible, children, style, ...rest }: BadgeProps): React.JSX.Element;
|
|
71
|
+
export declare function Badge({ tone, emphasis, size, dot, count, max, showZero, leading, trailing, fit, anchor, badgeContent, invisible, ring, children, style, ...rest }: BadgeProps): React.JSX.Element;
|
|
67
72
|
/** `Chip` é outro nome do `Badge` (GAR-20, 19/10/2026): o nome que a referência dá à mesma peça. Igual em tudo. */
|
|
68
73
|
export type ChipProps = BadgeProps;
|
|
69
74
|
/** `Chip` é outro nome do `Badge` (GAR-20, 19/10/2026): o nome que a referência dá à mesma peça. Igual em tudo. */
|
package/dist/display.js
CHANGED
|
@@ -25,7 +25,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
25
25
|
import * as React from "react";
|
|
26
26
|
import { Image, View } from "react-native";
|
|
27
27
|
import { IconButton, folgaDoToque } from "./actions.js";
|
|
28
|
-
import { canto, acentoDoTom, comOpacidade, criarFolha, fundoDoTom, misturaOpaca, preenchimentoDoTom } from "./estilos.js";
|
|
28
|
+
import { canto, acentoDoTom, comOpacidade, criarFolha, fioDoAcabamento, fundoDoTom, misturaOpaca, preenchimentoDoTom } from "./estilos.js";
|
|
29
29
|
import { Card } from "./layout.js";
|
|
30
30
|
import { gravidadeDoEstado } from "./strings.js";
|
|
31
31
|
import { Icon } from "./icon.js";
|
|
@@ -112,7 +112,7 @@ export const formatarContagem = (count, max = 99) => count > max ? `${max}+` : S
|
|
|
112
112
|
const LETRA_DO_SELO = (t, size) => size === "lg" ? { fontSize: t.size.textBase, lineHeight: t.size.space6 }
|
|
113
113
|
: size === "md" ? { fontSize: t.size.textSm, lineHeight: t.size.space5 }
|
|
114
114
|
: { fontSize: t.size.textXs, lineHeight: t.size.space4 };
|
|
115
|
-
export function Badge({ tone = "neutral", emphasis = "soft", size = "md", dot, count, max = 99, showZero, leading, trailing, fit = "auto", anchor, badgeContent, invisible, children, style, ...rest }) {
|
|
115
|
+
export function Badge({ tone = "neutral", emphasis = "soft", size = "md", dot, count, max = 99, showZero, leading, trailing, fit = "auto", anchor, badgeContent, invisible, ring, children, style, ...rest }) {
|
|
116
116
|
const t = useAureaTokens();
|
|
117
117
|
const s = folha(t);
|
|
118
118
|
const categoria = ehCategoria(tone) ? coresDaCategoria(t)[tone] : null;
|
|
@@ -136,6 +136,10 @@ export function Badge({ tone = "neutral", emphasis = "soft", size = "md", dot, c
|
|
|
136
136
|
// azul no claro, desde a ADR-0076) — misturado ao texto, o amarelo virava mostarda só nesta peça. O nativo não tem
|
|
137
137
|
// marca (`data-brand`), então vale sempre.
|
|
138
138
|
: emphasis === "outline" && tone !== "primary" ? misturaOpaca(letra, t.color.foreground, 0.8) : letra;
|
|
139
|
+
// O fio (ADR-0086): o tom cheio a 30% — a categoria, que não tem tom de estado, usa a cor da letra dela.
|
|
140
|
+
const fio = ring && emphasis !== "solid"
|
|
141
|
+
? { boxShadow: [fioDoAcabamento(t, categoria ? "neutral" : tone, letra)] } : null;
|
|
142
|
+
const marcaDoFio = ring !== undefined ? { dataSet: { ring: String(ring) } } : {};
|
|
139
143
|
const numero = count != null ? formatarContagem(count, max) : undefined;
|
|
140
144
|
const miolo = anchor ? (numero ?? badgeContent) : (numero ?? children);
|
|
141
145
|
// Ponto puro: `dot` sem nada para mostrar. Aí o selo não tem conteúdo e ganha medida própria.
|
|
@@ -166,8 +170,9 @@ export function Badge({ tone = "neutral", emphasis = "soft", size = "md", dot, c
|
|
|
166
170
|
anchor && posicaoDaAncora(anchor, folga, medida?.w ?? minimo, medida?.h ?? minimo),
|
|
167
171
|
soPonto && { width: ladoDoPonto, height: ladoDoPonto, paddingHorizontal: 0, paddingVertical: 0,
|
|
168
172
|
backgroundColor: acento, borderWidth: anchor ? t.size.borderWidth : 0 },
|
|
173
|
+
fio,
|
|
169
174
|
style,
|
|
170
|
-
], ...(anchor ? { accessibilityElementsHidden: true,
|
|
175
|
+
], ...marcaDoFio, ...(anchor ? { accessibilityElementsHidden: true,
|
|
171
176
|
importantForAccessibility: "no-hide-descendants" } : rest), children: [dot && !soPonto && _jsx(View, { style: [s.ponto, { backgroundColor: corDoTexto }] }), !soPonto && leading, typeof miolo === "string" || typeof miolo === "number"
|
|
172
177
|
? _jsx(Text, { weight: 500, style: [LETRA_DO_SELO(t, size),
|
|
173
178
|
// Preso, a linha cabe no mínimo menos o fio: a letra fica no meio do círculo de 16.
|
package/dist/estilos.d.ts
CHANGED
|
@@ -96,6 +96,27 @@ export declare const aroDoEstilo: (t: AureaTokens, cor: string, vezes?: number)
|
|
|
96
96
|
readonly color: string;
|
|
97
97
|
readonly inset: true;
|
|
98
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* OS ACABAMENTOS (ADR-0086, 28/10/2026), os mesmos da web — só quando o app escolhe.
|
|
101
|
+
* O FIO (`ring`): em volta do fundo suave, o tom CHEIO a 30%, por dentro — uma largura de borda, pelo `aroDoEstilo`. Sem
|
|
102
|
+
* tom (o neutro), a cor da letra, como o `currentColor` da web.
|
|
103
|
+
*/
|
|
104
|
+
export declare const fioDoAcabamento: (t: AureaTokens, tom: TomDeCor | "brand", corDaLetra: string) => {
|
|
105
|
+
readonly offsetX: 0;
|
|
106
|
+
readonly offsetY: 0;
|
|
107
|
+
readonly blurRadius: 0;
|
|
108
|
+
readonly spreadDistance: number;
|
|
109
|
+
readonly color: string;
|
|
110
|
+
readonly inset: true;
|
|
111
|
+
};
|
|
112
|
+
/** O BRILHO (`glow`): embaixo do botão principal, a cor dele a 40%, difusa — 4 para baixo e 14 de desfoque (12 + 2). */
|
|
113
|
+
export declare const brilhoDoBotao: (t: AureaTokens) => {
|
|
114
|
+
readonly offsetX: 0;
|
|
115
|
+
readonly offsetY: number;
|
|
116
|
+
readonly blurRadius: number;
|
|
117
|
+
readonly spreadDistance: 0;
|
|
118
|
+
readonly color: string;
|
|
119
|
+
};
|
|
99
120
|
/**
|
|
100
121
|
* A MARCA do estilo escolhido, para o navegador (`react-native-web`): o `dataSet` vira o mesmo atributo da web
|
|
101
122
|
* (`data-current-style`, `data-segment-style`, `data-timeline-style`), e a varredura do site reconhece o estilo de aro como
|
package/dist/estilos.js
CHANGED
|
@@ -20,7 +20,9 @@ import { StyleSheet } from "react-native";
|
|
|
20
20
|
export function criarFolha(descrever) {
|
|
21
21
|
const cache = new Map();
|
|
22
22
|
return (t) => {
|
|
23
|
-
|
|
23
|
+
// A MARCA entra na chave (passo C, 28/10/2026): ela muda a cor sem mudar o par (tema, densidade), e a chave antiga
|
|
24
|
+
// devolveria a folha da marca de antes. São 2 temas × 3 densidades × 13 marcas: teto de 78 entradas por componente.
|
|
25
|
+
const chave = `${t.theme}:${t.density}:${t.brand ?? ""}`;
|
|
24
26
|
let folha = cache.get(chave);
|
|
25
27
|
if (!folha) {
|
|
26
28
|
folha = StyleSheet.create(descrever(t));
|
|
@@ -148,6 +150,17 @@ export const letraDoAmarelo = (t) => t.theme === "light" ? t.color.primaryEmphas
|
|
|
148
150
|
* quando o app o escolhe. Quem cobra que ele não escape daqui: `sem-linha.test.tsx`.
|
|
149
151
|
*/
|
|
150
152
|
export const aroDoEstilo = (t, cor, vezes = 1.5) => ({ offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: vezes * t.size.borderWidth, color: cor, inset: true });
|
|
153
|
+
/**
|
|
154
|
+
* OS ACABAMENTOS (ADR-0086, 28/10/2026), os mesmos da web — só quando o app escolhe.
|
|
155
|
+
* O FIO (`ring`): em volta do fundo suave, o tom CHEIO a 30%, por dentro — uma largura de borda, pelo `aroDoEstilo`. Sem
|
|
156
|
+
* tom (o neutro), a cor da letra, como o `currentColor` da web.
|
|
157
|
+
*/
|
|
158
|
+
export const fioDoAcabamento = (t, tom, corDaLetra) => aroDoEstilo(t, comOpacidade(tom === "primary" || tom === "brand" ? t.color.primary : tom === "success" ? t.color.success
|
|
159
|
+
: tom === "danger" ? t.color.destructive : tom === "info" ? t.color.info : tom === "warning" ? t.color.warning
|
|
160
|
+
: corDaLetra, 0.3), 1);
|
|
161
|
+
/** O BRILHO (`glow`): embaixo do botão principal, a cor dele a 40%, difusa — 4 para baixo e 14 de desfoque (12 + 2). */
|
|
162
|
+
export const brilhoDoBotao = (t) => ({ offsetX: 0, offsetY: t.size.space1, blurRadius: t.size.space3 + t.size.space05, spreadDistance: 0,
|
|
163
|
+
color: comOpacidade(t.color.primary, 0.4) });
|
|
151
164
|
/**
|
|
152
165
|
* A MARCA do estilo escolhido, para o navegador (`react-native-web`): o `dataSet` vira o mesmo atributo da web
|
|
153
166
|
* (`data-current-style`, `data-segment-style`, `data-timeline-style`), e a varredura do site reconhece o estilo de aro como
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { AureaProvider, useAureaTheme, useAureaTokens } from "./theme.js";
|
|
|
2
2
|
export type { AureaProviderProps, AureaThemeControl } from "./theme.js";
|
|
3
3
|
export { BottomNavProvider, useBottomNavSpace } from "./barranav.js";
|
|
4
4
|
export { resolverTokens } from "./tokens.js";
|
|
5
|
-
export type { AureaDensity, AureaFontFamilies, AureaFontInput, AureaFontScale, AureaShadow, AureaThemeName, AureaTokens, } from "./tokens.js";
|
|
5
|
+
export type { AureaBrand, AureaDensity, AureaFontFamilies, AureaFontInput, AureaFontScale, AureaShadow, AureaThemeName, AureaTokens, } from "./tokens.js";
|
|
6
6
|
export { criarFolha, comOpacidade } from "./estilos.js";
|
|
7
7
|
export { Text, Heading, Paragraph, Code } from "./text.js";
|
|
8
8
|
export type { TextProps, AureaTextFont, AureaTextLeading, AureaTextSize, AureaTextTone, AureaTextWeight, AureaTextType, HeadingProps, ParagraphProps, CodeProps, AureaTypographyColor, AureaTypographyWeight, AureaTypographyAlign, } from "./text.js";
|
package/dist/theme.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AureaToastManager } from "./toast.js";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { type AureaIconRegistry } from "./icon.js";
|
|
4
4
|
import { type AureaStrings } from "./strings.js";
|
|
5
|
-
import { type AureaDensity, type AureaFontFamilies, type AureaThemeName, type AureaTokens } from "./tokens.js";
|
|
5
|
+
import { type AureaBrand, type AureaDensity, type AureaFontFamilies, type AureaThemeName, type AureaTokens } from "./tokens.js";
|
|
6
6
|
export type AureaThemeControl = {
|
|
7
7
|
theme: AureaThemeName;
|
|
8
8
|
density: AureaDensity;
|
|
@@ -16,6 +16,14 @@ export type AureaProviderProps = {
|
|
|
16
16
|
theme?: AureaThemeName;
|
|
17
17
|
/** Controlado: quando presente, manda, e `setDensity` só avisa. */
|
|
18
18
|
density?: AureaDensity;
|
|
19
|
+
/**
|
|
20
|
+
* A marca (passo C das cores, ADR-0085): `"ember"` ou uma das 11 da paleta da 1.0 (`"sun"`, `"honey"`, `"orange"`,
|
|
21
|
+
* `"magenta"`, `"violet"`, `"indigo"`, `"cobalt"`, `"cyan"`, `"turquoise"`, `"emerald"`, `"lime"`). Ausente, é a Aurea
|
|
22
|
+
* Gold. O mesmo nome do `data-brand` da web. A marca muda só cor — tipo, canto, densidade e ícone continuam da Aurea.
|
|
23
|
+
*
|
|
24
|
+
* <AureaProvider brand="cobalt">
|
|
25
|
+
*/
|
|
26
|
+
brand?: AureaBrand;
|
|
19
27
|
/**
|
|
20
28
|
* Tema inicial do modo não controlado. Ausente, segue o **aparelho** (`useColorScheme`) até
|
|
21
29
|
* alguém chamar `setTheme` — a partir daí a escolha da pessoa manda e o sistema não a desfaz.
|
|
@@ -65,7 +73,7 @@ export type AureaProviderProps = {
|
|
|
65
73
|
onThemeChange?: (t: AureaThemeName) => void;
|
|
66
74
|
onDensityChange?: (d: AureaDensity) => void;
|
|
67
75
|
};
|
|
68
|
-
export declare function AureaProvider({ children, theme, density, defaultTheme, defaultDensity, fontFamilies, icons, strings, onThemeChange, onDensityChange, }: AureaProviderProps): React.JSX.Element;
|
|
76
|
+
export declare function AureaProvider({ children, theme, density, brand, defaultTheme, defaultDensity, fontFamilies, icons, strings, onThemeChange, onDensityChange, }: AureaProviderProps): React.JSX.Element;
|
|
69
77
|
/** Os dois eixos e como trocá-los. Mesma forma do hook homônimo de `@aurea-uds/react`. */
|
|
70
78
|
export declare function useAureaTheme(): AureaThemeControl;
|
|
71
79
|
/** Os tokens já resolvidos para o par (tema, densidade) atual. Não tem par na web: lá o CSS resolve. */
|
package/dist/theme.js
CHANGED
|
@@ -12,7 +12,7 @@ const DENSIDADE_PADRAO = "comfortable";
|
|
|
12
12
|
// `dark` é o que o catálogo inteiro declara no `<html>`, e o que a identidade da Aurea assume.
|
|
13
13
|
const TEMA_PADRAO = "dark";
|
|
14
14
|
const Contexto = React.createContext(null);
|
|
15
|
-
export function AureaProvider({ children, theme, density, defaultTheme, defaultDensity, fontFamilies, icons, strings, onThemeChange, onDensityChange, }) {
|
|
15
|
+
export function AureaProvider({ children, theme, density, brand, defaultTheme, defaultDensity, fontFamilies, icons, strings, onThemeChange, onDensityChange, }) {
|
|
16
16
|
const doAparelho = useColorScheme();
|
|
17
17
|
const [temaInterno, setTemaInterno] = React.useState(defaultTheme ?? null);
|
|
18
18
|
const [densidadeInterna, setDensidadeInterna] = React.useState(defaultDensity ?? DENSIDADE_PADRAO);
|
|
@@ -41,14 +41,15 @@ export function AureaProvider({ children, theme, density, defaultTheme, defaultD
|
|
|
41
41
|
// Alternar é sobre o que está NA TELA — a mesma regra que o hook da web escreveu.
|
|
42
42
|
toggleTheme: () => setTheme(temaEfetivo === "dark" ? "light" : "dark"),
|
|
43
43
|
},
|
|
44
|
-
tokens: resolverTokens(temaEfetivo, densidadeEfetiva, fontFamilies),
|
|
44
|
+
tokens: resolverTokens(temaEfetivo, densidadeEfetiva, fontFamilies, brand),
|
|
45
45
|
// As frases NÃO dependem do par (tema, densidade), mas moram no mesmo `useMemo` de propósito:
|
|
46
46
|
// um contexto a mais só se paga quando ele muda em outra hora, e este muda junto — é a mesma
|
|
47
47
|
// conta que o cabeçalho deste arquivo já fez para os dois contextos que viraram um.
|
|
48
48
|
strings: strings ?? defaultStrings,
|
|
49
49
|
fontes: fontFamilies,
|
|
50
|
+
marca: brand ?? null,
|
|
50
51
|
raiz: null,
|
|
51
|
-
}), [temaEfetivo, densidadeEfetiva, setTheme, setDensity, fontFamilies, strings]);
|
|
52
|
+
}), [temaEfetivo, densidadeEfetiva, setTheme, setDensity, fontFamilies, strings, brand]);
|
|
52
53
|
// O registro de ícones fica num contexto PRÓPRIO: ele não muda quando o tema muda, e juntá-lo
|
|
53
54
|
// ao valor do tema faria toda árvore que só desenha ícone re-renderizar na troca de tema.
|
|
54
55
|
const conteudo = icons
|
|
@@ -156,7 +157,7 @@ export function TemaDentro({ tema, children }) {
|
|
|
156
157
|
const v = usar("TemaDentro");
|
|
157
158
|
const valor = React.useMemo(() => ({
|
|
158
159
|
...v,
|
|
159
|
-
tokens: resolverTokens(tema, v.controle.density, v.fontes),
|
|
160
|
+
tokens: resolverTokens(tema, v.controle.density, v.fontes, v.marca),
|
|
160
161
|
raiz: v.raiz ?? v,
|
|
161
162
|
}), [v, tema]);
|
|
162
163
|
if (v.tokens.theme === tema)
|
package/dist/tokens.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export type AureaThemeName = "dark" | "light";
|
|
2
2
|
export type AureaDensity = "compact" | "comfortable" | "spacious";
|
|
3
|
+
/**
|
|
4
|
+
* As marcas (passo C das cores, ADR-0085): a Aurea Ember e as 11 da paleta da 1.0. Sem marca, é a Aurea Gold, a padrão.
|
|
5
|
+
* Os nomes são os mesmos do `data-brand` da web.
|
|
6
|
+
*/
|
|
7
|
+
export type AureaBrand = "ember" | "sun" | "honey" | "orange" | "magenta" | "violet" | "indigo" | "cobalt" | "cyan" | "turquoise" | "emerald" | "lime";
|
|
3
8
|
/** Sombra no formato do `boxShadow` do RN 0.76+, que a Etapa 2 mediu ser 1:1 com o CSS. */
|
|
4
9
|
export type AureaShadow = {
|
|
5
10
|
offsetX: number;
|
|
@@ -34,6 +39,8 @@ export type AureaFontInput = Partial<Record<"400" | "500" | "600" | "700" | "800
|
|
|
34
39
|
export type AureaTokens = {
|
|
35
40
|
theme: AureaThemeName;
|
|
36
41
|
density: AureaDensity;
|
|
42
|
+
/** A marca dos tokens; `null` é a Aurea Gold, a padrão. */
|
|
43
|
+
brand: AureaBrand | null;
|
|
37
44
|
/** Cores em **hex**, e só hex. Ver a nota sobre a ADR-0027 abaixo. */
|
|
38
45
|
color: Record<string, string>;
|
|
39
46
|
/** Todo token numérico, em dp — espaçamento, raio, tipografia, altura, duração, camada. */
|
|
@@ -81,4 +88,4 @@ export type AureaFontFamilies = {
|
|
|
81
88
|
* Android. Passar `p3` a um `style` faz a cor ser DESCARTADA, em silêncio. Os campos `p3` e
|
|
82
89
|
* `oklch` seguem no alvo de tokens como intenção registrada; aqui eles não passam.
|
|
83
90
|
*/
|
|
84
|
-
export declare function resolverTokens(theme: AureaThemeName, density: AureaDensity, fontFamilies?: AureaFontFamilies): AureaTokens;
|
|
91
|
+
export declare function resolverTokens(theme: AureaThemeName, density: AureaDensity, fontFamilies?: AureaFontFamilies, brand?: AureaBrand | null): AureaTokens;
|
package/dist/tokens.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// • 1 nome existe no `base` E no tema — `warning400`. No CSS o tema ganha.
|
|
16
16
|
// Logo: base < tema < densidade. Inverter isso devolve o app inteiro numa densidade só, e em
|
|
17
17
|
// silêncio — o teste `tokens.test.ts` prova a ordem contra esse defeito.
|
|
18
|
-
import { base, themes, densities, tracking, shadowLayers, REM_EM_DP } from "@aurea-uds/tokens/native";
|
|
18
|
+
import { base, themes, densities, brands, tracking, shadowLayers, REM_EM_DP } from "@aurea-uds/tokens/native";
|
|
19
19
|
const ehCor = (v) => typeof v === "object" && v !== null && "hex" in v;
|
|
20
20
|
const ehSombra = (v) => typeof v === "object" && v !== null && "blurRadius" in v;
|
|
21
21
|
// Um objeto por grupo, na ordem em que ganham. `Object.assign` sobre um alvo novo — não sobre o
|
|
@@ -67,8 +67,13 @@ function normalizarEscala(entrada, familiaCrua) {
|
|
|
67
67
|
* Android. Passar `p3` a um `style` faz a cor ser DESCARTADA, em silêncio. Os campos `p3` e
|
|
68
68
|
* `oklch` seguem no alvo de tokens como intenção registrada; aqui eles não passam.
|
|
69
69
|
*/
|
|
70
|
-
export function resolverTokens(theme, density, fontFamilies) {
|
|
71
|
-
|
|
70
|
+
export function resolverTokens(theme, density, fontFamilies, brand) {
|
|
71
|
+
// A MARCA vem depois do tema e antes da densidade, como na web (ela só muda cor). O gerador já emite o que ela muda
|
|
72
|
+
// sobre CADA tema — os tokens dela e os do tema que dependem do primário —, porque em JS não há o `var()` do CSS.
|
|
73
|
+
const marca = brand ? brands[brand]?.[theme] : undefined;
|
|
74
|
+
if (brand && !marca)
|
|
75
|
+
throw new Error(`Aurea: a marca "${brand}" não existe nos tokens`);
|
|
76
|
+
const cru = mesclar(base, themes[theme], marca ?? {}, densities[density]);
|
|
72
77
|
const color = {};
|
|
73
78
|
const size = {};
|
|
74
79
|
const shadow = {};
|
|
@@ -97,5 +102,5 @@ export function resolverTokens(theme, density, fontFamilies) {
|
|
|
97
102
|
code: normalizarEscala(fontFamilies?.code, texto.fontCode ?? "System"),
|
|
98
103
|
heading: normalizarEscala(fontFamilies?.heading ?? fontFamilies?.ui, texto.fontHeading ?? texto.fontUi ?? "System"),
|
|
99
104
|
};
|
|
100
|
-
return { theme, density, color, size, font, shadow, shadowLayers: { ...shadowLayers }, easing, tracking: { ...tracking }, remInDp: REM_EM_DP };
|
|
105
|
+
return { theme, density, brand: brand ?? null, color, size, font, shadow, shadowLayers: { ...shadowLayers }, easing, tracking: { ...tracking }, remInDp: REM_EM_DP };
|
|
101
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurea-uds/native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "A Aurea UDS para React Native: o provider de tema e densidade, os componentes e os ícones do Phosphor sobre react-native-svg.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aurea",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"NOTICE"
|
|
56
56
|
],
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@aurea-uds/tokens": "^0.
|
|
58
|
+
"@aurea-uds/tokens": "^0.48.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@react-native-community/datetimepicker": ">=8",
|