@aurea-uds/native 0.10.1 → 0.12.1

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/strings.js CHANGED
@@ -50,6 +50,8 @@ export const defaultStrings = {
50
50
  decrement: "Decrease",
51
51
  comboboxEmpty: "No results",
52
52
  comboboxClear: "Clear selection",
53
+ themeToDark: "Switch to dark theme",
54
+ themeToLight: "Switch to light theme",
53
55
  comboboxLoading: "Loading…",
54
56
  comboboxSearch: "Search",
55
57
  searchClear: "Clear search",
@@ -88,6 +90,8 @@ export const ptBR = {
88
90
  decrement: "Diminuir",
89
91
  comboboxEmpty: "Nenhum resultado",
90
92
  comboboxClear: "Limpar seleção",
93
+ themeToDark: "Mudar para o tema escuro",
94
+ themeToLight: "Mudar para o tema claro",
91
95
  comboboxLoading: "Carregando…",
92
96
  comboboxSearch: "Buscar",
93
97
  searchClear: "Limpar busca",
package/dist/text.d.ts CHANGED
@@ -9,7 +9,18 @@ export type AureaTextFont = "ui" | "editorial" | "code";
9
9
  /** O que a cor SIGNIFICA. Mesmo vocabulário do `tone` do Button (ADR-0044). */
10
10
  export type AureaTextTone = "default" | "muted" | "subtle" | "primary" | "link" | "danger" | "success" | "warning" | "info";
11
11
  export type AureaTextLeading = "none" | "tight" | "normal" | "relaxed";
12
+ /**
13
+ * O PAPEL do texto — B-02, 25/09/2026, no molde do `Typography` do HeroUI Native 1.0.10. Uma lista
14
+ * fechada: título 1–6, texto, texto pequeno, texto mínimo e código.
15
+ */
16
+ export type AureaTextType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body" | "body-sm" | "body-xs" | "code";
12
17
  export interface TextProps extends TextPropsRN {
18
+ /**
19
+ * O papel (B-02). Dá tamanho, peso, entrelinha e fonte de uma vez, com os números do HeroUI
20
+ * Native — os MESMOS da web, sem o degrau a mais do `size`. Uma opção solta passada junto
21
+ * (`size`, `weight`…) continua valendo por cima dele.
22
+ */
23
+ type?: AureaTextType;
13
24
  size?: AureaTextSize;
14
25
  weight?: AureaTextWeight;
15
26
  font?: AureaTextFont;
@@ -30,4 +41,30 @@ export interface TextProps extends TextPropsRN {
30
41
  * próprias. Pedir peso 600 por `fontWeight` devolveria o Regular sintetizado — **em silêncio**.
31
42
  * Quem escolhe a fonte aqui é o `fontFamily`, com o nome PostScript que o provider já resolveu.
32
43
  */
33
- export declare function Text({ size, weight, font, tone, leading, italic, align, tracking, style, ...rest }: TextProps): React.JSX.Element;
44
+ export declare function Text({ type, size, weight: pesoPedido, font: fontePedida, tone, leading, italic, align, tracking: trackingPedido, style, ...rest }: TextProps): React.JSX.Element;
45
+ export type AureaTypographyColor = "default" | "muted";
46
+ export type AureaTypographyWeight = "normal" | "medium" | "semibold" | "bold";
47
+ export type AureaTypographyAlign = "start" | "center" | "end" | "justify";
48
+ interface AureaTypographyBase extends Omit<TextPropsRN, "children"> {
49
+ color?: AureaTypographyColor;
50
+ weight?: AureaTypographyWeight;
51
+ /** `start`/`end` viram `left`/`right`, que o React Native já espelha em RTL (nota do HeroUI Native). */
52
+ align?: AureaTypographyAlign;
53
+ /** Uma linha só, cortada com reticências (`numberOfLines={1}`). */
54
+ truncate?: boolean;
55
+ children?: React.ReactNode;
56
+ }
57
+ export interface HeadingProps extends AureaTypographyBase {
58
+ type?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
59
+ }
60
+ /** Título. Marca `accessibilityRole="header"` sozinho, como o HeroUI Native. */
61
+ export declare function Heading({ type, accessibilityRole, ...rest }: HeadingProps): React.JSX.Element;
62
+ export interface ParagraphProps extends AureaTypographyBase {
63
+ type?: "body" | "body-sm" | "body-xs";
64
+ }
65
+ /** Parágrafo de texto corrido, em três tamanhos: 16, 14 e 12. */
66
+ export declare function Paragraph({ type, ...rest }: ParagraphProps): React.JSX.Element;
67
+ export type CodeProps = AureaTypographyBase;
68
+ /** Um trecho curto de código no meio da frase, com a fonte mono e o fundo do `code` da web. */
69
+ export declare function Code(props: CodeProps): React.JSX.Element;
70
+ export {};
package/dist/text.js CHANGED
@@ -66,6 +66,15 @@ const TAMANHO = {
66
66
  const ENTRELINHA = {
67
67
  none: "leadingNone", tight: "leadingTight", normal: "leadingNormal", relaxed: "leadingRelaxed",
68
68
  };
69
+ const titulo = (tamanho) => ({ tamanho, peso: 600, entrelinha: "leadingTight", fonte: "ui", junto: true });
70
+ const PAPEL = {
71
+ h1: titulo("text4xl"), h2: titulo("text3xl"), h3: titulo("text2xl"),
72
+ h4: titulo("textXl"), h5: titulo("textLg"), h6: titulo("textBase"),
73
+ body: { tamanho: "textBase", peso: 400, entrelinha: "leadingRelaxed", fonte: "ui" },
74
+ "body-sm": { tamanho: "textSm", peso: 400, entrelinha: "leadingRelaxed", fonte: "ui" },
75
+ "body-xs": { tamanho: "textXs", peso: 400, entrelinha: "leadingRelaxed", fonte: "ui" },
76
+ code: { tamanho: "textSm", peso: 400, entrelinha: "leadingNormal", fonte: "code" },
77
+ };
69
78
  const COR = {
70
79
  default: "foreground", muted: "mutedForeground", subtle: "subtleForeground",
71
80
  // ⚠ `primary` e `link` são o MESMO amarelo em matiz, e NÃO são intercambiáveis.
@@ -94,12 +103,22 @@ const folha = criarFolha((t) => {
94
103
  * próprias. Pedir peso 600 por `fontWeight` devolveria o Regular sintetizado — **em silêncio**.
95
104
  * Quem escolhe a fonte aqui é o `fontFamily`, com o nome PostScript que o provider já resolveu.
96
105
  */
97
- export function Text({ size = "md", weight = 400, font = "ui", tone = "default", leading = "normal", italic = false, align, tracking, style, ...rest }) {
106
+ export function Text({ type, size, weight: pesoPedido, font: fontePedida, tone = "default", leading, italic = false, align, tracking: trackingPedido, style, ...rest }) {
98
107
  const t = useAureaTokens();
99
108
  const s = folha(t);
100
109
  const sobreAMarca = useSobreAMarca();
110
+ // Sem `type`, os padrões de sempre (`md`, 400, `ui`, `normal`) — nada muda para quem já usa.
111
+ const papel = type ? PAPEL[type] : undefined;
112
+ const weight = pesoPedido ?? papel?.peso ?? 400;
113
+ const font = fontePedida ?? papel?.fonte ?? "ui";
114
+ const tracking = trackingPedido ?? (papel?.junto ? "tight" : undefined);
101
115
  const proprio = React.useMemo(() => {
102
- const fontSize = t.size[TAMANHO[size]] ?? t.size.textBase;
116
+ const fontSize = size
117
+ ? t.size[TAMANHO[size]] ?? t.size.textBase
118
+ : papel ? t.size[papel.tamanho] ?? t.size.textBase : t.size[TAMANHO.md];
119
+ const razao = leading
120
+ ? t.size[ENTRELINHA[leading]] ?? t.size.leadingNormal
121
+ : papel ? t.size[papel.entrelinha] ?? t.size.leadingNormal : t.size.leadingNormal;
103
122
  const escala = t.font[font];
104
123
  // O itálico é UMA fonte, não um estilo sintético: `fontStyle:"italic"` faria o sistema
105
124
  // inclinar o desenho reto, e o Plex tem itálico desenhado. Só o `ui` o tem — nos outros
@@ -109,13 +128,18 @@ export function Text({ size = "md", weight = 400, font = "ui", tone = "default",
109
128
  fontFamily: familia,
110
129
  fontSize,
111
130
  // `lineHeight` no RN é ABSOLUTO (dp), não múltiplo — os tokens de entrelinha são razão.
112
- lineHeight: fontSize * (t.size[ENTRELINHA[leading]] ?? t.size.leadingNormal),
131
+ lineHeight: fontSize * razao,
113
132
  // `letterSpacing` também é absoluto: o token é razão de `em` e multiplica o tamanho.
114
133
  // É a impedância que a Etapa 2 mediu e resolveu emitindo razão em vez de dp.
115
134
  ...(tracking ? { letterSpacing: fontSize * t.tracking[`tracking${tracking[0].toUpperCase()}${tracking.slice(1)}`] } : null),
116
135
  ...(align ? { textAlign: align } : null),
136
+ // O código leva a pele do `code` da web: fundo, canto e um recheio pequeno (HeroUI Native).
137
+ ...(type === "code" ? {
138
+ alignSelf: "flex-start", backgroundColor: t.color.surface2, borderRadius: t.size.radiusXs,
139
+ paddingHorizontal: t.size.space1, paddingVertical: t.size.space05,
140
+ } : null),
117
141
  };
118
- }, [t, size, weight, font, leading, italic, align, tracking]);
142
+ }, [t, type, papel, size, weight, font, leading, italic, align, tracking]);
119
143
  // 🔴 SOBRE UMA SUPERFÍCIE DA MARCA A COR É FORÇADA, e ela vence até o tom explícito.
120
144
  // Medido contra o `primary` nos dois temas: texto comum dá **1,83 no escuro**, esmaecido
121
145
  // **1,35**, e `danger` menos ainda. **Nenhum tom alcança os 4,5 da norma sobre o amarelo** —
@@ -126,3 +150,20 @@ export function Text({ size = "md", weight = 400, font = "ui", tone = "default",
126
150
  // ⚠ E `style` continua por último de propósito: quem passa cor à mão assume a conta.
127
151
  return _jsx(TextRN, { style: [s[tone], sobreAMarca && { color: sobreAMarca.tinta }, proprio, style], ...rest });
128
152
  }
153
+ const PESO = { normal: 400, medium: 500, semibold: 600, bold: 700 };
154
+ const ALINHA = { start: "left", center: "center", end: "right", justify: "justify" };
155
+ function papelDe(type, { color, weight, align, truncate, style, ...rest }) {
156
+ return (_jsx(Text, { ...rest, type: type, tone: color === "muted" ? "muted" : "default", weight: weight ? PESO[weight] : undefined, numberOfLines: truncate ? 1 : rest.numberOfLines, style: [align ? { textAlign: ALINHA[align] } : null, style] }));
157
+ }
158
+ /** Título. Marca `accessibilityRole="header"` sozinho, como o HeroUI Native. */
159
+ export function Heading({ type = "h1", accessibilityRole = "header", ...rest }) {
160
+ return papelDe(type, { accessibilityRole, ...rest });
161
+ }
162
+ /** Parágrafo de texto corrido, em três tamanhos: 16, 14 e 12. */
163
+ export function Paragraph({ type = "body", ...rest }) {
164
+ return papelDe(type, rest);
165
+ }
166
+ /** Um trecho curto de código no meio da frase, com a fonte mono e o fundo do `code` da web. */
167
+ export function Code(props) {
168
+ return papelDe("code", props);
169
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurea-uds/native",
3
- "version": "0.10.1",
3
+ "version": "0.12.1",
4
4
  "description": "A Aurea UDS para React Native: o provider de tema e densidade, os componentes e os ícones do Carbon sobre react-native-svg.",
5
5
  "keywords": [
6
6
  "aurea",
@@ -51,7 +51,7 @@
51
51
  "NOTICE"
52
52
  ],
53
53
  "dependencies": {
54
- "@aurea-uds/tokens": "^0.10.1"
54
+ "@aurea-uds/tokens": "^0.12.1"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@react-native-community/datetimepicker": ">=8",