@aurea-uds/native 0.68.0 → 0.69.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/menu.js +5 -2
- package/dist/navigation.js +7 -3
- package/dist/theme.d.ts +13 -1
- package/dist/theme.js +17 -3
- package/package.json +2 -2
package/dist/menu.js
CHANGED
|
@@ -31,7 +31,7 @@ import { canto, criarFolha, estadoAcessivel, letraDoToken } from "./estilos.js";
|
|
|
31
31
|
import { NaSuperficie } from "./superficie.js";
|
|
32
32
|
import { Icon } from "./icon.js";
|
|
33
33
|
import { Text } from "./text.js";
|
|
34
|
-
import { ForaDaMarca, useTokensDoApp } from "./theme.js";
|
|
34
|
+
import { ForaDaMarca, useDirecaoRtl, useTokensDoApp } from "./theme.js";
|
|
35
35
|
import { useReduceMotion, driverNativo } from "./movimento.js";
|
|
36
36
|
// ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
37
37
|
// A folha
|
|
@@ -436,6 +436,9 @@ function Linha({ ctx, papel, rotulo, icone, marca, estado, inativo = false, dest
|
|
|
436
436
|
function LinhaDeSubmenu({ ctx, def, aberto, inativo, alternar, children }) {
|
|
437
437
|
const { tf, s } = ctx;
|
|
438
438
|
const reduzir = useReduceMotion();
|
|
439
|
+
// Na escrita da direita para a esquerda a seta se espelha (aponta para onde se lê) e o giro de abrir continua o mesmo,
|
|
440
|
+
// como na referência do celular (13/11/2026).
|
|
441
|
+
const rtl = useDirecaoRtl();
|
|
439
442
|
const giro = React.useRef(new Animated.Value(aberto ? 1 : 0)).current;
|
|
440
443
|
const antes = React.useRef(aberto);
|
|
441
444
|
React.useEffect(() => {
|
|
@@ -453,6 +456,6 @@ function LinhaDeSubmenu({ ctx, def, aberto, inativo, alternar, children }) {
|
|
|
453
456
|
laco.start();
|
|
454
457
|
return () => laco.stop();
|
|
455
458
|
}, [aberto, reduzir, giro, tf.size.durationFast, tf.easing.easeStandard]);
|
|
456
|
-
const seta = (_jsx(Animated.View, { style: { transform: [{ rotate: giro.interpolate({ inputRange: [0, 1], outputRange: ["0deg", "90deg"] }) }] }, children: _jsx(Icon, { name: "caret-right", size: "sm", color: tf.color.mutedForeground }) }));
|
|
459
|
+
const seta = (_jsx(Animated.View, { style: { transform: [{ scaleX: rtl ? -1 : 1 }, { rotate: giro.interpolate({ inputRange: [0, 1], outputRange: ["0deg", "90deg"] }) }] }, children: _jsx(Icon, { name: "caret-right", size: "sm", color: tf.color.mutedForeground }) }));
|
|
457
460
|
return (_jsxs(View, { children: [aberto ? _jsx(View, { pointerEvents: "none", style: s.fundoDoSubmenu }) : null, _jsx(Linha, { ctx: ctx, papel: "menuitem", rotulo: def.label, icone: def.leadingIcon, estado: { expanded: aberto }, inativo: inativo, final: seta, aoTocar: alternar }), aberto ? children : null] }));
|
|
458
461
|
}
|
package/dist/navigation.js
CHANGED
|
@@ -41,7 +41,7 @@ import { Card } from "./layout.js";
|
|
|
41
41
|
import { FilaRolante } from "./rolagem.js";
|
|
42
42
|
import { IndicadorQueDesliza, useFilaQueDesliza } from "./deslize.js";
|
|
43
43
|
import { Text } from "./text.js";
|
|
44
|
-
import { useAureaStrings, useAureaTokens } from "./theme.js";
|
|
44
|
+
import { useAureaStrings, useAureaTokens, useDirecaoRtl } from "./theme.js";
|
|
45
45
|
// Sem `SafeAreaProvider` nem medida da abertura: nenhum recuo.
|
|
46
46
|
const SEM_RECUO = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
47
47
|
const folha = criarFolha((t) => ({
|
|
@@ -561,6 +561,9 @@ export function Topbar(props) {
|
|
|
561
561
|
*/
|
|
562
562
|
export function NavList({ items, chevron = "caret-right", style, ...rest }) {
|
|
563
563
|
const t = useAureaTokens();
|
|
564
|
+
// Na escrita da direita para a esquerda a seta PADRÃO se espelha e aponta para onde se lê, como na referência do
|
|
565
|
+
// celular (que também só espelha a dela: o desenho que o app passa em `chevron` fica como veio) — 13/11/2026.
|
|
566
|
+
const espelhar = useDirecaoRtl() && chevron === "caret-right";
|
|
564
567
|
const s = folha(t);
|
|
565
568
|
return (_jsx(View, { accessibilityRole: "list", style: [s.lista, style], ...rest, children: items.map((it) => {
|
|
566
569
|
// 🔴 DUAS COISAS QUE O CONSUMIDOR MEDIU EM 17/09/2026, e as duas moram nesta linha.
|
|
@@ -587,8 +590,9 @@ export function NavList({ items, chevron = "caret-right", style, ...rest }) {
|
|
|
587
590
|
: it.icon && _jsx(Icon, { name: it.icon, size: "md", color: t.color.foreground }), _jsxs(View, { style: s.linhaTexto, children: [typeof it.label === "string"
|
|
588
591
|
? _jsx(Text, { size: "sm", weight: 500, numberOfLines: 1, children: it.label }) : it.label, it.description != null && (typeof it.description === "string"
|
|
589
592
|
? _jsx(Text, { size: "xs", tone: "muted", numberOfLines: 1, children: it.description })
|
|
590
|
-
: it.description)] }), it.indicators && it.indicators.length > 0 && (_jsx(View, { style: s.sinais, children: it.indicators.map((x) => (_jsx(View, { accessibilityLabel: x.label, children: _jsx(Icon, { name: x.icon, size: "sm", color: t.color.mutedForeground }) }, x.label))) })), valorEhTexto && _jsx(Text, { size: "sm", tone: "muted", children: it.value }), temAcao && chevron
|
|
591
|
-
|
|
593
|
+
: it.description)] }), it.indicators && it.indicators.length > 0 && (_jsx(View, { style: s.sinais, children: it.indicators.map((x) => (_jsx(View, { accessibilityLabel: x.label, children: _jsx(Icon, { name: x.icon, size: "sm", color: t.color.mutedForeground }) }, x.label))) })), valorEhTexto && _jsx(Text, { size: "sm", tone: "muted", children: it.value }), temAcao && chevron && (espelhar
|
|
594
|
+
? _jsx(View, { style: { transform: [{ scaleX: -1 }] }, children: _jsx(Icon, { name: chevron, size: "sm", color: t.color.mutedForeground }) })
|
|
595
|
+
: _jsx(Icon, { name: chevron, size: "sm", color: t.color.mutedForeground }))] }));
|
|
592
596
|
return (_jsxs(View, { role: "listitem", style: [s.linha, it.disabled && { opacity: t.size.opacityDisabled }], children: [temAcao ? (_jsx(Pressable, { onPress: it.onPress, disabled: it.disabled, accessibilityRole: "link", ...estadoAcessivel({ disabled: !!it.disabled }), style: s.linhaMiolo, children: miolo })) : (_jsx(View, { accessible: true, ...estadoAcessivel({ disabled: !!it.disabled }), style: s.linhaMiolo, children: miolo })), !valorEhTexto && it.value != null ? it.value : null] }, it.id));
|
|
593
597
|
}) }));
|
|
594
598
|
}
|
package/dist/theme.d.ts
CHANGED
|
@@ -69,11 +69,23 @@ export type AureaProviderProps = {
|
|
|
69
69
|
* o alvo nativo desenha, não das 200 chaves de 124 componentes da web.
|
|
70
70
|
*/
|
|
71
71
|
strings?: AureaStrings;
|
|
72
|
+
/**
|
|
73
|
+
* Para que lado a escrita corre (13/11/2026) — o mesmo nome e os mesmos valores do `AureaProvider` da web. Ausente, vale
|
|
74
|
+
* o do aparelho (`I18nManager.isRTL`), como na referência do celular. O sistema já vira a linha inteira na escrita da
|
|
75
|
+
* direita para a esquerda; o que a Aurea vira por isto são as setas que apontam para um lado (a da `NavList`, a do
|
|
76
|
+
* submenu), para que apontem para onde se lê. Um provedor dentro de outro sem `direction` herda o de fora.
|
|
77
|
+
*/
|
|
78
|
+
direction?: "ltr" | "rtl";
|
|
72
79
|
/** Avisado quando o modo CONTROLADO recebe um pedido de troca — é o app que decide. */
|
|
73
80
|
onThemeChange?: (t: AureaThemeName) => void;
|
|
74
81
|
onDensityChange?: (d: AureaDensity) => void;
|
|
75
82
|
};
|
|
76
|
-
export declare function AureaProvider({ children, theme, density, brand, defaultTheme, defaultDensity, fontFamilies, icons, strings, onThemeChange, onDensityChange, }: AureaProviderProps): React.JSX.Element;
|
|
83
|
+
export declare function AureaProvider({ children, theme, density, brand, defaultTheme, defaultDensity, fontFamilies, icons, strings, direction, onThemeChange, onDensityChange, }: AureaProviderProps): React.JSX.Element;
|
|
84
|
+
/**
|
|
85
|
+
* Interno: `true` quando a escrita corre da direita para a esquerda — a do `AureaProvider` mais próximo que disse
|
|
86
|
+
* `direction` ou, sem nenhum, a do aparelho (`I18nManager.isRTL`), como o `useIsRTL` da referência do celular.
|
|
87
|
+
*/
|
|
88
|
+
export declare function useDirecaoRtl(): boolean;
|
|
77
89
|
/** Os dois eixos e como trocá-los. Mesma forma do hook homônimo de `@aurea-uds/react`. */
|
|
78
90
|
export declare function useAureaTheme(): AureaThemeControl;
|
|
79
91
|
/** 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useColorScheme } from "react-native";
|
|
3
|
+
import { I18nManager, useColorScheme } from "react-native";
|
|
4
4
|
import { IconRegistryProvider } from "./icon.js";
|
|
5
5
|
import { comOpacidade } from "./estilos.js";
|
|
6
6
|
import { defaultStrings } from "./strings.js";
|
|
@@ -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, brand, defaultTheme, defaultDensity, fontFamilies, icons, strings, onThemeChange, onDensityChange, }) {
|
|
15
|
+
export function AureaProvider({ children, theme, density, brand, defaultTheme, defaultDensity, fontFamilies, icons, strings, direction, 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);
|
|
@@ -52,11 +52,25 @@ export function AureaProvider({ children, theme, density, brand, defaultTheme, d
|
|
|
52
52
|
}), [temaEfetivo, densidadeEfetiva, setTheme, setDensity, fontFamilies, strings, brand]);
|
|
53
53
|
// O registro de ícones fica num contexto PRÓPRIO: ele não muda quando o tema muda, e juntá-lo
|
|
54
54
|
// ao valor do tema faria toda árvore que só desenha ícone re-renderizar na troca de tema.
|
|
55
|
-
const
|
|
55
|
+
const comIcones = icons
|
|
56
56
|
? _jsx(IconRegistryProvider, { registry: icons, children: children })
|
|
57
57
|
: children;
|
|
58
|
+
// A direção num contexto PRÓPRIO, como o registro de ícones: as peças que refazem o tema por dentro (o cartão
|
|
59
|
+
// `contrast`, a faixa fora da marca) não precisam saber dela. Sem `direction`, nada se monta e vale a de fora.
|
|
60
|
+
const conteudo = direction
|
|
61
|
+
? _jsx(DirecaoContext.Provider, { value: direction, children: comIcones })
|
|
62
|
+
: comIcones;
|
|
58
63
|
return _jsx(Contexto.Provider, { value: valor, children: conteudo });
|
|
59
64
|
}
|
|
65
|
+
const DirecaoContext = React.createContext(null);
|
|
66
|
+
/**
|
|
67
|
+
* Interno: `true` quando a escrita corre da direita para a esquerda — a do `AureaProvider` mais próximo que disse
|
|
68
|
+
* `direction` ou, sem nenhum, a do aparelho (`I18nManager.isRTL`), como o `useIsRTL` da referência do celular.
|
|
69
|
+
*/
|
|
70
|
+
export function useDirecaoRtl() {
|
|
71
|
+
const d = React.useContext(DirecaoContext);
|
|
72
|
+
return d ? d === "rtl" : I18nManager.isRTL;
|
|
73
|
+
}
|
|
60
74
|
// Fora do provider os dois hooks LEVANTAM, em vez de devolverem um padrão. É decisão, e o
|
|
61
75
|
// motivo é o defeito que o padrão silencioso produz: um app inteiro desenhado no tema errado,
|
|
62
76
|
// sem nada acusando. Na web o equivalente não existe porque lá o CSS pinta de qualquer jeito;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurea-uds/native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.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.69.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@react-native-community/datetimepicker": ">=8",
|