@xaui/native 0.0.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 +105 -0
- package/dist/button/index.cjs +672 -0
- package/dist/button/index.d.cts +90 -0
- package/dist/button/index.d.ts +90 -0
- package/dist/button/index.js +264 -0
- package/dist/chunk-6ITFLLAM.js +375 -0
- package/dist/chunk-SHT66VET.js +60 -0
- package/dist/core/index.cjs +99 -0
- package/dist/core/index.d.cts +19 -0
- package/dist/core/index.d.ts +19 -0
- package/dist/core/index.js +12 -0
- package/dist/index.cjs +417 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/indicator/index.cjs +417 -0
- package/dist/indicator/index.d.cts +47 -0
- package/dist/indicator/index.d.ts +47 -0
- package/dist/indicator/index.js +7 -0
- package/dist/progress/index.cjs +266 -0
- package/dist/progress/index.d.cts +47 -0
- package/dist/progress/index.d.ts +47 -0
- package/dist/progress/index.js +216 -0
- package/dist/theme-qvIXI4kF.d.cts +3 -0
- package/dist/theme-qvIXI4kF.d.ts +3 -0
- package/package.json +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @xaui/native
|
|
2
|
+
|
|
3
|
+
React Native components and hooks that extend the core `@xaui/core` theme system. This mobile layer ships animated primitives (buttons, indicators, hooks) ready to use with `XUIProvider`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @xaui/native
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Peer dependencies
|
|
12
|
+
|
|
13
|
+
- `react` ^18 || ^19
|
|
14
|
+
- `react-native` >=0.70.0
|
|
15
|
+
- `react-native-reanimated` >=4.0.0
|
|
16
|
+
- `react-native-svg` >=13.0.0
|
|
17
|
+
|
|
18
|
+
The package also relies on `@xaui/core/theme` for the shared tokens.
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
1. Wrap your tree with `XUIProvider` to expose the tokens and follow the system color scheme:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { XUIProvider } from '@xaui/native/core'
|
|
26
|
+
import { theme, darkTheme } from '@xaui/core/theme'
|
|
27
|
+
|
|
28
|
+
export default function App() {
|
|
29
|
+
return (
|
|
30
|
+
<XUIProvider theme={theme} darkTheme={darkTheme}>
|
|
31
|
+
{/* your screens */}
|
|
32
|
+
</XUIProvider>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Consume the theme inside your components via `useXUITheme` or `useColorMode`:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Text, View } from 'react-native'
|
|
41
|
+
import { useXUITheme, useColorMode } from '@xaui/native/core'
|
|
42
|
+
|
|
43
|
+
function Banner() {
|
|
44
|
+
const theme = useXUITheme()
|
|
45
|
+
const mode = useColorMode()
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={{ backgroundColor: theme.colors.primary.background }}>
|
|
49
|
+
<Text style={{ color: theme.colors.primary.foreground }}>
|
|
50
|
+
Current mode: {mode}
|
|
51
|
+
</Text>
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Key components
|
|
58
|
+
|
|
59
|
+
### `Button`
|
|
60
|
+
- Variants: `solid`, `outlined`, `flat`, `light`, `elevated`, `faded`
|
|
61
|
+
- Sizes: `xs`, `sm`, `md`, `lg`
|
|
62
|
+
- Radii: `none`, `sm`, `md`, `lg`, `full`
|
|
63
|
+
- Supports start/end content, `fullWidth`, `isDisabled`, `isLoading` with an integrated spinner
|
|
64
|
+
- Declarative press animations (scale, opacity, spring)
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<Button
|
|
68
|
+
themeColor="primary"
|
|
69
|
+
variant="elevated"
|
|
70
|
+
size="lg"
|
|
71
|
+
radius="full"
|
|
72
|
+
isLoading={saving}
|
|
73
|
+
spinnerPlacement="end"
|
|
74
|
+
onPress={handleSave}
|
|
75
|
+
>
|
|
76
|
+
Save changes
|
|
77
|
+
</Button>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`useButtonStyles` exposes the internal calculations if you need to derive custom layouts (spacing, colors, shadows, spinner size).
|
|
81
|
+
|
|
82
|
+
### `ActivityIndicator`
|
|
83
|
+
- Variants: `circular` (default size 40) and `linear` (custom height)
|
|
84
|
+
- Draws from the theme colors (`primary`, `secondary`, etc.) and optionally renders a track with `showTrack`
|
|
85
|
+
- `disableAnimation` is provided for snapshots or silent loading states
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<ActivityIndicator variant="linear" themeColor="secondary" showTrack borderRadius={4} />
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Theme hooks & utilities
|
|
92
|
+
|
|
93
|
+
- `useXUITheme()` must be used within `XUIProvider`; it throws if the provider is missing.
|
|
94
|
+
- `useXUIColors()` is a shortcut for reading just the color tokens.
|
|
95
|
+
- `useColorMode()` returns `light` or `dark` based on React Native's `useColorScheme()`.
|
|
96
|
+
- `XUIProvider` accepts `theme` and `darkTheme` as `DeepPartial<XUITheme>` so you can override partial token sets without redefining the entire theme.
|
|
97
|
+
|
|
98
|
+
## Testing & build
|
|
99
|
+
|
|
100
|
+
- Bundles are produced with `tsup` (ESM + CJS outputs under `dist`).
|
|
101
|
+
- Tests live under `packages/native/__tests__` and run with `vitest`.
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|