namps-native 1.0.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/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # namps-native — React Native UI Library
2
+
3
+ A calm, premium, **token-driven** component library for React Native. Typography-first, fully typed, dark-mode native, and designed to be **predictable enough for AI coding agents to generate correctly with little guidance**.
4
+
5
+ > Visual reference: open **`namps-native UI.dc.html`** in the project root for the full living design system — every token and component, light & dark.
6
+
7
+ ---
8
+
9
+ ## Why namps-native
10
+
11
+ - **Token-driven** — no component hardcodes a color, space, or radius. Everything resolves from the theme, so dark mode and custom brands work with zero component changes.
12
+ - **One consistent API** — the same `variant`, `size`, `loading`, `disabled`, `onPress`/`onValueChange`, and `style` props recur everywhere. Learn one component, predict the rest.
13
+ - **Composition over configuration** — small primitives assemble into rich screens.
14
+ - **Fully typed** — every prop, hook, and token is exported and JSDoc-documented.
15
+ - **Tree-shakeable** — `sideEffects: false` + per-component entry points; importing `Button` never pulls in `BottomSheet`.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ npm i namps-native react-native-reanimated react-native-gesture-handler react-native-svg
21
+ ```
22
+
23
+ Load the fonts (`Newsreader`, `Geist`, `JetBrainsMono`) via `expo-font`, and add the Reanimated Babel plugin.
24
+
25
+ ## Quickstart
26
+
27
+ ```tsx
28
+ import { ThemeProvider, Card, Heading, Text, Button } from 'namps-native';
29
+
30
+ export default function App() {
31
+ return (
32
+ <ThemeProvider defaultPreference="system">
33
+ <Card variant="elevated" padding={5}>
34
+ <Heading level={3}>Weekly digest</Heading>
35
+ <Text tone="muted">Everything that changed while you were away.</Text>
36
+ <Button onPress={open}>Open report</Button>
37
+ </Card>
38
+ </ThemeProvider>
39
+ );
40
+ }
41
+ ```
42
+
43
+ See **`example/App.tsx`** for a fuller screen.
44
+
45
+ ## Theming
46
+
47
+ ```tsx
48
+ import { ThemeProvider, createTheme, lightTheme } from 'namps-native';
49
+
50
+ // Override only what you need — the rest inherits.
51
+ const brand = createTheme(lightTheme, { colors: { accent: '#2A6FDB' } });
52
+
53
+ <ThemeProvider light={brand}>…</ThemeProvider>
54
+ ```
55
+
56
+ Read tokens anywhere:
57
+
58
+ ```tsx
59
+ const theme = useTheme();
60
+ <View style={{ backgroundColor: theme.colors.surface, padding: theme.space[4], borderRadius: theme.radius.lg }} />;
61
+ ```
62
+
63
+ Control the scheme: `const { scheme, toggle, setPreference } = useColorSchemeControl();`
64
+
65
+ ## Design tokens
66
+
67
+ | Group | Access | Notes |
68
+ |---|---|---|
69
+ | Color (semantic) | `theme.colors.*` | `bg surface elevated sunken border text textMuted accent onAccent success warning danger info` (+ `*Soft`) |
70
+ | Spacing | `theme.space[1..12]` | 4-point scale (`space[4] === 16`) |
71
+ | Radius | `theme.radius.{sm,md,lg,xl,full}` | |
72
+ | Type | `theme.fontSize` · `fontFamily` · `fontWeight` · `lineHeight` | serif display / grotesque body / mono |
73
+ | Elevation | `theme.shadow.{sm,md,lg}` | warm-tinted, deepen in dark |
74
+ | Motion | `theme.motion.duration` · `theme.motion.easing` | `easing.standard = [0.2,0,0,1]` |
75
+ | Sizing | `theme.sizing.{sm,md,lg}` | shared control heights/padding |
76
+
77
+ Raw primitives and scales are also exported: `import { tokens } from 'namps-native'`.
78
+
79
+ ## Conventions (read this before generating UI)
80
+
81
+ Every interactive component follows these rules — rely on them:
82
+
83
+ - **Variants:** `primary · secondary · soft · ghost · danger`
84
+ - **Sizes:** `sm · md · lg`
85
+ - **State:** stateful inputs are controlled via `value` + `onValueChange` (or `onChangeText`), or uncontrolled via `defaultValue`. Use the `useControllableState` hook for your own.
86
+ - **Loading / disabled:** `loading` shows a spinner and blocks presses; `disabled` dims and blocks.
87
+ - **Icons:** `leftIcon` / `rightIcon` on Button; `icon` on IconButton. Icons take `size` + `color`, inherit `currentColor`.
88
+ - **Events:** `onPress` for actions, `onValueChange` for values, `onClose` for overlays.
89
+ - **Styling overrides:** every component takes `style` (merged onto the root) and `testID`.
90
+ - **Accessibility:** roles are set automatically. **Icon-only controls require `accessibilityLabel`.** Tap targets are ≥44px.
91
+
92
+ ## Components
93
+
94
+ **Implemented in this scaffold** (reference implementations, fully typed + tested pattern):
95
+ `Button` · `IconButton` · `Text` · `Heading` · `Card` · `Input` · `Switch` · `Checkbox` · `Badge`
96
+
97
+ **Specified & designed** (in `namps-native UI.dc.html`), to implement following the same folder + prop conventions:
98
+ `TextArea` · `Radio` · `SearchBar` · `Chip` · `Avatar`/`AvatarGroup` · `Divider` · `List` · `Accordion` · `Tabs` · `Progress` · `Spinner` · `Skeleton` · `Alert` · `Banner` · `Toast` · `Snackbar` · `Modal` · `Dialog` · `BottomSheet` · `Popover` · `Menu` · `Dropdown` · `NavigationBar` · `FloatingActionButton`
99
+
100
+ Each component lives in `src/components/<Name>/` with `<Name>.tsx`, `index.ts`, `<Name>.stories.tsx`, and `<Name>.test.tsx`. Copy `Button` (variants/sizes/loading) or `Switch` (controlled state + Reanimated) as the template.
101
+
102
+ ## Project structure
103
+
104
+ ```
105
+ namps-native-ui/
106
+ ├─ src/
107
+ │ ├─ theme/ tokens.ts · themes.ts · ThemeProvider.tsx · useTheme.ts
108
+ │ ├─ hooks/ useControllableState · useDisclosure
109
+ │ ├─ utils/ color helpers
110
+ │ ├─ icons/ line icon set (24×24, 1.7 stroke, currentColor)
111
+ │ ├─ components/ one folder per component
112
+ │ ├─ types.ts shared Variant/Size/Status/Styleable/A11y types
113
+ │ └─ index.ts public API
114
+ ├─ example/ Expo demo app
115
+ ├─ .storybook/ stories config
116
+ ├─ .github/ CI (typecheck · lint · test · build · release)
117
+ ├─ tsup.config.ts ESM+CJS+d.ts, tree-shaking
118
+ └─ tsconfig.json
119
+ ```
120
+
121
+ ## Scripts
122
+
123
+ `npm run build` · `dev` · `typecheck` · `lint` · `test` · `storybook`
124
+
125
+ ## License
126
+
127
+ MIT