@medway-ui/native 1.7.1 → 1.7.2

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 CHANGED
@@ -1,31 +1,31 @@
1
1
  # @medway-ui/native
2
2
 
3
- React Native components for iOS and Android (Expo). Same visual API as `@medway-ui/core`, built on NativeWind + `@rn-primitives`.
3
+ Componentes React Native para iOS e Android (Expo). Mesma API visual do `@medway-ui/core`, construída sobre NativeWind + `@rn-primitives`.
4
4
 
5
- **Minimum recommended version for npm brownfield setup:** `1.1.2+`
5
+ **Versão mínima recomendada para setup brownfield via npm:** `1.1.2+`
6
6
 
7
7
  ---
8
8
 
9
- ## Installation
9
+ ## Instalação
10
10
 
11
11
  ```bash
12
12
  npm install @medway-ui/native @medway-ui/core @medway-ui/icons \
13
13
  class-variance-authority clsx tailwind-merge nativewind \
14
14
  react-native-reanimated react-native-svg
15
15
 
16
- # Expo (aligns versions with your SDK)
17
- # expo-linear-gradient + masked-view: optional peers for IndexLevel `animated` ring
18
- # and Toast gradient variants (solid color fallback when missing)
16
+ # Expo (alinha as versões com o seu SDK)
17
+ # expo-linear-gradient + masked-view: peers opcionais para o anel `animated` do IndexLevel
18
+ # e as variantes com gradiente do Toast (fallback para cor sólida quando ausentes)
19
19
  npx expo install react-native-reanimated react-native-svg expo-linear-gradient @react-native-masked-view/masked-view
20
20
  ```
21
21
 
22
- `react-native-safe-area-context` is an optional peer used by `ToastProvider` for top inset. Expo apps usually already have it (and a root `SafeAreaProvider` via React Navigation). Without a provider, the toast falls back to the previous `pt-12` offset.
22
+ `react-native-safe-area-context` é uma peer dependency opcional usada pelo `ToastProvider` para o inset superior. Apps Expo normalmente já têm (e um `SafeAreaProvider` na raiz via React Navigation). Sem um provider, o toast volta para o offset anterior de `pt-12`.
23
23
 
24
24
  ```bash
25
25
  npx expo install react-native-safe-area-context
26
26
  ```
27
27
 
28
- Brownfield apps that already use `babel-plugin-module-resolver` with `@/` aliases pointing at the app `src/` also need:
28
+ Apps brownfield que já usam `babel-plugin-module-resolver` com aliases `@/` apontando para o `src/` do app também precisam de:
29
29
 
30
30
  ```bash
31
31
  npm install -D babel-plugin-module-resolver
@@ -33,11 +33,11 @@ npm install -D babel-plugin-module-resolver
33
33
 
34
34
  ---
35
35
 
36
- ## Brownfield setup (Expo + legacy UI / Restyle)
36
+ ## Setup brownfield (Expo + UI legada / Restyle)
37
37
 
38
- NativeWind applies **only** to `@medway-ui/native` + screens/components that use the library (e.g. `src/pages/medway-ui/`, partially migrated features).
38
+ O NativeWind se aplica **apenas** ao `@medway-ui/native` + telas/componentes que usam a biblioteca (ex.: `src/pages/medway-ui/`, features parcialmente migradas).
39
39
 
40
- Reference implementation: **test-prep-app** (`metro.config.js`, `babel.config.js`, `tailwind.config.js`, `src/pages/medway-ui/`).
40
+ Implementação de referência: **test-prep-app** (`metro.config.js`, `babel.config.js`, `tailwind.config.js`, `src/pages/medway-ui/`).
41
41
 
42
42
  ### 1. `metro.config.js`
43
43
 
@@ -47,17 +47,17 @@ const { withMedwayUi } = require("@medway-ui/native/metro");
47
47
 
48
48
  module.exports = withMedwayUi(getDefaultConfig(__dirname), {
49
49
  projectRoot: __dirname,
50
- // linkedMedwayUiRoot: auto-detected (npm or monorepo)
50
+ // linkedMedwayUiRoot: detectado automaticamente (npm ou monorepo)
51
51
  });
52
52
  ```
53
53
 
54
- | Scenario | `linkedMedwayUiRoot` |
54
+ | Cenário | `linkedMedwayUiRoot` |
55
55
  | --- | --- |
56
- | npm packages (`npm install`) | **Omit** — auto-detects `node_modules/@medway-ui` |
57
- | Monorepo with local clone | `"../medway-ui"` (optional; also auto-detected) |
58
- | Symlink `file:../medway-ui/native` | Auto-detected as monorepo |
56
+ | Pacotes npm (`npm install`) | **Omita**: detecta `node_modules/@medway-ui` automaticamente |
57
+ | Monorepo com clone local | `"../medway-ui"` (opcional; também detectado automaticamente) |
58
+ | Symlink `file:../medway-ui/native` | Detectado automaticamente como monorepo |
59
59
 
60
- > Do **not** set `resolveNativeSource: false` — the compiled lib still references internal `@/` aliases. The default (`true`) resolves to `native/src` and works with npm.
60
+ > **Não** defina `resolveNativeSource: false`: a lib compilada ainda referencia aliases internos `@/`. O padrão (`true`) resolve para `native/src` e funciona com npm.
61
61
 
62
62
  ### 2. `tailwind.config.js`
63
63
 
@@ -68,19 +68,19 @@ module.exports = createMedwayUiTailwindConfig({
68
68
  projectRoot: __dirname,
69
69
  content: [
70
70
  "./src/pages/medway-ui/**/*.{ts,tsx}",
71
- // add extra folders that use className + @medway-ui/native:
71
+ // adicione pastas extras que usam className + @medway-ui/native:
72
72
  // "./src/pages/MyFeature/**/*.{ts,tsx}",
73
73
  ],
74
74
  });
75
75
  ```
76
76
 
77
- `createMedwayUiTailwindConfig` already includes globs for `node_modules/@medway-ui/native/src` and loads tokens from `@medway-ui/core` (Node 22+ compatible).
77
+ `createMedwayUiTailwindConfig` já inclui os globs de `node_modules/@medway-ui/native/src` e carrega os tokens de `@medway-ui/core` (compatível com Node 22+).
78
78
 
79
79
  ### 3. `babel.config.js`
80
80
 
81
- The app default preset must **not** enable NativeWind globally. Use `createBrownfieldOverride` to scope NativeWind to the library + migrated screens folder.
81
+ O preset padrão do app **não** deve habilitar o NativeWind globalmente. Use `createBrownfieldOverride` para restringir o NativeWind à biblioteca + pasta de telas migradas.
82
82
 
83
- If the app defines `@/` aliases for `./src/*` via `babel-plugin-module-resolver`, you **must** redirect `@/` imports from `@medway-ui/native` files to the library source — otherwise imports like `@/components/Badge` resolve to the app `src/` and break the bundle.
83
+ Se o app define aliases `@/` para `./src/*` via `babel-plugin-module-resolver`, você **precisa** redirecionar os imports `@/` dos arquivos do `@medway-ui/native` para o código-fonte da biblioteca. Caso contrário, imports como `@/components/Badge` resolvem para o `src/` do app e quebram o bundle.
84
84
 
85
85
  ```js
86
86
  const {
@@ -102,14 +102,14 @@ module.exports = function (api) {
102
102
  alias: {
103
103
  "@/components": "./src/components",
104
104
  "@/pages": "./src/pages",
105
- // ... other app aliases
105
+ // ... outros aliases do app
106
106
  },
107
107
  resolvePath(sourcePath, currentFile) {
108
108
  return resolveMedwayUiAlias(sourcePath, currentFile);
109
109
  },
110
110
  },
111
111
  ],
112
- // other app plugins (no reanimated here)
112
+ // outros plugins do app (sem reanimated aqui)
113
113
  ];
114
114
 
115
115
  return {
@@ -118,10 +118,10 @@ module.exports = function (api) {
118
118
  overrides: [
119
119
  createBrownfieldOverride({
120
120
  projectRoot: __dirname,
121
- appPagesDir: "medway-ui", // src/pages subfolder with NativeWind screens
121
+ appPagesDir: "medway-ui", // subpasta de src/pages com as telas NativeWind
122
122
  plugins: [
123
- // repeat any plugins needed in the medway-ui scope
124
- "react-native-reanimated/plugin", // always last
123
+ // repita os plugins necessários no escopo do medway-ui
124
+ "react-native-reanimated/plugin", // sempre por último
125
125
  ],
126
126
  }),
127
127
  ],
@@ -129,11 +129,11 @@ module.exports = function (api) {
129
129
  };
130
130
  ```
131
131
 
132
- Apps **without** `@/` Babel aliases do not need `createMedwayUiAliasResolver`.
132
+ Apps **sem** aliases `@/` no Babel não precisam de `createMedwayUiAliasResolver`.
133
133
 
134
134
  ### 4. Provider + CSS
135
135
 
136
- Wrap the subtree that uses `@medway-ui/native` with `MedwayUiProvider` and import CSS once:
136
+ Envolva a subárvore que usa `@medway-ui/native` com `MedwayUiProvider` e importe o CSS uma única vez:
137
137
 
138
138
  ```tsx
139
139
  import { MedwayUiProvider } from "@medway-ui/native/setup";
@@ -148,7 +148,7 @@ function MyScreen() {
148
148
  }
149
149
  ```
150
150
 
151
- **Dark mode:** pass `colorScheme="light" | "dark"` when the app already resolves theme (Redux, Zustand, etc.):
151
+ **Dark mode:** passe `colorScheme="light" | "dark"` quando o app já resolve o tema (Redux, Zustand, etc.):
152
152
 
153
153
  ```tsx
154
154
  <MedwayUiProvider colorScheme={appColorScheme}>
@@ -156,13 +156,13 @@ function MyScreen() {
156
156
  </MedwayUiProvider>
157
157
  ```
158
158
 
159
- `MedwayUiProvider` includes `PortalHost` (required for Select, Dialog, Popover, Tooltip).
159
+ `MedwayUiProvider` inclui o `PortalHost` (obrigatório para Select, Dialog, Popover, Tooltip).
160
160
 
161
- > Do **not** import `@medway-ui/core/tokens.css` directly — incompatible with NativeWind v4. Tokens come from `setup/global.css` + `setup/tokens.native.css`.
161
+ > **Não** importe `@medway-ui/core/tokens.css` diretamente: é incompatível com o NativeWind v4. Os tokens vêm de `setup/global.css` + `setup/tokens.native.css`.
162
162
 
163
- ### 5. Auto navigator (catalog / isolated screens)
163
+ ### 5. Navigator automático (catálogo / telas isoladas)
164
164
 
165
- Create once `src/pages/medway-ui/navigator.tsx`:
165
+ Crie uma única vez `src/pages/medway-ui/navigator.tsx`:
166
166
 
167
167
  ```tsx
168
168
  import { createMedwayUiNavigator, MedwayUiProvider } from "@medway-ui/native/setup";
@@ -183,17 +183,17 @@ function MedwayUiRoot() {
183
183
  export { MedwayUiRoot, MedwayUiNavigator };
184
184
  ```
185
185
 
186
- Register in the app stack:
186
+ Registre no stack do app:
187
187
 
188
188
  ```tsx
189
189
  <Stack.Screen name="MedwayUi" component={MedwayUiRoot} options={{ headerShown: false }} />
190
190
  ```
191
191
 
192
- New screen = new folder `src/pages/medway-ui/MyScreen/index.tsx` — no manual route registration.
192
+ Nova tela = nova pasta `src/pages/medway-ui/MyScreen/index.tsx`, sem registro manual de rota.
193
193
 
194
- ### 6. Using components in existing screens (Restyle + Medway UI mix)
194
+ ### 6. Usando componentes em telas existentes (mistura de Restyle + Medway UI)
195
195
 
196
- Pattern used in Content Hub and partially migrated features:
196
+ Padrão usado no Content Hub e em features parcialmente migradas:
197
197
 
198
198
  ```tsx
199
199
  import { Button, CardNews } from "@medway-ui/native";
@@ -211,11 +211,11 @@ function ContentHubScreen() {
211
211
  }
212
212
  ```
213
213
 
214
- Add the feature folder to `content` in `tailwind.config.js`.
214
+ Adicione a pasta da feature ao `content` do `tailwind.config.js`.
215
215
 
216
216
  ---
217
217
 
218
- ## Monorepo development (`file:../medway-ui/native`)
218
+ ## Desenvolvimento em monorepo (`file:../medway-ui/native`)
219
219
 
220
220
  ```json
221
221
  {
@@ -224,32 +224,32 @@ Add the feature folder to `content` in `tailwind.config.js`.
224
224
  }
225
225
  ```
226
226
 
227
- Metro and Babel auto-detect the local clone. After library changes:
227
+ Metro e Babel detectam o clone local automaticamente. Depois de mudanças na biblioteca:
228
228
 
229
229
  ```bash
230
- cd ../medway-ui/native && npm run build:lib # if testing the compiled lib
230
+ cd ../medway-ui/native && npm run build:lib # se estiver testando a lib compilada
231
231
  ```
232
232
 
233
- Restart Metro with a clean cache: `npx expo start --clear`.
233
+ Reinicie o Metro com cache limpo: `npx expo start --clear`.
234
234
 
235
235
  ---
236
236
 
237
- ## Troubleshooting
237
+ ## Solução de problemas
238
238
 
239
- | Error | Cause | Fix |
239
+ | Erro | Causa | Correção |
240
240
  | --- | --- | --- |
241
- | `Unable to resolve .../src/components/Badge` | App `@/` alias overrides lib `@/` | Add `createMedwayUiAliasResolver` in Babel |
242
- | `Unable to resolve @/lib/medwayIcons` | Bug in `@medway-ui/native@1.1.1` | Upgrade to `1.1.2+` |
243
- | `Unable to resolve ../../../../../src/...` from `lib/module/` | `resolveNativeSource: false` | Remove the option (use default `true`) |
244
- | Tokens / tailwind fail to load (Node 22+) | `require` of `.ts` inside `node_modules` | Use `@medway-ui/native@1.1.2+` (`createMedwayUiTailwindConfig` uses jiti fallback) |
245
- | NativeWind styles not applied | File outside brownfield scope | Move to `src/pages/medway-ui/` or add a tailwind glob |
246
- | Select/Dialog not opening | Missing `PortalHost` | Use `MedwayUiProvider` |
241
+ | `Unable to resolve .../src/components/Badge` | Alias `@/` do app sobrescreve o `@/` da lib | Adicione `createMedwayUiAliasResolver` no Babel |
242
+ | `Unable to resolve @/lib/medwayIcons` | Bug no `@medway-ui/native@1.1.1` | Atualize para `1.1.2+` |
243
+ | `Unable to resolve ../../../../../src/...` a partir de `lib/module/` | `resolveNativeSource: false` | Remova a opção (use o padrão `true`) |
244
+ | Tokens / tailwind não carregam (Node 22+) | `require` de `.ts` dentro de `node_modules` | Use `@medway-ui/native@1.1.2+` (`createMedwayUiTailwindConfig` usa fallback com jiti) |
245
+ | Estilos do NativeWind não aplicados | Arquivo fora do escopo brownfield | Mova para `src/pages/medway-ui/` ou adicione um glob no tailwind |
246
+ | Select/Dialog não abre | `PortalHost` ausente | Use `MedwayUiProvider` |
247
247
 
248
248
  ---
249
249
 
250
- ## Greenfield setup (100% NativeWind app)
250
+ ## Setup greenfield (app 100% NativeWind)
251
251
 
252
- For new apps without legacy UI:
252
+ Para apps novos, sem UI legada:
253
253
 
254
254
  ```js
255
255
  // babel.config.js
@@ -275,11 +275,11 @@ module.exports = withMedwayUi(getDefaultConfig(__dirname), {
275
275
  });
276
276
  ```
277
277
 
278
- Import `@medway-ui/native/setup/global.css` in the root layout.
278
+ Importe `@medway-ui/native/setup/global.css` no layout raiz.
279
279
 
280
280
  ---
281
281
 
282
- ## Usage
282
+ ## Uso
283
283
 
284
284
  ```tsx
285
285
  import {
@@ -297,11 +297,11 @@ export default function Screen() {
297
297
  return (
298
298
  <>
299
299
  <Button variant="regular" size="md" onPress={() => {}}>
300
- Continue
300
+ Continuar
301
301
  </Button>
302
302
 
303
303
  <Input
304
- label="Email"
304
+ label="E-mail"
305
305
  type="email"
306
306
  size="lg"
307
307
  value={email}
@@ -312,8 +312,8 @@ export default function Screen() {
312
312
  <Alert variant="success" onClose={() => {}}>
313
313
  <AlertContainer>
314
314
  <AlertContent>
315
- <AlertTitle>Done</AlertTitle>
316
- <AlertDescription>Operation completed successfully.</AlertDescription>
315
+ <AlertTitle>Pronto</AlertTitle>
316
+ <AlertDescription>Operação concluída com sucesso.</AlertDescription>
317
317
  </AlertContent>
318
318
  </AlertContainer>
319
319
  </Alert>
@@ -324,9 +324,9 @@ export default function Screen() {
324
324
  }
325
325
  ```
326
326
 
327
- ## Icons
327
+ ## Ícones
328
328
 
329
- The `@medway-ui/icons` package includes a native entry point:
329
+ O pacote `@medway-ui/icons` inclui um entry point nativo:
330
330
 
331
331
  ```tsx
332
332
  import { Check, CloseMd } from "@medway-ui/icons/native";
@@ -334,53 +334,53 @@ import { Check, CloseMd } from "@medway-ui/icons/native";
334
334
 
335
335
  ---
336
336
 
337
- ## Components — status
337
+ ## Componentes: status
338
338
 
339
- | Component | Status | Notes |
339
+ | Componente | Status | Notas |
340
340
  | --- | --- | --- |
341
- | Button | ✅ | Variants, loading, badge, alert dot |
341
+ | Button | ✅ | Variantes, loading, badge, ponto de alerta |
342
342
  | Input | ✅ | text, email, password, numeric |
343
- | Alert | ✅ | Sub-components, all variants |
344
- | Badge | ✅ | Variants, icon-only |
345
- | Loading | ✅ | Reanimated spin |
346
- | LoadingOverlay | ✅ | Card + Modal overlay, custom center icon |
343
+ | Alert | ✅ | Subcomponentes, todas as variantes |
344
+ | Badge | ✅ | Variantes, só ícone |
345
+ | Loading | ✅ | Spin com Reanimated |
346
+ | LoadingOverlay | ✅ | Overlay de Card + Modal, ícone central customizável |
347
347
  | Checkbox | ✅ | @rn-primitives/checkbox |
348
348
  | RadioGroup | ✅ | @rn-primitives/radio-group |
349
349
  | Switch | ✅ | @rn-primitives/switch |
350
350
  | Select | ✅ | @rn-primitives/select |
351
351
  | Label | ✅ | Pressable + Text |
352
- | Separator | ✅ | View 1px |
352
+ | Separator | ✅ | View de 1px |
353
353
  | Dialog | ✅ | @rn-primitives/dialog |
354
354
  | AlertDialog | ✅ | @rn-primitives/alert-dialog |
355
- | Sheet | ✅ | @rn-primitives/dialog (side-aware) |
356
- | Tag | ✅ | 16+ variants |
357
- | Toast | ✅ | useToast + toast(); gradient variants + safe-area inset |
355
+ | Sheet | ✅ | @rn-primitives/dialog (ciente do lado) |
356
+ | Tag | ✅ | 16+ variantes |
357
+ | Toast | ✅ | useToast + toast(); variantes com gradiente + inset de safe area |
358
358
  | Tooltip | ✅ | @rn-primitives/tooltip |
359
359
  | Popover | ✅ | @rn-primitives/popover |
360
360
  | Skeleton | ✅ | Shimmer |
361
361
  | Avatar | ✅ | @rn-primitives/avatar |
362
362
  | FallbackImage | ✅ | react-native-svg |
363
- | CardNews | ✅ | Composable card (Content Hub) |
364
- | IndexLevel | ✅ | Levels p/h/m/l, variants, `animated` gradient ring |
363
+ | CardNews | ✅ | Card composable (Content Hub) |
364
+ | IndexLevel | ✅ | Níveis p/h/m/l, variantes, anel com gradiente `animated` |
365
365
  | Tabs | ✅ | Tabs, TabsList, TabsTrigger, TabsContent |
366
- | Chip | ✅ | Sizes and variants |
367
- | Choice | ✅ | Selectable pill with theme colors |
368
- | Filter | ✅ | Pill with criteria and dropdown indicator |
369
- | Text | ✅ | Montserrat font resolution |
370
- | ThemedIcon | ✅ | Icon colored by theme token |
366
+ | Chip | ✅ | Tamanhos e variantes |
367
+ | Choice | ✅ | Pill selecionável com cores do tema |
368
+ | Filter | ✅ | Pill com critérios e indicador de dropdown |
369
+ | Text | ✅ | Resolução da fonte Montserrat |
370
+ | ThemedIcon | ✅ | Ícone colorido por token do tema |
371
371
  | DropdownMenu | ✅ | @rn-primitives/dropdown-menu |
372
- | Carousel | ✅ | Media and metric slides |
373
- | EmptyState | ✅ | Empty list/screen placeholder |
372
+ | Carousel | ✅ | Slides de mídia e de métrica |
373
+ | EmptyState | ✅ | Placeholder de lista/tela vazia |
374
374
  | Feed | ✅ | Feed, FeedTitle, FeedComposer |
375
- | FeedNotice | ✅ | Feed notice banner |
376
- | Feedback | ✅ | Feedback card |
377
- | InvitePopover | ✅ | Composable invite popover |
378
- | LeaderboardCard | ✅ | Header and ranked list |
379
- | MemberRow | ✅ | Member row with rank indicator |
380
- | PageHeader | ✅ | Screen header |
381
- | PostForm | ✅ | Composable post form (media, date/time, options) |
382
- | PrizeCollection | ✅ | Stats, shelf, rows and items |
383
- | SectionHeader | ✅ | Section title header |
375
+ | FeedNotice | ✅ | Banner de aviso do feed |
376
+ | Feedback | ✅ | Card de feedback |
377
+ | InvitePopover | ✅ | Popover de convite composable |
378
+ | LeaderboardCard | ✅ | Cabeçalho e lista ranqueada |
379
+ | MemberRow | ✅ | Linha de membro com indicador de posição |
380
+ | PageHeader | ✅ | Cabeçalho de tela |
381
+ | PostForm | ✅ | Formulário de post composable (mídia, data/hora, opções) |
382
+ | PrizeCollection | ✅ | Estatísticas, prateleira, linhas e itens |
383
+ | SectionHeader | ✅ | Cabeçalho com título de seção |
384
384
  | Progress | 🔜 | @rn-primitives/progress |
385
385
  | ProgressCircle | 🔜 | react-native-svg |
386
386
  | Cards | 🔜 | CardModule, CardLesson, etc. |