@otfdashkit/ui-native 0.1.0 → 0.1.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/README.md +110 -0
- package/package.json +27 -3
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<h1 align="center">@otfdashkit/ui-native</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
React Native + Expo component library — same component API as <code>@otfdashkit/ui</code> (web).<br/>
|
|
5
|
+
Tamagui under the hood, parity primitives, tokens shared with the web SDK.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://www.npmjs.com/package/@otfdashkit/ui-native" target="_blank">
|
|
10
|
+
<img src="https://img.shields.io/npm/v/@otfdashkit/ui-native?style=flat-square&color=000" alt="npm version">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@otfdashkit/ui-native" target="_blank">
|
|
13
|
+
<img src="https://img.shields.io/npm/dm/@otfdashkit/ui-native?style=flat-square&color=000" alt="npm downloads">
|
|
14
|
+
</a>
|
|
15
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="MIT License">
|
|
16
|
+
<img src="https://img.shields.io/badge/platforms-iOS%20%7C%20Android-000?style=flat-square" alt="platforms">
|
|
17
|
+
<img src="https://img.shields.io/badge/Expo-SDK%2054-000?style=flat-square" alt="Expo SDK 54">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Live demo
|
|
23
|
+
|
|
24
|
+
- **[native.otf-kit.dev](https://native.otf-kit.dev/)** — full storybook in a phone-frame, with an Expo Go QR for real-device preview
|
|
25
|
+
- **[fitness-preview.otf-kit.dev](https://fitness-preview.otf-kit.dev/)** — production fitness app built end-to-end with this package
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @otfdashkit/ui-native @otfdashkit/tokens
|
|
31
|
+
# or: npm install @otfdashkit/ui-native @otfdashkit/tokens
|
|
32
|
+
# or: bun add @otfdashkit/ui-native @otfdashkit/tokens
|
|
33
|
+
|
|
34
|
+
npx expo install react-native-svg react-native-safe-area-context
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// App.tsx
|
|
41
|
+
import { TamaguiProvider, createTamagui } from '@tamagui/core'
|
|
42
|
+
import { otfTamaguiConfig } from '@otfdashkit/tokens'
|
|
43
|
+
import { Button, Card, Input } from '@otfdashkit/ui-native'
|
|
44
|
+
|
|
45
|
+
const config = createTamagui(otfTamaguiConfig)
|
|
46
|
+
|
|
47
|
+
export default function App() {
|
|
48
|
+
return (
|
|
49
|
+
<TamaguiProvider config={config}>
|
|
50
|
+
<Card>
|
|
51
|
+
<Input placeholder="Email" />
|
|
52
|
+
<Button variant="primary" size="lg" onPress={handlePress}>
|
|
53
|
+
Continue
|
|
54
|
+
</Button>
|
|
55
|
+
</Card>
|
|
56
|
+
</TamaguiProvider>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The same component names, props, and variants work on web (`@otfdashkit/ui`) and native — port a screen by changing the import.
|
|
62
|
+
|
|
63
|
+
## Cross-platform parity
|
|
64
|
+
|
|
65
|
+
| Component | Web (`@otfdashkit/ui`) | Native (`@otfdashkit/ui-native`) |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `<Button>` | Radix primitive | Tamagui primitive |
|
|
68
|
+
| `<Card>` | Tailwind v4 | Tamagui tokens |
|
|
69
|
+
| `<Input>` | Radix Form | Tamagui Input |
|
|
70
|
+
| `<Avatar>` | Radix Avatar | Tamagui Avatar |
|
|
71
|
+
| `<Text>` | Tailwind typography | Tamagui Text |
|
|
72
|
+
|
|
73
|
+
Everything reads from the same [`@otfdashkit/tokens`](https://www.npmjs.com/package/@otfdashkit/tokens) palette, so switching themes from `mono` → `ocean-teal` → `forest` cascades through both runtimes.
|
|
74
|
+
|
|
75
|
+
## Theming
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
// Apply a theme at the Tamagui provider level
|
|
79
|
+
import { otfTamaguiConfig, OTF_DESIGN_THEMES } from '@otfdashkit/tokens'
|
|
80
|
+
|
|
81
|
+
const config = createTamagui({
|
|
82
|
+
...otfTamaguiConfig,
|
|
83
|
+
defaultTheme: 'ocean-teal',
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
All 17 themes from `@otfdashkit/tokens` are available.
|
|
88
|
+
|
|
89
|
+
## AI-coding-tool-native
|
|
90
|
+
|
|
91
|
+
Every component ships with structured JSDoc and tested prompts (`ai/prompts/*.md`). Cursor, Claude Code, Copilot, and Lovable all generate correct native usage on the first try, including the right Expo Go imports, safe-area handling, and theme tokens.
|
|
92
|
+
|
|
93
|
+
## Live demos
|
|
94
|
+
|
|
95
|
+
- **Phone-frame storybook**: https://native.otf-kit.dev (every component, every variant + Expo Go QR)
|
|
96
|
+
- **Fitness reference app**: https://fitness-preview.otf-kit.dev ([source](https://github.com/otf-kit/fitness-kit))
|
|
97
|
+
|
|
98
|
+
## Related packages
|
|
99
|
+
|
|
100
|
+
- [`@otfdashkit/ui`](https://www.npmjs.com/package/@otfdashkit/ui) — web counterpart, same component API
|
|
101
|
+
- [`@otfdashkit/tokens`](https://www.npmjs.com/package/@otfdashkit/tokens) — shared design tokens (CSS vars + Tamagui config)
|
|
102
|
+
- [`@otfdashkit/eslint-plugin-otf-design`](https://www.npmjs.com/package/@otfdashkit/eslint-plugin-otf-design) — design-system lint rules
|
|
103
|
+
|
|
104
|
+
## Status
|
|
105
|
+
|
|
106
|
+
`v0.1.x` — alpha. APIs may change before `1.0`. Pin exact versions if you ship to production.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT © otfdashkit
|
package/package.json
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otfdashkit/ui-native",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "OTF UI Native — Tamagui-powered component library for Expo",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "OTF UI Native — Tamagui-powered component library for React Native + Expo. Same component API as @otfdashkit/ui (web) — port a screen by changing the import.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"otfdashkit",
|
|
7
|
+
"ui-native",
|
|
8
|
+
"react-native",
|
|
9
|
+
"expo",
|
|
10
|
+
"tamagui",
|
|
11
|
+
"components",
|
|
12
|
+
"design-system",
|
|
13
|
+
"ios",
|
|
14
|
+
"android",
|
|
15
|
+
"cross-platform"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "otfdashkit <dave@otf-kit.dev>",
|
|
19
|
+
"homepage": "https://github.com/otf-kit/sdk/tree/main/packages/ui-native#readme",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/otf-kit/sdk.git",
|
|
23
|
+
"directory": "packages/ui-native"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/otf-kit/sdk/issues"
|
|
27
|
+
},
|
|
5
28
|
"main": "dist/index.js",
|
|
6
29
|
"module": "dist/index.mjs",
|
|
7
30
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +36,8 @@
|
|
|
13
36
|
}
|
|
14
37
|
},
|
|
15
38
|
"files": [
|
|
16
|
-
"dist/**"
|
|
39
|
+
"dist/**",
|
|
40
|
+
"README.md"
|
|
17
41
|
],
|
|
18
42
|
"dependencies": {
|
|
19
43
|
"@tamagui/portal": ">=1.100.0"
|