@kamiui/kami 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/README.md +222 -0
- package/dist/index-CVNk3zin.js +4163 -0
- package/dist/kami.js +75 -0
- package/dist/kami.umd.cjs +16 -0
- package/dist/web-4j5o-jby.js +42 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Kami
|
|
2
|
+
|
|
3
|
+
> Native-feeling React UI library for Capacitor and mobile web.
|
|
4
|
+
|
|
5
|
+
**iOS-native feel. Zero compromise.** Spring physics, 44px touch targets, haptic feedback, Capacitor-aware β all powered by design tokens.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@jlgrimes/kami)
|
|
8
|
+
[](https://github.com/jlgrimes/kami/actions/workflows/ci.yml)
|
|
9
|
+
[](https://kami-docs.vercel.app/docs)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
### Local Development (Workspace)
|
|
16
|
+
|
|
17
|
+
Since this package is developed alongside `ichikara` in the same workspace:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# In your app directory (e.g. ichikara/)
|
|
21
|
+
npm install ../kami
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### From npm (Published)
|
|
25
|
+
|
|
26
|
+
*Once published:*
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @jlgrimes/kami
|
|
30
|
+
# or
|
|
31
|
+
yarn add @jlgrimes/kami
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Peer dependencies:** React β₯ 18
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Quickstart
|
|
39
|
+
|
|
40
|
+
### 1. Import the stylesheet
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
// In your app root (e.g. main.tsx)
|
|
44
|
+
import '@jlgrimes/kami/dist/style.css'; // β design tokens + base styles
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Use components
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import {
|
|
51
|
+
Button,
|
|
52
|
+
Input,
|
|
53
|
+
BottomSheet,
|
|
54
|
+
SearchBar,
|
|
55
|
+
Switch,
|
|
56
|
+
Select,
|
|
57
|
+
Avatar,
|
|
58
|
+
EmptyState,
|
|
59
|
+
} from '@jlgrimes/kami';
|
|
60
|
+
|
|
61
|
+
function App() {
|
|
62
|
+
const [open, setOpen] = useState(false);
|
|
63
|
+
const [query, setQuery] = useState('');
|
|
64
|
+
const [lang, setLang] = useState<string | null>(null);
|
|
65
|
+
const [on, setOn] = useState(false);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<>
|
|
69
|
+
{/* Buttons */}
|
|
70
|
+
<Button onClick={() => setOpen(true)}>Open Sheet</Button>
|
|
71
|
+
<Button variant="secondary">Cancel</Button>
|
|
72
|
+
<Button variant="ghost">Learn more</Button>
|
|
73
|
+
|
|
74
|
+
{/* Search bar */}
|
|
75
|
+
<SearchBar
|
|
76
|
+
value={query}
|
|
77
|
+
onChange={setQuery}
|
|
78
|
+
showCancel={query.length > 0}
|
|
79
|
+
onCancel={() => setQuery('')}
|
|
80
|
+
placeholder="Search lessonsβ¦"
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
{/* iOS switch */}
|
|
84
|
+
<Switch
|
|
85
|
+
checked={on}
|
|
86
|
+
onChange={setOn}
|
|
87
|
+
label="Enable notifications"
|
|
88
|
+
sublabel="Get lesson reminders"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
{/* BottomSheet-based picker */}
|
|
92
|
+
<Select
|
|
93
|
+
options={[
|
|
94
|
+
{ value: 'ja', label: 'Japanese', icon: 'π―π΅' },
|
|
95
|
+
{ value: 'ko', label: 'Korean', icon: 'π°π·' },
|
|
96
|
+
]}
|
|
97
|
+
value={lang}
|
|
98
|
+
onChange={setLang}
|
|
99
|
+
label="Language"
|
|
100
|
+
searchable
|
|
101
|
+
clearable
|
|
102
|
+
onClear={() => setLang(null)}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
{/* BottomSheet */}
|
|
106
|
+
<BottomSheet open={open} onClose={() => setOpen(false)} title="Hello">
|
|
107
|
+
<p>Sheet content goes here.</p>
|
|
108
|
+
</BottomSheet>
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Component Docs
|
|
117
|
+
|
|
118
|
+
**Live docs:** [kami-docs.vercel.app/docs](https://kami-docs.vercel.app/docs)
|
|
119
|
+
|
|
120
|
+
Docs source lives in a separate repo: https://github.com/jlgrimes/kami-docs
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Component Reference
|
|
125
|
+
|
|
126
|
+
### Core UI
|
|
127
|
+
|
|
128
|
+
| Component | Description |
|
|
129
|
+
|-----------|-------------|
|
|
130
|
+
| `Button` | iOS-style tap button β primary, secondary, ghost variants |
|
|
131
|
+
| `Input` | Text input with label, error, helper, clear, password-reveal |
|
|
132
|
+
| `SearchBar` | iOS search bar with spring-animated Cancel button |
|
|
133
|
+
| `Switch` | iOS UISwitch toggle β spring physics, haptics, 3 colour variants |
|
|
134
|
+
| `Select` | BottomSheet-based picker β single, multi, searchable |
|
|
135
|
+
| `SegmentedControl` | Sliding-pill segment tabs (2β6 segments) |
|
|
136
|
+
| `Badge` | Status badge β accent, success, warning, danger, info |
|
|
137
|
+
| `Chip` + `ChipGroup` | Pill chips for tags/filters |
|
|
138
|
+
| `Avatar` + `AvatarGroup` | Image + initials fallback, online dot, skeleton |
|
|
139
|
+
| `EmptyState` | Full-screen / contained zero-content placeholder |
|
|
140
|
+
|
|
141
|
+
### Feedback & Overlays
|
|
142
|
+
|
|
143
|
+
| Component | Description |
|
|
144
|
+
|-----------|-------------|
|
|
145
|
+
| `BottomSheet` | iOS-style modal sheet with spring enter/exit + drag-to-dismiss |
|
|
146
|
+
| `ActionSheet` | Contextual action list (iOS UIActionSheet) |
|
|
147
|
+
| `Toast` | Non-blocking ephemeral message β success/error/info/warning |
|
|
148
|
+
| `Skeleton` | Shimmer loading placeholders |
|
|
149
|
+
| `ErrorBoundary` | React error boundary with retry support |
|
|
150
|
+
|
|
151
|
+
### Navigation
|
|
152
|
+
|
|
153
|
+
| Component | Description |
|
|
154
|
+
|-----------|-------------|
|
|
155
|
+
| `NavigationStack` | Push/pop navigation with iOS slide + swipe-back |
|
|
156
|
+
| `TabBar` | Floating pill tab bar |
|
|
157
|
+
| `Navbar` | Navigation header with back button + scroll-to-top |
|
|
158
|
+
| `Page` | Scrollable page container |
|
|
159
|
+
|
|
160
|
+
### Interaction
|
|
161
|
+
|
|
162
|
+
| Component | Description |
|
|
163
|
+
|-----------|-------------|
|
|
164
|
+
| `PullToRefresh` | Overscroll-to-refresh with SVG arc indicator |
|
|
165
|
+
| `List` + `ListItem` | iOS-style grouped list |
|
|
166
|
+
| `SectionTitle` | Section header label |
|
|
167
|
+
|
|
168
|
+
### Hooks
|
|
169
|
+
|
|
170
|
+
| Hook | Description |
|
|
171
|
+
|------|-------------|
|
|
172
|
+
| `useHaptics()` | Unified haptic feedback: impact / notification / selection |
|
|
173
|
+
| `usePan(options)` | Drag delta + velocity via native pointer events |
|
|
174
|
+
| `usePinch(options)` | Two-finger scale gesture |
|
|
175
|
+
| `useLongPress(options)` | 500ms hold with haptic + movement cancellation |
|
|
176
|
+
| `useFocusTrap(ref, active, onEscape)` | Keyboard focus trap for modals |
|
|
177
|
+
| `useNavigation()` | push/pop within a NavigationStack |
|
|
178
|
+
| `useSwipeBack()` | Programmatic swipe-back trigger |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Design Tokens
|
|
183
|
+
|
|
184
|
+
Kami uses CSS custom properties for all colours, radii, shadows, and typography. Override any token in your own stylesheet:
|
|
185
|
+
|
|
186
|
+
```css
|
|
187
|
+
:root {
|
|
188
|
+
--color-accent: #e63946; /* primary interactive colour */
|
|
189
|
+
--color-ink: #1a1a2e; /* primary text */
|
|
190
|
+
--color-paper: #f8f4ef; /* page background */
|
|
191
|
+
--color-muted: #8a8a9a; /* secondary text */
|
|
192
|
+
--color-success: #2d6a4f;
|
|
193
|
+
--color-warning: #e9c46a;
|
|
194
|
+
--color-danger: #e63946;
|
|
195
|
+
--radius-sm: 10px;
|
|
196
|
+
--radius-full: 9999px;
|
|
197
|
+
--font-sans: 'Inter', system-ui, sans-serif;
|
|
198
|
+
--font-mono: 'JetBrains Mono', monospace;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Dark mode is handled automatically via `@media (prefers-color-scheme: dark)`.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Publish a New Version
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# 1. Bump version in package.json
|
|
210
|
+
npm version patch # or minor / major
|
|
211
|
+
|
|
212
|
+
# 2. Push the tag β GitHub Actions publishes automatically
|
|
213
|
+
git push --follow-tags
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Requires `NPM_TOKEN` secret set in GitHub repository settings (Settings β Secrets β Actions).
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
MIT Β© Jared Grimes
|