@aurea-uds/native 0.17.0 → 0.18.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.
@@ -43,20 +43,38 @@ export interface SkeletonProps {
43
43
  * aqui): anunciar "caixa" três vezes enquanto a tela carrega não ajuda ninguém.
44
44
  */
45
45
  export declare function Skeleton({ width, height, radius, style, testID }: SkeletonProps): React.JSX.Element;
46
+ /** O tom da barra: a mesma lista fechada do `tone` do `Button`. Pausado é `neutral`; falha é `danger`. */
47
+ export type AureaProgressTone = "brand" | "neutral" | "success" | "warning" | "danger" | "info";
46
48
  export interface ProgressProps {
47
- /** 0 a 100. Fora disso é grampeado, como na web (`Math.max(0, Math.min(100, value))`). */
48
- value: number;
49
+ /**
50
+ * 0 a 100. Fora disso é grampeado, como na web (`Math.max(0, Math.min(100, value))`).
51
+ * **Sem `value`, a barra é indeterminada** (AN-07): o total ainda não se sabe, e um pedaço corre
52
+ * pelo trilho, no lugar de um 0% que parece parado.
53
+ */
54
+ value?: number;
49
55
  label?: string;
56
+ /**
57
+ * O texto de apoio, no alto à direita — o `ProgressBar.Output` do HeroUI: velocidade, tempo que
58
+ * falta, bytes. Em texto, ele vai junto no `accessibilityValue`. É texto: a barra é um elemento
59
+ * só para o leitor de tela, e coisa tocável dentro dela some no iPhone (`check 43`).
60
+ */
61
+ detail?: React.ReactNode;
62
+ tone?: AureaProgressTone;
50
63
  style?: StyleProp<ViewStyle>;
51
64
  testID?: string;
52
65
  }
53
66
  /**
54
- * A barra determinada. Só ela — **não há variante indeterminada**, nem na web.
67
+ * A barra de progresso — determinada, ou indeterminada quando não há `value` (AN-07, 03/10/2026).
55
68
  *
56
69
  * O papel é `progressbar` e o valor vai no `accessibilityValue`: sem isso o leitor de tela
57
70
  * anuncia que existe uma barra e não diz em quanto ela está, que é a única informação que ela tem.
71
+ * Sem total, não há `now` — a barra não finge um 0%.
72
+ *
73
+ * Sem total, um pedaço de 2/5 corre de -100% a 350% da própria largura em 1,5 s, na curva do
74
+ * `ProgressBar` do HeroUI 3.2.6 — os mesmos números da web. Quando a pessoa pede menos movimento
75
+ * ele não corre: a barra inteira, apagada, e nunca um pedaço parado, que leria como 40% feito.
58
76
  */
59
- export declare function Progress({ value, label, style, testID }: ProgressProps): React.JSX.Element;
77
+ export declare function Progress({ value, label, detail, tone, style, testID }: ProgressProps): React.JSX.Element;
60
78
  export type AureaAlertVariant = "info" | "success" | "warning" | "danger";
61
79
  /** Mesmos quatro glifos do `feedback-client.tsx:43`. */
62
80
  export declare const ICONE_DA_VARIANTE: Readonly<Record<AureaAlertVariant, IconName>>;
package/dist/feedback.js CHANGED
@@ -43,6 +43,11 @@ const folha = criarFolha((t) => ({
43
43
  // ── Progress ───────────────────────────────────────────────────────────────────────────────
44
44
  trilho: { height: 8, borderRadius: t.size.radiusFull, backgroundColor: t.color.surface3, overflow: "hidden" },
45
45
  preenchimento: { height: "100%", borderRadius: t.size.radiusFull, backgroundColor: t.color.primary },
46
+ // AN-07: a caixa com o texto de apoio em cima — a grade do HeroUI, `gap-1` até o trilho, a saída
47
+ // à direita em algarismos de largura igual.
48
+ campoProgresso: { gap: t.size.space1 },
49
+ apoioProgresso: { alignSelf: "flex-end" },
50
+ algarismos: { fontVariant: ["tabular-nums"] },
46
51
  // ── Alert ──────────────────────────────────────────────────────────────────────────────────
47
52
  // A web usa GRADE de três trilhas (ícone, corpo, ação). Aqui é linha de flex com o corpo
48
53
  // `flex:1` — mesmo resultado, e `display:grid` não existe no RN (a mesma nota do `Grid`).
@@ -152,16 +157,67 @@ export function Skeleton({ width, height, radius, style, testID }) {
152
157
  style,
153
158
  ] }));
154
159
  }
160
+ const COR_DO_TOM = {
161
+ brand: "primary", neutral: "mutedForeground", success: "success",
162
+ warning: "warning", danger: "destructive", info: "info",
163
+ };
155
164
  /**
156
- * A barra determinada. Só ela — **não há variante indeterminada**, nem na web.
165
+ * A barra de progresso — determinada, ou indeterminada quando não há `value` (AN-07, 03/10/2026).
157
166
  *
158
167
  * O papel é `progressbar` e o valor vai no `accessibilityValue`: sem isso o leitor de tela
159
168
  * anuncia que existe uma barra e não diz em quanto ela está, que é a única informação que ela tem.
169
+ * Sem total, não há `now` — a barra não finge um 0%.
170
+ *
171
+ * Sem total, um pedaço de 2/5 corre de -100% a 350% da própria largura em 1,5 s, na curva do
172
+ * `ProgressBar` do HeroUI 3.2.6 — os mesmos números da web. Quando a pessoa pede menos movimento
173
+ * ele não corre: a barra inteira, apagada, e nunca um pedaço parado, que leria como 40% feito.
160
174
  */
161
- export function Progress({ value, label, style, testID }) {
162
- const s = folha(useAureaTokens());
163
- const pct = Math.max(0, Math.min(100, value));
164
- return (_jsx(View, { testID: testID, accessible: true, accessibilityRole: "progressbar", accessibilityLabel: label, accessibilityValue: { min: 0, max: 100, now: pct }, style: [s.trilho, style], children: _jsx(View, { style: [s.preenchimento, { width: `${pct}%` }] }) }));
175
+ export function Progress({ value, label, detail, tone = "brand", style, testID }) {
176
+ const t = useAureaTokens();
177
+ const s = folha(t);
178
+ const reduzir = useReduceMotion();
179
+ const semTotal = value == null || Number.isNaN(value);
180
+ const pct = semTotal ? undefined : Math.max(0, Math.min(100, value));
181
+ const cor = t.color[COR_DO_TOM[tone]];
182
+ const temApoio = detail != null && detail !== false && detail !== "";
183
+ const emTexto = temApoio && (typeof detail === "string" || typeof detail === "number") ? String(detail) : undefined;
184
+ // A largura do trilho, para o pedaço saber quanto andar. O `translateX` do RN não aceita
185
+ // porcentagem, e a do CSS é da própria peça — aqui ela vira conta: 2/5 do trilho.
186
+ const [largura, setLargura] = React.useState(0);
187
+ const corrida = React.useRef(new Animated.Value(0)).current;
188
+ const corre = semTotal && reduzir === false && largura > 0;
189
+ React.useEffect(() => {
190
+ // `reduzir === false`, e não `!reduzir`: enquanto é `null` o sistema ainda não respondeu.
191
+ if (!corre)
192
+ return;
193
+ corrida.setValue(0);
194
+ const laco = Animated.loop(Animated.timing(corrida, {
195
+ toValue: 1, duration: 1500, easing: Easing.bezier(0.65, 0, 0.35, 1), useNativeDriver: driverNativo(),
196
+ }));
197
+ laco.start();
198
+ return () => laco.stop();
199
+ }, [corrida, corre, largura]);
200
+ const pedaco = largura * 0.4;
201
+ const preenchimento = !semTotal
202
+ ? _jsx(View, { style: [s.preenchimento, { width: `${pct}%`, backgroundColor: cor }] })
203
+ : corre
204
+ ? _jsx(Animated.View, { style: [s.preenchimento, { width: pedaco, backgroundColor: cor },
205
+ { transform: [{ translateX: corrida.interpolate({ inputRange: [0, 1], outputRange: [-pedaco, pedaco * 3.5] }) }] }] })
206
+ : _jsx(View, { style: [s.preenchimento, { width: "100%", backgroundColor: cor, opacity: t.size.opacityDisabled }] });
207
+ const valor = semTotal
208
+ ? (emTexto != null ? { text: emTexto } : undefined)
209
+ : { min: 0, max: 100, now: pct, ...(emTexto != null && { text: `${pct}%, ${emTexto}` }) };
210
+ const papel = {
211
+ testID, accessible: true, accessibilityRole: "progressbar",
212
+ accessibilityLabel: label, accessibilityValue: valor,
213
+ };
214
+ const medir = semTotal ? (e) => setLargura(e.nativeEvent.layout.width) : undefined;
215
+ if (!temApoio) {
216
+ return _jsx(View, { ...papel, onLayout: medir, style: [s.trilho, style], children: preenchimento });
217
+ }
218
+ return (_jsxs(View, { ...papel, style: [s.campoProgresso, style], children: [emTexto != null
219
+ ? _jsx(Text, { type: "body-sm", weight: 500, tone: "muted", style: [s.apoioProgresso, s.algarismos], children: emTexto })
220
+ : _jsx(View, { style: s.apoioProgresso, children: detail }), _jsx(View, { onLayout: medir, style: s.trilho, children: preenchimento })] }));
165
221
  }
166
222
  /** Mesmos quatro glifos do `feedback-client.tsx:43`. */
167
223
  export const ICONE_DA_VARIANTE = {
package/dist/index.d.ts CHANGED
@@ -11,11 +11,11 @@ export type { IconProps, IconName, PhosphorIconName, AureaIconNames, IconWeight,
11
11
  export { Screen } from "./screen.js";
12
12
  export type { ScreenProps, AureaScreenBackground, AureaScreenEdge } from "./screen.js";
13
13
  export { Stack, Cluster, Grid, Card, Separator } from "./layout.js";
14
- export type { StackProps, ClusterProps, AureaStackAlign, AureaClusterAlign, AureaClusterJustify, GridProps, CardProps, SeparatorProps, AureaCardVariant, } from "./layout.js";
14
+ export type { StackProps, ClusterProps, AureaStackAlign, AureaClusterAlign, AureaClusterJustify, GridProps, CardProps, SeparatorProps, AureaCardVariant, AureaGridMin, } from "./layout.js";
15
15
  export { Button, IconButton, LinkButton, ThemeToggle } from "./actions.js";
16
16
  export type { ButtonProps, IconButtonProps, LinkButtonProps, ThemeToggleProps, AureaButtonAppearance, AureaButtonSize, AureaButtonTone, } from "./actions.js";
17
17
  export { Spinner, Skeleton, Progress, Alert, EmptyState, DataState, ICONE_DA_VARIANTE } from "./feedback.js";
18
- export type { SpinnerProps, SkeletonProps, ProgressProps, AlertProps, EmptyStateProps, DataStateProps, AureaSpinnerSize, AureaAlertVariant, AureaDataStateValue, } from "./feedback.js";
18
+ export type { SpinnerProps, SkeletonProps, ProgressProps, AlertProps, EmptyStateProps, DataStateProps, AureaSpinnerSize, AureaAlertVariant, AureaDataStateValue, AureaProgressTone, } from "./feedback.js";
19
19
  export { Badge, Status, Avatar, KPI, formatarContagem } from "./display.js";
20
20
  export type { BadgeProps, StatusProps, AvatarProps, KPIProps, AureaBadgeAnchor, AureaBadgeEmphasis, AureaBadgeFit, AureaBadgeSize, AureaBadgeTone, AureaStatusVariant, AureaAvatarSize, } from "./display.js";
21
21
  export { useAureaStrings } from "./theme.js";
@@ -23,7 +23,7 @@ export { defaultStrings, ptBR, gravidadeDoEstado, AUREA_UNIVERSAL_STATES } from
23
23
  export type { AureaStrings, AureaUniversalState } from "./strings.js";
24
24
  export { useReduceMotion } from "./movimento.js";
25
25
  export { BottomNav, Topbar, NavList, Stepper, Tabs } from "./navigation.js";
26
- export type { BottomNavProps, TopbarProps, NavListProps, StepperProps, AureaNavItem, AureaNavListItem, AureaStepItem, AureaStepState, AureaBottomNavVariant, AureaBottomNavIndicator, AureaBottomNavWidth, AureaTopbarVariant, AureaTopbarInset, TabsProps, AureaTabItem, AureaTabsVariant, } from "./navigation.js";
26
+ export type { BottomNavProps, TopbarProps, NavListProps, StepperProps, AureaNavItem, AureaNavListItem, AureaNavListIndicator, AureaStepItem, AureaStepState, AureaBottomNavVariant, AureaBottomNavIndicator, AureaBottomNavWidth, AureaTopbarVariant, AureaTopbarInset, TabsProps, AureaTabItem, AureaTabsVariant, } from "./navigation.js";
27
27
  export { Field, Label, Input, Textarea, Select, Switch, Checkbox, Radio, RadioGroup, SegmentedControl, Form, KeyboardAvoiding, useCampo, } from "./inputs.js";
28
28
  export type { FieldProps, LabelProps, InputProps, TextareaProps, SelectProps, SwitchProps, CheckboxProps, RadioProps, RadioGroupProps, RadioGroupItemProps, AureaRadioIndicatorPlacement, SegmentedControlProps, FormProps, KeyboardAvoidingProps, AureaFieldSize, } from "./inputs.js";
29
29
  export { InputGroup, InputGroupAddon, PasswordField, useGrupoDeCampo } from "./inputs.js";
package/dist/layout.d.ts CHANGED
@@ -33,12 +33,19 @@ export interface ClusterProps extends Omit<StackProps, "align"> {
33
33
  * Sem nenhuma das três, nada muda.
34
34
  */
35
35
  export declare function Cluster({ align, justify, wrap, style, ...rest }: ClusterProps): React.JSX.Element;
36
+ /**
37
+ * A largura mínima da coluna, por nome — AN-08 (03/10/2026), os mesmos quatro da web (`.grid-min-*`
38
+ * no `aurea.css`): `xs` 8rem, `sm` 12rem, `md` 15rem (o padrão) e `lg` 20rem. Em rem, porque é rem
39
+ * na web; o `remInDp` do token faz a conta.
40
+ */
41
+ export type AureaGridMin = "xs" | "sm" | "md" | "lg";
36
42
  export interface GridProps extends ViewProps {
37
43
  /**
38
- * Largura mínima de cada coluna, em dp. O equivalente do `--grid-min` da web, cujo padrão é
39
- * `15rem` — e `1rem = 16dp`, medido, então **240**.
44
+ * Largura mínima de cada coluna, em dp, ou por nome (`xs`, `sm`, `md`, `lg` — AN-08). O
45
+ * equivalente do `--grid-min` da web, cujo padrão é `15rem` — e `1rem = 16dp`, medido, então
46
+ * **240**.
40
47
  */
41
- minColumnWidth?: number;
48
+ minColumnWidth?: number | AureaGridMin;
42
49
  children?: React.ReactNode;
43
50
  }
44
51
  /**
@@ -61,7 +68,7 @@ export interface GridProps extends ViewProps {
61
68
  * O `min(…, 100%)` da web tem par aqui: `maxWidth: "100%"` no filho, para a coluna não estourar o
62
69
  * contêiner quando o texto cresce — a mesma lição que a Fase 11 registrou no CSS.
63
70
  */
64
- export declare function Grid({ minColumnWidth, style, children, onLayout, ...rest }: GridProps): React.JSX.Element;
71
+ export declare function Grid({ minColumnWidth: pedido, style, children, onLayout, ...rest }: GridProps): React.JSX.Element;
65
72
  /** Qual superfície o cartão é. Mesmos seis nomes da ficha da web. */
66
73
  export interface SeparatorProps extends ViewProps {
67
74
  orientation?: "horizontal" | "vertical";
package/dist/layout.js CHANGED
@@ -86,6 +86,7 @@ export function Cluster({ align, justify, wrap, style, ...rest }) {
86
86
  style,
87
87
  ], ...rest }));
88
88
  }
89
+ const REM_DA_COLUNA = { xs: 8, sm: 12, md: 15, lg: 20 };
89
90
  /**
90
91
  * Colunas que se acomodam sem breakpoint.
91
92
  *
@@ -106,9 +107,10 @@ export function Cluster({ align, justify, wrap, style, ...rest }) {
106
107
  * O `min(…, 100%)` da web tem par aqui: `maxWidth: "100%"` no filho, para a coluna não estourar o
107
108
  * contêiner quando o texto cresce — a mesma lição que a Fase 11 registrou no CSS.
108
109
  */
109
- export function Grid({ minColumnWidth = 240, style, children, onLayout, ...rest }) {
110
+ export function Grid({ minColumnWidth: pedido = 240, style, children, onLayout, ...rest }) {
110
111
  const t = useAureaTokens();
111
112
  const s = folha(t);
113
+ const minColumnWidth = typeof pedido === "number" ? pedido : REM_DA_COLUNA[pedido] * t.remInDp;
112
114
  const [largura, setLargura] = React.useState(null);
113
115
  const plano = (StyleSheet.flatten([s.grid, style]) ?? {});
114
116
  const vao = numero(plano.columnGap) ?? numero(plano.gap) ?? t.size.space4;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { type ViewProps } from "react-native";
2
+ import { type ImageSourcePropType, type ViewProps } from "react-native";
3
3
  import { type AureaIcon } from "./icon.js";
4
4
  import { type AureaFilaJustify } from "./rolagem.js";
5
5
  export interface AureaNavItem {
@@ -136,6 +136,11 @@ export interface TopbarProps extends ViewProps {
136
136
  * e quem nomeia a tela é o conteúdo dela.
137
137
  */
138
138
  export declare function Topbar({ variant, inset, brand, children, style, ...rest }: TopbarProps): React.JSX.Element;
139
+ /** Um sinal da linha (AN-04): fixada, silenciada. O `label` não aparece; é o que o leitor de tela lê. */
140
+ export interface AureaNavListIndicator {
141
+ icon: AureaIcon;
142
+ label: string;
143
+ }
139
144
  export interface AureaNavListItem {
140
145
  id: string;
141
146
  label: React.ReactNode;
@@ -145,6 +150,16 @@ export interface AureaNavListItem {
145
150
  icon?: AureaIcon;
146
151
  onPress?: () => void;
147
152
  disabled?: boolean;
153
+ /**
154
+ * A foto da linha (AN-04, 03/10/2026) — o formato do `Avatar` daqui (`source`, `fallback`), no
155
+ * tamanho dele de sempre, o mesmo da web. Toma o lugar do `icon`.
156
+ */
157
+ avatar?: {
158
+ source?: ImageSourcePropType | string;
159
+ fallback?: React.ReactNode;
160
+ };
161
+ /** Os sinais ao lado do `value` (AN-04): pequenos e apagados, cada um com nome. */
162
+ indicators?: AureaNavListIndicator[];
148
163
  }
149
164
  export interface NavListProps extends ViewProps {
150
165
  items: AureaNavListItem[];
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { Pressable, View } from "react-native";
3
3
  import { useSafeAreaInsets } from "react-native-safe-area-context";
4
4
  import { useAnotarBottomNav } from "./barranav.js";
5
- import { Badge } from "./display.js";
5
+ import { Avatar, Badge } from "./display.js";
6
6
  import { comOpacidade, criarFolha, estadoAcessivel, fioDoEscolhido } from "./estilos.js";
7
7
  import { Icon } from "./icon.js";
8
8
  import { Card } from "./layout.js";
@@ -175,6 +175,8 @@ const folha = criarFolha((t) => ({
175
175
  // Nenhuma medida nova: `flex`, `minWidth` e o MESMO `gap` da moldura.
176
176
  linhaMiolo: { flex: 1, minWidth: 0, flexDirection: "row", alignItems: "center", gap: t.size.space3 },
177
177
  linhaTexto: { flex: 1, minWidth: 0 },
178
+ // AN-04: os sinais, com o vão de dentro do texto (`space1`), como o `.nav-list-indicators` da web.
179
+ sinais: { flexDirection: "row", alignItems: "center", gap: t.size.space1 },
178
180
  // ── Tabs ───────────────────────────────────────────────────────────────────────────────────
179
181
  // A cápsula é a MESMA do `SegmentedControl`, e o CSS diz isso em voz alta no comentário de
180
182
  // cima do `.tabs` (`aurea.css:1114`): *"Mesma regra da .segmented"*. Os três números vêm de
@@ -462,10 +464,12 @@ export function NavList({ items, chevron = "caret-right", style, ...rest }) {
462
464
  // • valor em COMPONENTE fica FORA, irmão do miolo, porque pode ser tocável.
463
465
  const temAcao = typeof it.onPress === "function";
464
466
  const valorEhTexto = typeof it.value === "string" || typeof it.value === "number";
465
- const miolo = (_jsxs(_Fragment, { children: [it.icon && _jsx(Icon, { name: it.icon, size: "md", color: t.color.foreground }), _jsxs(View, { style: s.linhaTexto, children: [typeof it.label === "string"
467
+ const miolo = (_jsxs(_Fragment, { children: [it.avatar
468
+ ? _jsx(Avatar, { source: it.avatar.source, fallback: it.avatar.fallback })
469
+ : it.icon && _jsx(Icon, { name: it.icon, size: "md", color: t.color.foreground }), _jsxs(View, { style: s.linhaTexto, children: [typeof it.label === "string"
466
470
  ? _jsx(Text, { size: "sm", numberOfLines: 1, children: it.label }) : it.label, it.description != null && (typeof it.description === "string"
467
471
  ? _jsx(Text, { size: "xs", tone: "muted", numberOfLines: 1, children: it.description })
468
- : it.description)] }), valorEhTexto && _jsx(Text, { size: "sm", tone: "muted", children: it.value }), temAcao && chevron
472
+ : 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
469
473
  && _jsx(Icon, { name: chevron, size: "sm", color: t.color.mutedForeground })] }));
470
474
  return (_jsxs(View, { 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));
471
475
  }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurea-uds/native",
3
- "version": "0.17.0",
3
+ "version": "0.18.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.17.0"
58
+ "@aurea-uds/tokens": "^0.18.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@react-native-community/datetimepicker": ">=8",