@rigerc/ink-ui 0.0.0-stage → 0.41.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 CHANGED
@@ -1,3 +1,171 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white)
4
+ ![Node.js](https://img.shields.io/badge/Node.js-339933?style=flat-square&logo=node.js&logoColor=white)
5
+ ![npm](https://img.shields.io/npm/v/%40rigerc%2Fink-ui?style=flat-square&color=CB3837)
6
+ ![MIT](https://img.shields.io/badge/licence-MIT-22C55E?style=flat-square)
7
+
8
+ **React component library for Ink CLIs**
9
+
10
+ <a href="https://github.com/rigerc/ink-ui">Repository</a> · <a href="https://github.com/rigerc/ink-ui/tree/main/docs">Documentation</a>
11
+
12
+ </div>
13
+
14
+ ## Features
15
+
16
+ - **28 ready-made components**, pre-styled and ready to drop in:
17
+ - **Inputs** — `TextInput`, `EmailInput` (domain completion), `PasswordInput` (masked), `ConfirmInput`
18
+ - **Lists** — `UnorderedList`, `OrderedList` (both nestable), `Table`
19
+ - **Selection & navigation** — `Select`, `MultiSelect`, `Tabs`, `Stepper`, `Switch`, `Toggle`, `SelectableRow`
20
+ - **Status & feedback** — `Spinner`, `ProgressBar`, `SkeletonBar`, `SkeletonRows`, `StatusMessage`, `Alert`, `Badge`, `Toast`
21
+ - **Layout & chrome** — `Banner`, `Header`, `Panel` (bordered pane, optional focus state), `Columns`, `FooterHints`, `KeyValue`, `LoadingScreen`, `ScrollView`
22
+ - **Behaviour hooks** — `useTabs` and `useListCursor` own the keyboard state that every consumer used to hand-roll, so Tab/Shift+Tab and arrow/vim navigation behave the same everywhere
23
+ - **Full [@inkjs/ui](https://github.com/vadimdemedes/ink-ui) parity** — every upstream component has an equivalent, plus a dozen more the design system adds on top
24
+ - **Colourblind-safe by design** — state is signalled by shape, case, and glyph, never colour alone
25
+ - **Design tokens included** — established palettes (`colors`, `softColors`, `tonalColors`), spacing, and reusable semantic symbols, ASCII fallbacks, border presets, and motion tokens
26
+ - **Full TypeScript support** — ships compiled output with `.d.ts` declarations for every component and token type
27
+ - **ESM only, zero config** — no runtime bundling step; just import and render
28
+ - **Peer-dependency light** — only requires `ink ≥ 7` and `react ≥ 19`
29
+
30
+ ## Install
31
+
32
+ ```sh
33
+ npm install @rigerc/ink-ui
34
+ ```
35
+
36
+ Until this fork is published under the `@rigerc` npm scope, you can
37
+ install directly from its GitHub branch:
38
+
39
+ ```sh
40
+ npm install github:rigerc/ink-ui#chore/rebrand-rigerc-scope
41
+ ```
42
+
43
+ Git installs build `dist/` automatically using the package's `prepare` script.
44
+ After publication, use the scoped npm install command above.
45
+
46
+
47
+ `ink` and `react` are peer dependencies and must be installed separately:
48
+
49
+ ```sh
50
+ npm install ink react
51
+ ```
52
+
53
+ ### Ink compatibility
54
+
55
+ `@rigerc/ink-ui` supports Ink 7 and Ink 8 on Node.js 22 or later. Ink 8
56
+ requires React 19.3 or later; when installing Ink 8, install a matching
57
+ version of React:
58
+
59
+ ```sh
60
+ npm install ink@^8 react@^19.3.0
61
+ ```
62
+
63
+ The library preserves the same public component API across both Ink majors.
64
+
65
+
66
+ ### Building with an AI agent
67
+
68
+ The package ships `AGENTS.md`, a short brief covering the composition rules and house conventions that the type definitions cannot express — which components own the keyboard, what to compose for a given screen, and the traps. Point your agent at it:
69
+
70
+ ```
71
+ node_modules/@rigerc/ink-ui/AGENTS.md
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ ```tsx
77
+ import React from "react"
78
+ import { render } from "ink"
79
+ import { Banner, Header, Badge, Spinner, colors } from "@rigerc/ink-ui"
80
+
81
+ const App = () => (
82
+ <>
83
+ <Banner title="my-tool" subtitle="v1.0.0" />
84
+ <Header subtitle="Synchronising files…">Status</Header>
85
+ <Badge variant="success">done</Badge>
86
+ <Spinner label="Loading…" />
87
+ </>
88
+ )
89
+
90
+ render(<App />)
91
+ ```
92
+
93
+ Inputs report their value through `onChange`/`onSubmit`, and lists nest with a shape-distinct marker per level:
94
+
95
+ ```tsx
96
+ import { Text } from "ink"
97
+ import { EmailInput, PasswordInput, UnorderedList } from "@rigerc/ink-ui"
98
+
99
+ const SignUp = () => (
100
+ <>
101
+ <EmailInput placeholder="you@example.com" onSubmit={setEmail} />
102
+ <PasswordInput placeholder="Password" onSubmit={setPassword} />
103
+ <UnorderedList>
104
+ <UnorderedList.Item>
105
+ <Text>Choose a plan</Text>
106
+ <UnorderedList>
107
+ <UnorderedList.Item>
108
+ <Text>Free</Text>
109
+ </UnorderedList.Item>
110
+ <UnorderedList.Item>
111
+ <Text>Pro</Text>
112
+ </UnorderedList.Item>
113
+ </UnorderedList>
114
+ </UnorderedList.Item>
115
+ </UnorderedList>
116
+ </>
117
+ )
118
+ ```
119
+
120
+ Components stay presentational and controlled — they take `active`/`value` and render. The behaviour hooks supply the keyboard state to drive them, so the two compose without either forcing the other:
121
+
122
+ ```tsx
123
+ import { Tabs, useTabs, useListCursor } from "@rigerc/ink-ui"
124
+
125
+ const items = [
126
+ { value: "open", label: "Open", count: 3 },
127
+ { value: "done", label: "Done" },
128
+ ]
129
+
130
+ const Inbox = ({ rows }) => {
131
+ const { active } = useTabs(items) // Tab or → forward, Shift+Tab or ← back, wraps
132
+ const { cursor } = useListCursor(rows.length) // ↑/↓ and k/j, clamps at the ends
133
+ return <Tabs active={active} items={items} />
134
+ }
135
+ ```
136
+
137
+ Both take `{ isActive }` so a screen with several focus regions can gate them, and `useListCursor` takes `{ wrap }` for genuinely circular lists. `useTabs` wraps by default because a tab bar is a ring; `useListCursor` clamps because a list has ends.
138
+
139
+ All components accept only the props they need — no theme provider or context required. Design tokens are plain objects:
140
+
141
+ ```ts
142
+ import { colors, spacing } from "@rigerc/ink-ui"
143
+
144
+ // colors.accent → "#FF8C00"
145
+ // colors.success → "#5FD7A7"
146
+ // spacing.md → 3
147
+ ```
148
+
149
+ ## Development
150
+
151
+ ```sh
152
+ git clone https://github.com/rigerc/ink-ui.git
153
+ cd ink-ui
154
+ npm install
155
+ npm run dev
156
+ ```
157
+
158
+ ### Interactive gallery
159
+
160
+ Run `npm run demo` to browse live component previews. Use ↑/↓ or j/k
161
+ to select an entry, Enter to focus an interactive example, and Esc to
162
+ return to the gallery. The **Stepper** preview demonstrates async
163
+ `canProceed` validation, back/cancel, completion, restart, ASCII progress
164
+ and vertical progress (space marks details ready, b goes back, a changes
165
+ glyphs, v changes layout, and r restarts). The **Design tokens** preview
166
+ shows shared colors, Unicode/ASCII symbols, borders, spacing and spinner
167
+ frames; press `a` while focused to switch the glyph set.
168
+
169
+ `npm run build` compiles TypeScript to `dist/`. `npm run dev` runs the compiler in watch mode.
170
+
171
+ 📚 **Full documentation → [ink-ui/docs](https://github.com/rigerc/ink-ui/tree/main/docs)**