@hopline/ux4g-react-native 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hopline Pvt Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @hopline/ux4g-react-native
2
+
3
+ React Native components for **UX4G** — India's government design system (NeGD · MeitY · [ux4g.gov.in](https://ux4g.gov.in)). Unofficial, community packaging by [Hopline](https://hopline.co).
4
+
5
+ **41 components**, genuinely native (RN primitives + `react-native-svg` — no WebView, no DOM), strict TypeScript (no `any`), themeable, and driven by a single design-token source of truth.
6
+
7
+ ```sh
8
+ npm install @hopline/ux4g-react-native react-native-svg
9
+ # or: pnpm add / yarn add
10
+ ```
11
+
12
+ > Peer deps: `react >=18`, `react-native >=0.73`, `react-native-svg >=15`. Works in bare RN and Expo.
13
+
14
+ ## Quick start
15
+
16
+ Wrap your app in `ThemeProvider`, then use components:
17
+
18
+ ```tsx
19
+ import { ThemeProvider, Button, Input, Card } from "@hopline/ux4g-react-native";
20
+
21
+ export default function App() {
22
+ return (
23
+ <ThemeProvider>
24
+ <Card title="Apply for a scheme">
25
+ <Input label="Full name" required />
26
+ <Button onPress={submit}>Submit</Button>
27
+ </Card>
28
+ </ThemeProvider>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ## Theming
34
+
35
+ The whole system re-skins from two ramps + the font families ("Theme Craft"). Pass a full
36
+ 50–900 colour ramp:
37
+
38
+ ```tsx
39
+ import { ThemeProvider, ramp } from "@hopline/ux4g-react-native";
40
+
41
+ <ThemeProvider primary={{ ...ramp.violet, 600: "#0EA5E9" }}>
42
+ {/* every component now uses your brand colour */}
43
+ </ThemeProvider>;
44
+ ```
45
+
46
+ Or build a theme object once with `makeTheme({ primary, secondary, fontFamily })` and pass it
47
+ as the `theme` prop. Read the active theme anywhere with `useUX4GTheme()`. Every component also
48
+ accepts an optional `theme` prop override.
49
+
50
+ ### Fonts
51
+
52
+ The default theme references `NotoSans` (body/display), `Roboto-Medium` (UI labels) and
53
+ `RedHatMono` (mono). Register these in your app (e.g. `expo-font` / `@expo-google-fonts`), or
54
+ override `fontFamily` to use your own.
55
+
56
+ ## Components (41)
57
+
58
+ | Group | Components |
59
+ |---|---|
60
+ | **Actions** | Button, IconButton |
61
+ | **Forms** | Input, Textarea, Select, Checkbox, Radio, Switch, Search, DatePicker, RangeSlider, ColorPicker, FileUpload |
62
+ | **Display** | Card, Badge, Chip, Avatar, Comment |
63
+ | **Feedback** | Alert, Progress, Spinner, EmptyState, FeedbackWidget |
64
+ | **Overlay** | Modal, Tooltip, Menu, Toast, Popover |
65
+ | **Data** | Table, Accordion, Pagination, List, Chart, IndiaMap |
66
+ | **Navigation** | Tabs, Breadcrumb, Stepper, Navbar, Footer |
67
+ | **Media** | Carousel |
68
+ | **Accessibility** | AccessibilityWidget |
69
+
70
+ Plus `IndiaGeo` (the SVG geography data behind `IndiaMap`).
71
+
72
+ ## Design tokens (single source of truth)
73
+
74
+ The raw token primitives (colour ramps, spacing, radius, border) live in
75
+ [`tokens/ux4g.primitives.tokens.json`](./tokens/ux4g.primitives.tokens.json) in the
76
+ [DTCG](https://tr.designtokens.org/) format and are emitted to `src/tokens.generated.ts` by
77
+ `node scripts/gen-tokens.mjs`. The semantic theme (aliases, shadows, type scale) is assembled
78
+ in `theme.ts`. Edit the JSON, not the generated file — the same DTCG source can feed web
79
+ (CSS), Compose, and SwiftUI via Style Dictionary.
80
+
81
+ ## Native performance
82
+
83
+ These are real React Native components, so on the **New Architecture** (Fabric + Hermes, the
84
+ default on RN 0.76+/recent Expo) they render at native speed.
85
+
86
+ **Lists & virtualization.** `Select` virtualizes its dropdown with `FlatList`, so long option
87
+ lists (countries, currencies) mount only the visible window. Components that render inherently
88
+ **bounded** collections — `Tabs`, `Breadcrumb`, `Pagination`, `Accordion`, `Chart`, `IndiaMap`
89
+ (37 fixed regions), `Carousel` — use `Array.map` deliberately; virtualizing them would be wrong.
90
+
91
+ `Table` and `List` render the rows/items you give them **eagerly** (no windowing). They're
92
+ designed to sit inside your page layout, so for **large datasets paginate** them with the
93
+ `Pagination` component (render a page of rows at a time) rather than handing them thousands of
94
+ rows — or wrap your data in your own `FlatList`.
95
+
96
+ **Dropping to native.** For genuine performance hot-paths (heavy compute, a platform-native
97
+ view, camera/ML), drop to Kotlin/Swift via the [Expo Modules API](https://docs.expo.dev/modules/)
98
+ and call it from JS — you stay in React Native to do it.
99
+
100
+ ## Accessibility
101
+
102
+ Components ship sensible roles, labels and states (e.g. `Checkbox` exposes `accessibilityState`,
103
+ `Button` exposes `disabled`, overlays trap and label their controls). The `AccessibilityWidget`
104
+ provides an in-app a11y panel (text scaling, contrast, dyslexia/ADHD aids, etc.). On native,
105
+ prefer cooperating with OS settings (Dynamic Type, Reduce Motion, screen readers) for the
106
+ features the OS already owns.
107
+
108
+ ## License
109
+
110
+ MIT © Hopline. UX4G is © NeGD · MeitY, Government of India; this is unofficial community packaging.