@rajeev02/ui 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +152 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # @rajeev02/ui
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@rajeev02/ui.svg)](https://www.npmjs.com/package/@rajeev02/ui)
4
+ [![license](https://img.shields.io/npm/l/@rajeev02/ui.svg)](https://github.com/Rajeev02/rajeev-sdk/blob/main/LICENSE)
5
+
6
+ **Adaptive UI system** with design tokens, multi-device detection, responsive utilities, accessibility features, and theming — optimized for Indian language typography.
7
+
8
+ Part of [Rajeev SDK](https://github.com/Rajeev02/rajeev-sdk) — cross-platform infrastructure libraries for building apps that work everywhere.
9
+
10
+ ## Why use this?
11
+
12
+ - **Device-aware design** — Automatically adapts touch targets, font sizes, and layouts for phone, tablet, watch, TV, and car
13
+ - **Complete token system** — Colors, spacing, typography, border radius, shadows, z-index — all in one package
14
+ - **Indian language support** — Typography stack with proper line heights for Devanagari, Tamil, Bengali, Telugu, and 6 more scripts
15
+ - **Dark mode built-in** — `getTheme("light")` / `getTheme("dark")` — full semantic token set for both
16
+ - **Accessibility-first** — WCAG contrast ratios, minimum touch targets (44dp+ on phone, 48dp+ on watch)
17
+ - **Pure TypeScript** — No native dependencies. Works with React Native, Expo, and react-native-web.
18
+
19
+ ## Platform Support
20
+
21
+ | Platform | Engine | Status |
22
+ | ------------ | ---------- | ------ |
23
+ | iOS | TypeScript | ✅ |
24
+ | Android | TypeScript | ✅ |
25
+ | Web | TypeScript | ✅ |
26
+ | watchOS | TypeScript | ✅ |
27
+ | Wear OS | TypeScript | ✅ |
28
+ | Android Auto | TypeScript | ✅ |
29
+ | TV | TypeScript | ✅ |
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install @rajeev02/ui
35
+ ```
36
+
37
+ ### Peer Dependencies
38
+
39
+ - `react` >= 18.3.0
40
+ - `react-native` >= 0.84.0 _(optional)_
41
+
42
+ ## Quick Start
43
+
44
+ ### Design Tokens
45
+
46
+ ```typescript
47
+ import {
48
+ colors,
49
+ spacing,
50
+ typography,
51
+ borderRadius,
52
+ shadows,
53
+ } from "@rajeev02/ui";
54
+
55
+ const styles = StyleSheet.create({
56
+ container: {
57
+ padding: spacing.lg, // 16
58
+ backgroundColor: colors.background.primary,
59
+ borderRadius: borderRadius.md, // 8
60
+ ...shadows.sm,
61
+ },
62
+ title: {
63
+ fontSize: typography.fontSize.xl, // 20
64
+ fontWeight: typography.fontWeight.bold,
65
+ fontFamily: typography.fontFamily.sans,
66
+ color: colors.text.primary,
67
+ },
68
+ });
69
+ ```
70
+
71
+ ### Device Detection
72
+
73
+ ```typescript
74
+ import {
75
+ detectDeviceType,
76
+ getMinTouchTarget,
77
+ getResponsiveValue,
78
+ } from "@rajeev02/ui";
79
+
80
+ const device = detectDeviceType(screenWidth, screenHeight);
81
+ // → "phone" | "tablet" | "watch" | "tv" | "car" | "desktop"
82
+
83
+ const touchTarget = getMinTouchTarget(device);
84
+ // phone → 44, tablet → 44, watch → 48, tv → 56, car → 64
85
+
86
+ const fontSize = getResponsiveValue(device, {
87
+ phone: 16,
88
+ tablet: 18,
89
+ watch: 12,
90
+ tv: 24,
91
+ car: 20,
92
+ desktop: 16,
93
+ });
94
+ ```
95
+
96
+ ### Theming
97
+
98
+ ```typescript
99
+ import { getTheme } from "@rajeev02/ui";
100
+
101
+ const lightTheme = getTheme("light");
102
+ const darkTheme = getTheme("dark");
103
+
104
+ // Use in your app
105
+ <View style={{ backgroundColor: theme.colors.background.primary }}>
106
+ <Text style={{ color: theme.colors.text.primary }}>Hello</Text>
107
+ </View>
108
+ ```
109
+
110
+ ## Color Palette
111
+
112
+ | Token | Light | Dark | Usage |
113
+ | -------------------- | --------- | --------- | ---------------------- |
114
+ | `colors.primary.500` | `#6366F1` | `#818CF8` | Primary actions, links |
115
+ | `colors.accent.500` | `#F97316` | `#FB923C` | Saffron accent, CTAs |
116
+ | `colors.success` | `#10B981` | `#34D399` | Success states |
117
+ | `colors.error` | `#EF4444` | `#F87171` | Error states |
118
+ | `colors.warning` | `#F59E0B` | `#FBBF24` | Warning states |
119
+
120
+ ## Spacing Scale
121
+
122
+ | Token | Value | Usage |
123
+ | ------------- | ----- | ---------------- |
124
+ | `spacing.xs` | 4 | Tight gaps |
125
+ | `spacing.sm` | 8 | Small padding |
126
+ | `spacing.md` | 12 | Medium padding |
127
+ | `spacing.lg` | 16 | Standard padding |
128
+ | `spacing.xl` | 24 | Section spacing |
129
+ | `spacing.xxl` | 32 | Large sections |
130
+
131
+ ## API Reference
132
+
133
+ | Export | Type | Description |
134
+ | ---------------------- | ---------- | ---------------------------------------------------------------- |
135
+ | `colors` | `object` | Full color palette (primary, accent, semantic, background, text) |
136
+ | `spacing` | `object` | Spacing scale (xs through xxxl) |
137
+ | `typography` | `object` | Font families, sizes, weights, line heights |
138
+ | `borderRadius` | `object` | Border radius scale (xs through full) |
139
+ | `shadows` | `object` | Shadow presets (xs through xxl) |
140
+ | `zIndex` | `object` | Z-index layers (base through overlay) |
141
+ | `detectDeviceType()` | `function` | Detect current device form factor |
142
+ | `getMinTouchTarget()` | `function` | Get accessible touch target size for device |
143
+ | `getResponsiveValue()` | `function` | Get device-specific value from a map |
144
+ | `getTheme()` | `function` | Get complete light/dark theme object |
145
+
146
+ ## Full Documentation
147
+
148
+ 📖 [Complete API docs with all token values](https://github.com/Rajeev02/rajeev-sdk/blob/main/docs/usage/UI.md)
149
+
150
+ ## License
151
+
152
+ MIT © 2026 [Rajeev Kumar Joshi](https://rajeev02.github.io)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rajeev02/ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Adaptive UI component system — device-aware rendering for phone, tablet, watch, TV, auto",
5
5
  "main": "lib/index.js",
6
6
  "author": "Rajeev Kumar Joshi <rajeevjoshi91@gmail.com> (https://rajeev02.github.io)",