@kud/ink-ui 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 +21 -0
- package/README.md +284 -0
- package/dist/components/Badge.d.ts +8 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +11 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Banner.d.ts +8 -0
- package/dist/components/Banner.d.ts.map +1 -0
- package/dist/components/Banner.js +5 -0
- package/dist/components/Banner.js.map +1 -0
- package/dist/components/Header.d.ts +7 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +4 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/Spinner.d.ts +6 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +6 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Table.d.ts +12 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +5 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/tokens.d.ts +17 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +15 -0
- package/dist/tokens.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Erwann Mest
|
|
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,284 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[](https://www.typescriptlang.org/)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://www.npmjs.com/package/@kud/ink-ui)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
**Opinionated design-system library for Ink CLIs — pre-styled components and design tokens for a consistent terminal UI.**
|
|
9
|
+
|
|
10
|
+
[Features](#-features) • [Quick Start](#-quick-start) • [Components](#-components) • [Tokens](#-design-tokens) • [Development](#-development)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## ✨ Features
|
|
17
|
+
|
|
18
|
+
- 🧱 **Five ready-made components** — Banner, Header, Badge, Spinner, and Table, all pre-styled and immediately usable
|
|
19
|
+
- 🎨 **Design tokens included** — a shared colour palette and spacing scale to keep every screen consistent
|
|
20
|
+
- 🟠 **Accent-driven style** — a warm `#FF8C00` accent colour gives your CLI a distinctive, coherent identity
|
|
21
|
+
- ⚡ **ESM only, zero config** — ships compiled TypeScript with full type definitions; just import and render
|
|
22
|
+
- 🔒 **Peer-dep friendly** — works with any Ink ≥ 4 and React ≥ 18 setup, no version lock-in
|
|
23
|
+
- 🧩 **Composable** — every component accepts standard Ink primitives so you can mix them with your own layouts freely
|
|
24
|
+
- 🏷 **Typed throughout** — exported types (`BadgeVariant`, `Column`, `Color`, `Spacing`) make props self-documenting in any IDE
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
### Install
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npm install @kud/ink-ui
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`ink` and `react` are peer dependencies — add them if you haven't already:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm install ink react
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Usage
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import React from "react"
|
|
46
|
+
import { render } from "ink"
|
|
47
|
+
import { Banner, Header, Badge, Spinner, Table } from "@kud/ink-ui"
|
|
48
|
+
|
|
49
|
+
const App = () => (
|
|
50
|
+
<>
|
|
51
|
+
<Banner title="My CLI" subtitle="v1.0.0" icon="◆" />
|
|
52
|
+
|
|
53
|
+
<Header subtitle="Fetching packages…">Dependencies</Header>
|
|
54
|
+
|
|
55
|
+
<Badge variant="success">installed</Badge>
|
|
56
|
+
<Badge variant="warning">outdated</Badge>
|
|
57
|
+
|
|
58
|
+
<Spinner label="Loading…" />
|
|
59
|
+
|
|
60
|
+
<Table
|
|
61
|
+
columns={[
|
|
62
|
+
{ key: "name", header: "Package", width: 20 },
|
|
63
|
+
{ key: "version", header: "Version", width: 10 },
|
|
64
|
+
]}
|
|
65
|
+
data={[
|
|
66
|
+
{ name: "ink", version: "5.0.0" },
|
|
67
|
+
{ name: "react", version: "18.3.1" },
|
|
68
|
+
]}
|
|
69
|
+
/>
|
|
70
|
+
</>
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
render(<App />)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Expected output (approximate terminal rendering):
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
◆ My CLI v1.0.0
|
|
80
|
+
|
|
81
|
+
Dependencies
|
|
82
|
+
Fetching packages…
|
|
83
|
+
|
|
84
|
+
[installed] [outdated]
|
|
85
|
+
|
|
86
|
+
⠋ Loading…
|
|
87
|
+
|
|
88
|
+
Package Version
|
|
89
|
+
ink 5.0.0
|
|
90
|
+
react 18.3.1
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🧩 Components
|
|
96
|
+
|
|
97
|
+
### `<Banner>`
|
|
98
|
+
|
|
99
|
+
Full-width title block — ideal as an app header at the top of a screen.
|
|
100
|
+
|
|
101
|
+
| Prop | Type | Default | Description |
|
|
102
|
+
| ---------- | -------- | ------- | ---------------------------------------- |
|
|
103
|
+
| `title` | `string` | — | Bold title text |
|
|
104
|
+
| `subtitle` | `string` | — | Optional dimmed subtitle rendered inline |
|
|
105
|
+
| `icon` | `string` | `"◆"` | Leading icon rendered in accent colour |
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
<Banner title="Deploy Tool" subtitle="production" icon="🚀" />
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### `<Header>`
|
|
114
|
+
|
|
115
|
+
Bold, underlined section heading. Use it to separate logical groups within a screen.
|
|
116
|
+
|
|
117
|
+
| Prop | Type | Default | Description |
|
|
118
|
+
| ---------- | -------- | ------- | ------------------------------------------ |
|
|
119
|
+
| `children` | `string` | — | The heading text |
|
|
120
|
+
| `subtitle` | `string` | — | Optional dimmed subtitle below the heading |
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<Header subtitle="3 items">Results</Header>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### `<Badge>`
|
|
129
|
+
|
|
130
|
+
Inline `[label]` tag with semantic colour variants.
|
|
131
|
+
|
|
132
|
+
| Prop | Type | Default | Description |
|
|
133
|
+
| ---------- | -------------- | -------- | ------------------------------------ |
|
|
134
|
+
| `children` | `string` | — | Label text displayed inside brackets |
|
|
135
|
+
| `variant` | `BadgeVariant` | `"info"` | Colour variant (see table below) |
|
|
136
|
+
|
|
137
|
+
| Variant | Colour |
|
|
138
|
+
| --------- | ------ |
|
|
139
|
+
| `success` | green |
|
|
140
|
+
| `error` | red |
|
|
141
|
+
| `warning` | yellow |
|
|
142
|
+
| `info` | cyan |
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
<Badge variant="error">failed</Badge>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### `<Spinner>`
|
|
151
|
+
|
|
152
|
+
Animated dots spinner in accent colour, with an optional dimmed label.
|
|
153
|
+
|
|
154
|
+
| Prop | Type | Default | Description |
|
|
155
|
+
| ------- | -------- | ------- | ----------------------------------------- |
|
|
156
|
+
| `label` | `string` | — | Optional text rendered beside the spinner |
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<Spinner label="Building…" />
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### `<Table>`
|
|
165
|
+
|
|
166
|
+
Structured data grid with bold muted column headers. Supports optional fixed column widths and truncates long values cleanly.
|
|
167
|
+
|
|
168
|
+
| Prop | Type | Description |
|
|
169
|
+
| --------- | ------------- | ------------------------------ |
|
|
170
|
+
| `data` | `T[]` | Array of row objects |
|
|
171
|
+
| `columns` | `Column<T>[]` | Column definitions (see below) |
|
|
172
|
+
|
|
173
|
+
**`Column<T>` shape:**
|
|
174
|
+
|
|
175
|
+
| Field | Type | Description |
|
|
176
|
+
| -------- | --------- | ---------------------------------- |
|
|
177
|
+
| `key` | `keyof T` | Object key to read for this column |
|
|
178
|
+
| `header` | `string` | Column heading text |
|
|
179
|
+
| `width` | `number` | Optional fixed character width |
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
<Table
|
|
183
|
+
columns={[
|
|
184
|
+
{ key: "name", header: "Name", width: 16 },
|
|
185
|
+
{ key: "status", header: "Status" },
|
|
186
|
+
]}
|
|
187
|
+
data={[
|
|
188
|
+
{ name: "api", status: "ok" },
|
|
189
|
+
{ name: "db", status: "degraded" },
|
|
190
|
+
]}
|
|
191
|
+
/>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 🎨 Design Tokens
|
|
197
|
+
|
|
198
|
+
Import `colors` and `spacing` to keep your own components aligned with the design system.
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { colors, spacing } from "@kud/ink-ui"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Colours
|
|
205
|
+
|
|
206
|
+
| Token | Value | Semantic use |
|
|
207
|
+
| ---------------- | --------- | ---------------------------------- |
|
|
208
|
+
| `colors.accent` | `#FF8C00` | Primary highlight, icons, spinners |
|
|
209
|
+
| `colors.muted` | `gray` | Dimmed text, table headers |
|
|
210
|
+
| `colors.success` | `green` | Positive states |
|
|
211
|
+
| `colors.error` | `red` | Failures and errors |
|
|
212
|
+
| `colors.warning` | `yellow` | Caution states |
|
|
213
|
+
| `colors.info` | `cyan` | Neutral informational |
|
|
214
|
+
|
|
215
|
+
### Spacing
|
|
216
|
+
|
|
217
|
+
| Token | Value | Description |
|
|
218
|
+
| ------------ | ----- | ---------------------------------- |
|
|
219
|
+
| `spacing.xs` | `1` | Tight gap between inline elements |
|
|
220
|
+
| `spacing.sm` | `2` | Small margin between grouped items |
|
|
221
|
+
| `spacing.md` | `3` | Standard section margin |
|
|
222
|
+
| `spacing.lg` | `4` | Large gap between major sections |
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 🔧 Development
|
|
227
|
+
|
|
228
|
+
### Project structure
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
ink-ui/
|
|
232
|
+
├── src/
|
|
233
|
+
│ ├── components/
|
|
234
|
+
│ │ ├── Badge.tsx
|
|
235
|
+
│ │ ├── Banner.tsx
|
|
236
|
+
│ │ ├── Header.tsx
|
|
237
|
+
│ │ ├── Spinner.tsx
|
|
238
|
+
│ │ └── Table.tsx
|
|
239
|
+
│ ├── index.ts # public API
|
|
240
|
+
│ └── tokens.ts # colours + spacing
|
|
241
|
+
├── dist/ # compiled output (git-ignored)
|
|
242
|
+
├── tsconfig.json
|
|
243
|
+
└── package.json
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Scripts
|
|
247
|
+
|
|
248
|
+
| Script | Command | Description |
|
|
249
|
+
| ------- | ------------- | ------------------------------------ |
|
|
250
|
+
| `build` | `tsc` | Compile TypeScript to `dist/` |
|
|
251
|
+
| `dev` | `tsc --watch` | Watch mode — recompile on every save |
|
|
252
|
+
|
|
253
|
+
### Local setup
|
|
254
|
+
|
|
255
|
+
```sh
|
|
256
|
+
git clone https://github.com/kud/ink-ui.git
|
|
257
|
+
cd ink-ui
|
|
258
|
+
npm install
|
|
259
|
+
npm run build
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
To develop against a local project, link the package:
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
npm link
|
|
266
|
+
cd ../your-project
|
|
267
|
+
npm link @kud/ink-ui
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 🏗 Tech Stack
|
|
273
|
+
|
|
274
|
+
| Technology | Purpose |
|
|
275
|
+
| ---------------------------------------------------------- | -------------------------------------- |
|
|
276
|
+
| [TypeScript](https://www.typescriptlang.org/) | Strict typing, declaration file output |
|
|
277
|
+
| [Ink](https://github.com/vadimdemedes/ink) | React renderer for the terminal |
|
|
278
|
+
| [React](https://react.dev/) | Component model and JSX |
|
|
279
|
+
| [ink-spinner](https://github.com/vadimdemedes/ink-spinner) | Animated spinner primitive |
|
|
280
|
+
| ESM | Modern module format, no CommonJS |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
MIT © [kud](https://github.com/kud) — Made with ❤️
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type BadgeVariant = "success" | "error" | "warning" | "info";
|
|
2
|
+
type BadgeProps = {
|
|
3
|
+
children: string;
|
|
4
|
+
variant?: BadgeVariant;
|
|
5
|
+
};
|
|
6
|
+
export declare const Badge: ({ children, variant }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAEnE,KAAK,UAAU,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB,CAAA;AASD,eAAO,MAAM,KAAK,GAAI,uBAAgC,UAAU,4CAE/D,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "ink";
|
|
3
|
+
import { colors } from "../tokens.js";
|
|
4
|
+
const variantColor = {
|
|
5
|
+
success: colors.success,
|
|
6
|
+
error: colors.error,
|
|
7
|
+
warning: colors.warning,
|
|
8
|
+
info: colors.info,
|
|
9
|
+
};
|
|
10
|
+
export const Badge = ({ children, variant = "info" }) => (_jsxs(Text, { color: variantColor[variant], children: ["[", children, "]"] }));
|
|
11
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AASrC,MAAM,YAAY,GAAiC;IACjD,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,IAAI,EAAE,MAAM,CAAC,IAAI;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAc,EAAE,EAAE,CAAC,CACnE,MAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,kBAAI,QAAQ,SAAS,CACxD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/components/Banner.tsx"],"names":[],"mappings":"AAIA,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,2BAAiC,WAAW,4CAMlE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { colors } from "../tokens.js";
|
|
4
|
+
export const Banner = ({ title, subtitle, icon = "◆" }) => (_jsxs(Box, { gap: 1, marginBottom: 1, children: [_jsx(Text, { color: colors.accent, children: icon }), _jsx(Text, { bold: true, children: title }), subtitle && _jsx(Text, { dimColor: true, children: subtitle })] }));
|
|
5
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../src/components/Banner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAQrC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,GAAG,EAAe,EAAE,EAAE,CAAC,CACtE,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,aAC1B,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,YAAG,IAAI,GAAQ,EACzC,KAAC,IAAI,IAAC,IAAI,kBAAE,KAAK,GAAQ,EACxB,QAAQ,IAAI,KAAC,IAAI,IAAC,QAAQ,kBAAE,QAAQ,GAAQ,IACzC,CACP,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,wBAAwB,WAAW,4CAOzD,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
export const Header = ({ children, subtitle }) => (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { bold: true, underline: true, children: children }), subtitle && _jsx(Text, { dimColor: true, children: subtitle })] }));
|
|
4
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAO/B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAe,EAAE,EAAE,CAAC,CAC7D,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,YAAY,EAAE,CAAC,aACzC,KAAC,IAAI,IAAC,IAAI,QAAC,SAAS,kBACjB,QAAQ,GACJ,EACN,QAAQ,IAAI,KAAC,IAAI,IAAC,QAAQ,kBAAE,QAAQ,GAAQ,IACzC,CACP,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AAKA,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,WAAW,YAAY,4CAO9C,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import InkSpinner from "ink-spinner";
|
|
4
|
+
import { colors } from "../tokens.js";
|
|
5
|
+
export const Spinner = ({ label }) => (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: colors.accent, children: _jsx(InkSpinner, { type: "dots" }) }), label && _jsx(Text, { dimColor: true, children: label })] }));
|
|
6
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,KAAK,EAAgB,EAAE,EAAE,CAAC,CAClD,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,aACT,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,YACxB,KAAC,UAAU,IAAC,IAAI,EAAC,MAAM,GAAG,GACrB,EACN,KAAK,IAAI,KAAC,IAAI,IAAC,QAAQ,kBAAE,KAAK,GAAQ,IACnC,CACP,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Column<T extends Record<string, unknown>> = {
|
|
2
|
+
key: keyof T & string;
|
|
3
|
+
header: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
};
|
|
6
|
+
type TableProps<T extends Record<string, unknown>> = {
|
|
7
|
+
data: T[];
|
|
8
|
+
columns: Column<T>[];
|
|
9
|
+
};
|
|
10
|
+
export declare const Table: <T extends Record<string, unknown>>({ data, columns, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACtD,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACnD,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,oBAGtD,UAAU,CAAC,CAAC,CAAC,4CAqBf,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { colors } from "../tokens.js";
|
|
4
|
+
export const Table = ({ data, columns, }) => (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { gap: 2, children: columns.map((col) => (_jsx(Box, { width: col.width, minWidth: col.width, children: _jsx(Text, { bold: true, color: colors.muted, children: col.header }) }, col.key))) }), data.map((row, i) => (_jsx(Box, { gap: 2, children: columns.map((col) => (_jsx(Box, { width: col.width, minWidth: col.width, children: _jsx(Text, { wrap: "truncate-end", children: String(row[col.key] ?? "") }) }, col.key))) }, i)))] }));
|
|
5
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAarC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAoC,EACvD,IAAI,EACJ,OAAO,GACO,EAAE,EAAE,CAAC,CACnB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACzB,KAAC,GAAG,IAAC,GAAG,EAAE,CAAC,YACR,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACpB,KAAC,GAAG,IAAe,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,YACtD,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAC3B,GAAG,CAAC,MAAM,GACN,IAHC,GAAG,CAAC,GAAG,CAIX,CACP,CAAC,GACE,EACL,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACpB,KAAC,GAAG,IAAS,GAAG,EAAE,CAAC,YAChB,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACpB,KAAC,GAAG,IAAe,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,YACtD,KAAC,IAAI,IAAC,IAAI,EAAC,cAAc,YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAQ,IADrD,GAAG,CAAC,GAAG,CAEX,CACP,CAAC,IALM,CAAC,CAML,CACP,CAAC,IACE,CACP,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Banner } from "./components/Banner.js";
|
|
2
|
+
export { Badge } from "./components/Badge.js";
|
|
3
|
+
export type { BadgeVariant } from "./components/Badge.js";
|
|
4
|
+
export { Header } from "./components/Header.js";
|
|
5
|
+
export { Spinner } from "./components/Spinner.js";
|
|
6
|
+
export { Table } from "./components/Table.js";
|
|
7
|
+
export type { Column } from "./components/Table.js";
|
|
8
|
+
export { colors, spacing } from "./tokens.js";
|
|
9
|
+
export type { Color, Spacing } from "./tokens.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,YAAY,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC7C,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Banner } from "./components/Banner.js";
|
|
2
|
+
export { Badge } from "./components/Badge.js";
|
|
3
|
+
export { Header } from "./components/Header.js";
|
|
4
|
+
export { Spinner } from "./components/Spinner.js";
|
|
5
|
+
export { Table } from "./components/Table.js";
|
|
6
|
+
export { colors, spacing } from "./tokens.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/tokens.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
readonly accent: "#FF8C00";
|
|
3
|
+
readonly muted: "gray";
|
|
4
|
+
readonly success: "green";
|
|
5
|
+
readonly error: "red";
|
|
6
|
+
readonly warning: "yellow";
|
|
7
|
+
readonly info: "cyan";
|
|
8
|
+
};
|
|
9
|
+
export type Color = (typeof colors)[keyof typeof colors];
|
|
10
|
+
export declare const spacing: {
|
|
11
|
+
readonly xs: 1;
|
|
12
|
+
readonly sm: 2;
|
|
13
|
+
readonly md: 3;
|
|
14
|
+
readonly lg: 4;
|
|
15
|
+
};
|
|
16
|
+
export type Spacing = (typeof spacing)[keyof typeof spacing];
|
|
17
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAA;AAEV,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO;;;;;CAKV,CAAA;AAEV,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAA"}
|
package/dist/tokens.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,MAAM;CACJ,CAAA;AAIV,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACG,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kud/ink-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React component library for Ink CLIs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"ink": ">=4.0.0",
|
|
23
|
+
"react": ">=18.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"ink-spinner": "^5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/react": "^18.0.0",
|
|
30
|
+
"ink": "^5.0.0",
|
|
31
|
+
"react": "^18.0.0",
|
|
32
|
+
"typescript": "^5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"ink",
|
|
36
|
+
"cli",
|
|
37
|
+
"react",
|
|
38
|
+
"terminal",
|
|
39
|
+
"ui",
|
|
40
|
+
"components"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"homepage": "https://kud.github.io/ink-ui",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/kud/ink-ui"
|
|
47
|
+
}
|
|
48
|
+
}
|