@vvedantb/native-ui 0.1.0 → 0.2.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 CHANGED
@@ -1,13 +1,13 @@
1
1
  # `@vvedantb/native-ui`
2
2
 
3
- React Native + Expo primitives extracted from Velth. Floating pill chrome, Android-safe shadows, forms, list rows, and settings sections.
3
+ React Native + Expo primitives extracted from a React Native app. Floating pill chrome, Android-safe shadows, forms, list rows, and settings sections.
4
4
 
5
5
  Web apps should keep using `@vvedantb/ui`. This package is native-only.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```sh
10
- npm install @vvedantb/native-ui @vvedantb/tokens
10
+ npm install @vvedantb/native-ui
11
11
  ```
12
12
 
13
13
  Peers the app must already have (Expo SDK 57 / RN 0.76+):
@@ -66,20 +66,25 @@ import { NativeUiProvider, Button, Card } from "@vvedantb/native-ui";
66
66
  </NativeUiProvider>
67
67
  ```
68
68
 
69
- `useLargerText()` steps type and tap targets up. `accentColor` tints FABs and card icons. Surfaces use `@vvedantb/tokens/native` for fill, radius (card 24, row 20, pill 999) and spacing (16).
69
+ `useLargerText()` steps type and tap targets up. `accentColor` tints FABs and card icons. Surfaces use the tokens in `src/tokens.ts` for fill, radius (card 24, row 20, pill 999) and spacing (16).
70
70
 
71
71
  ## Floating UI / Android shadows
72
72
 
73
73
  Do not put `elevation` or NativeWind `shadow-*` on nested or translucent chrome. `floatingShadow` is iOS `shadow*` and Android/web `boxShadow`. `FloatingSurface` paints an opaque fill on Android and clips on an inner view. Blur is iOS-only.
74
74
 
75
+ ## Tokens
76
+
77
+ The JS tokens (colours, radii, spacing) live in `src/tokens.ts`. It is a copy of `@vvedantb/ui/tokens/native`, kept inside this package so React Native apps do not install `@vvedantb/ui` (Radix, react-dom and the rest of the web stack) for colour values. A test in `@vvedantb/ui` fails when the two files differ, so change both together.
78
+
79
+ Apps that already depend on `@vvedantb/ui` can import the same values from `@vvedantb/ui/tokens/native`.
80
+
75
81
  ## Publish
76
82
 
77
83
  There is no CI publish workflow. From a machine with npm access:
78
84
 
79
85
  ```sh
80
86
  export NPM_CONFIG_USERCONFIG="$HOME/.npmrc" # if you keep the token there
81
- cd packages/tokens && npm publish --access public
82
- cd ../native-ui && npm publish --access public
87
+ cd packages/native-ui && npm publish --access public
83
88
  ```
84
89
 
85
- `@vvedantb/tokens` must be `0.1.1+` first (`./native` export).
90
+ `@vvedantb/native-ui` `0.2.0` has no `@vvedantb/tokens` peer. See `MIGRATION.md` at the repository root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/native-ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, settings chrome, and tab bar.",
6
6
  "type": "module",
@@ -16,7 +16,8 @@
16
16
  ".": {
17
17
  "types": "./src/index.ts",
18
18
  "default": "./src/index.ts"
19
- }
19
+ },
20
+ "./package.json": "./package.json"
20
21
  },
21
22
  "types": "./src/index.ts",
22
23
  "files": [
@@ -37,7 +38,6 @@
37
38
  "@rn-primitives/slot": "*",
38
39
  "@rn-primitives/switch": "*",
39
40
  "@tabler/icons-react-native": "*",
40
- "@vvedantb/tokens": ">=0.1.1",
41
41
  "class-variance-authority": ">=0.7.0",
42
42
  "clsx": ">=2.0.0",
43
43
  "dayjs": ">=1.11.0",
@@ -55,14 +55,21 @@
55
55
  "tailwind-merge": ">=2.0.0"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
- "@gorhom/bottom-sheet": { "optional": true },
59
- "@react-native-community/datetimepicker": { "optional": true },
60
- "dayjs": { "optional": true },
61
- "expo-router": { "optional": true }
58
+ "@gorhom/bottom-sheet": {
59
+ "optional": true
60
+ },
61
+ "@react-native-community/datetimepicker": {
62
+ "optional": true
63
+ },
64
+ "dayjs": {
65
+ "optional": true
66
+ },
67
+ "expo-router": {
68
+ "optional": true
69
+ }
62
70
  },
63
71
  "devDependencies": {
64
72
  "@types/react": "^19.1.0",
65
- "@vvedantb/tokens": "workspace:*",
66
73
  "react": "^19.1.0",
67
74
  "typescript": "^5.9.0",
68
75
  "vitest": "^3.2.0"
package/src/colors.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { tokens } from "@vvedantb/tokens/native";
1
+ import { tokens } from "./tokens";
2
2
 
3
3
  export const NEUTRAL_100 = "#f5f5f5";
4
4
  export const NEUTRAL_500 = tokens.color.muted.light;
package/src/floating.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Platform, type ViewStyle } from "react-native";
2
- import { tokens } from "@vvedantb/tokens/native";
2
+ import { tokens } from "./tokens";
3
3
 
4
4
  export const FLOATING_INSET = tokens.spacing.unit;
5
5
  export const FLOATING_TAB_BAR_HEIGHT = 64;
package/src/theme.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext, type ReactNode } from "react";
2
- import { tokens } from "@vvedantb/tokens/native";
2
+ import { tokens } from "./tokens";
3
3
 
4
4
  export const DEFAULT_ACCENT = "#db2777";
5
5
 
package/src/tokens.ts ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * JS tokens for React Native. Values match `tokens.css`
3
+ * (oklch neutrals → hex, 1rem = 16).
4
+ *
5
+ * Copy of `packages/ui/tokens/src/native.ts`, kept here so native-ui has no
6
+ * dependency on the web package. A test in `@vvedantb/ui` fails when the two
7
+ * differ below this header: change both together.
8
+ */
9
+ export const tokens = {
10
+ color: {
11
+ background: { light: "#f6f6f6", dark: "#1f1f1f" },
12
+ foreground: { light: "#242426", dark: "#fafafa" },
13
+ muted: { light: "#737373", dark: "#b3b3b3" },
14
+ border: { light: "#e5e5e5", dark: "#474747" },
15
+ surface: { light: "#ffffff", dark: "#242426" },
16
+ surfaceSecondary: { light: "#f2f2f2", dark: "#2a2a2c" },
17
+ surfaceCard: { light: "#fafafa", dark: "#2a2a2c" },
18
+ separator: { light: "#ebebeb", dark: "#404040" },
19
+ white: "#ffffff",
20
+ black: "#000000",
21
+ hairline: {
22
+ light: "rgba(255, 255, 255, 0.7)",
23
+ dark: "rgba(255, 255, 255, 0.12)",
24
+ },
25
+ fill: {
26
+ light: "rgba(255, 255, 255, 0.86)",
27
+ dark: "rgba(28, 28, 30, 0.88)",
28
+ },
29
+ },
30
+ radius: {
31
+ lg: 16,
32
+ field: 20,
33
+ md: 14,
34
+ sm: 12,
35
+ card: 24,
36
+ pill: 999,
37
+ },
38
+ spacing: {
39
+ unit: 16,
40
+ },
41
+ } as const;
42
+
43
+ export type Tokens = typeof tokens;