night-city-ui 0.0.0-stage → 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 +372 -2
- package/dist/components/Accordion.d.ts +14 -0
- package/dist/components/Button.d.ts +12 -0
- package/dist/components/CodeBlock.d.ts +6 -0
- package/dist/components/Display.d.ts +80 -0
- package/dist/components/Feedback.d.ts +32 -0
- package/dist/components/Fields.d.ts +38 -0
- package/dist/components/Modal.d.ts +10 -0
- package/dist/components/Nav.d.ts +19 -0
- package/dist/components/Panel.d.ts +12 -0
- package/dist/components/Tabs.d.ts +14 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/night-city-ui.js +795 -0
- package/dist/night-city-ui.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/theme.d.ts +22 -0
- package/package.json +66 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Night City UI contributors
|
|
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
CHANGED
|
@@ -1,3 +1,373 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Night City UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
[](https://github.com/dan-netrunner/night-city-ui/actions/workflows/deploy-pages.yml)
|
|
5
|
+
[](https://github.com/dan-netrunner/night-city-ui/actions/workflows/publish-npm.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/night-city-ui)
|
|
7
|
+
[](https://react.dev)
|
|
8
|
+
[](https://www.typescriptlang.org)
|
|
9
|
+
|
|
10
|
+
A React + TypeScript component kit inspired by the four design languages of Cyberpunk 2077: **Scrap//Tech**, **Tacky//Futurism**, **Corpo//Brutalism** and **Hyper//Opulence**.
|
|
11
|
+
|
|
12
|
+
One component contract, four skins, zero UI dependencies. Every component is semantic markup plus CSS custom properties, so a theme changes color, type, radius, borders, shadows and texture without touching structure.
|
|
13
|
+
|
|
14
|
+
> 📖 **Guía en español:** [GUIA_DE_USO.md](./GUIA_DE_USO.md) — integración, temas y recetas de color.
|
|
15
|
+
|
|
16
|
+
- **Live demo:** https://dan-netrunner.github.io/night-city-ui/
|
|
17
|
+
- **Repository:** https://github.com/dan-netrunner/night-city-ui
|
|
18
|
+
- **npm:** `npm install night-city-ui`
|
|
19
|
+
- **License:** [MIT](./LICENSE) — free for personal and commercial use.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **4 live themes** driven by `data-theme` and CSS custom properties.
|
|
26
|
+
- **28 exported components** plus styled tables and documentation layout helpers.
|
|
27
|
+
- **Accessible defaults:** native controls, visible focus rings, ARIA tabs, a real `<dialog>`, keyboard-operable accordions and tooltips.
|
|
28
|
+
- **No runtime dependencies** beyond React and React DOM.
|
|
29
|
+
- **ESM + TypeScript types** built for bundlers, with the stylesheet shipped as `night-city-ui/style.css`.
|
|
30
|
+
- **Interactive docs:** component workbench, live color lab, theme comparison and a full operator dashboard playground.
|
|
31
|
+
- **GitHub Pages ready** with relative asset paths and a deploy workflow.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- React 18 or newer (peer dependency; the docs site is built with React 19)
|
|
38
|
+
- Node.js 20 or newer and npm 10 or newer, only to run or build this repository
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install night-city-ui
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then import the stylesheet once, and components anywhere:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import "night-city-ui/style.css";
|
|
52
|
+
import { Button, Panel, ThemeProvider } from "night-city-ui";
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`night-city-ui` ships ESM (`dist/night-city-ui.js`) and TypeScript declarations (`dist/index.d.ts`). It does not bundle fonts — see [Fonts](#fonts).
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Run the docs site locally
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone git@github.com:dan-netrunner/night-city-ui.git
|
|
63
|
+
cd night-city-ui
|
|
64
|
+
npm install
|
|
65
|
+
npm run dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The dev server prints a local URL (Vite default: `http://localhost:5173`). Other scripts:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run build # type-check with tsc and build the docs site into dist/
|
|
72
|
+
npm run build:lib # build the npm package (bundle + types) into dist/
|
|
73
|
+
npm run preview # serve the production build locally
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Minimal setup
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import "night-city-ui/style.css";
|
|
83
|
+
import { Badge, Button, Panel, Progress, ThemeProvider } from "night-city-ui";
|
|
84
|
+
|
|
85
|
+
export function App() {
|
|
86
|
+
return (
|
|
87
|
+
<ThemeProvider>
|
|
88
|
+
<Panel
|
|
89
|
+
kicker="// SYS.01"
|
|
90
|
+
title="Terminal"
|
|
91
|
+
telemetry="LINK: OK"
|
|
92
|
+
accent
|
|
93
|
+
>
|
|
94
|
+
<Badge tone="ok" pulse>
|
|
95
|
+
Online
|
|
96
|
+
</Badge>
|
|
97
|
+
<Progress label="RAM deck" value={75} segmented />
|
|
98
|
+
<Button code="01">Engage</Button>
|
|
99
|
+
</Panel>
|
|
100
|
+
</ThemeProvider>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`ThemeProvider` writes `data-theme` on `<html>`, persists the choice in `localStorage` (`nc-theme`) and applies the saved theme before first paint to avoid a flash.
|
|
106
|
+
|
|
107
|
+
### Fonts
|
|
108
|
+
|
|
109
|
+
The stylesheet references these families, with system fallbacks:
|
|
110
|
+
|
|
111
|
+
| Token | Family |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `--font-display` / `--font-ui` / `--font-body` | Rajdhani, Orbitron, Bungee, Bebas Neue (per theme) |
|
|
114
|
+
| `--font-mono` | Share Tech Mono |
|
|
115
|
+
|
|
116
|
+
The kit does not bundle the font files. For the intended look, add the ones you need — this is exactly what the docs site does:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm install @fontsource/rajdhani @fontsource/bebas-neue @fontsource/bungee @fontsource/orbitron @fontsource/share-tech-mono
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import "@fontsource/rajdhani/400.css";
|
|
124
|
+
import "@fontsource/rajdhani/500.css";
|
|
125
|
+
import "@fontsource/rajdhani/600.css";
|
|
126
|
+
import "@fontsource/rajdhani/700.css";
|
|
127
|
+
import "@fontsource/bebas-neue/400.css";
|
|
128
|
+
import "@fontsource/bungee/400.css";
|
|
129
|
+
import "@fontsource/orbitron/500.css";
|
|
130
|
+
import "@fontsource/orbitron/700.css";
|
|
131
|
+
import "@fontsource/share-tech-mono/400.css";
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Without them the components still work and fall back to the system sans/mono stack.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Theming
|
|
139
|
+
|
|
140
|
+
### Switch skins globally
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { useTheme } from "night-city-ui";
|
|
144
|
+
|
|
145
|
+
function ThemeMenu() {
|
|
146
|
+
const { theme, setTheme, meta } = useTheme();
|
|
147
|
+
return (
|
|
148
|
+
<button onClick={() => setTheme("kitsch")}>
|
|
149
|
+
{meta.name} → Tacky//Futurism
|
|
150
|
+
</button>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Available ids (used in `data-theme`): `neokitsch` (Hyper//Opulence, default), `entropism` (Scrap//Tech), `kitsch` (Tacky//Futurism), `neomilitarism` (Corpo//Brutalism).
|
|
156
|
+
|
|
157
|
+
### Scope a skin to a subtree
|
|
158
|
+
|
|
159
|
+
`data-theme` is a plain attribute, so any section can run a different skin:
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
<section data-theme="neomilitarism">
|
|
163
|
+
<Panel title="Tactical HUD">
|
|
164
|
+
<Button>Deploy</Button>
|
|
165
|
+
</Panel>
|
|
166
|
+
</section>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Create a custom theme
|
|
170
|
+
|
|
171
|
+
All components read variables from the bundled `tokens.css`. Override the ones you need:
|
|
172
|
+
|
|
173
|
+
```css
|
|
174
|
+
[data-theme="custom"] {
|
|
175
|
+
--accent: #00f0ff;
|
|
176
|
+
--accent-2: #fcee0a;
|
|
177
|
+
--accent-ink: #041214;
|
|
178
|
+
--accent-ghost: color-mix(in oklch, #00f0ff 14%, transparent);
|
|
179
|
+
--panel: #121a2c;
|
|
180
|
+
--glow: 0 0 18px color-mix(in oklch, #00f0ff 32%, transparent);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
| Token | Role |
|
|
185
|
+
| --- | --- |
|
|
186
|
+
| `--bg`, `--bg-2` | Viewport background |
|
|
187
|
+
| `--panel`, `--panel-2` | Panels, cards, modals |
|
|
188
|
+
| `--ink`, `--ink-dim`, `--ink-faint` | Primary, secondary and micro-label text |
|
|
189
|
+
| `--line`, `--line-strong` | Base and emphasized borders |
|
|
190
|
+
| `--accent`, `--accent-2` | Neon accent and secondary accent |
|
|
191
|
+
| `--accent-ink` | Text color on `--accent` fills |
|
|
192
|
+
| `--accent-ghost` | Translucent hover/active fill |
|
|
193
|
+
| `--ok`, `--warn`, `--danger` (+ `*-ink`) | Semantic states |
|
|
194
|
+
| `--glow`, `--focus-glow` | Neon glow and focus ring |
|
|
195
|
+
| `--radius*`, `--border-w` | Corner and border treatment |
|
|
196
|
+
| `--clip-panel`, `--clip-btn`, `--clip-tab`, `--clip-mark` | Cut-corner silhouettes |
|
|
197
|
+
| `--font-display`, `--font-ui`, `--font-body`, `--font-mono` | Type system |
|
|
198
|
+
| `--page-bg`, `--bar-bg`, `--noise-opacity` | Page texture, header bar and grain |
|
|
199
|
+
|
|
200
|
+
A live color lab on the **Guide** page generates the CSS block for you.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Components
|
|
205
|
+
|
|
206
|
+
Import everything from one entry point:
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import { Button, Panel, ToastStack } from "night-city-ui";
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Actions and surfaces
|
|
213
|
+
|
|
214
|
+
| Component | Key props |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| `Button` | `variant`: `primary` \| `ghost` \| `outline` \| `danger`; `size`: `sm` \| `md` \| `lg`; `block`; `code` (HUD micro-tag) |
|
|
217
|
+
| `Panel` | `title`, `kicker`, `actions`, `footer`, `telemetry` (corner stamp), `accent`, `flush` |
|
|
218
|
+
| `Divider` | `label` (renders a labeled rule) |
|
|
219
|
+
| `EmptyState` | `title`, `children`, `glyph`, `action` |
|
|
220
|
+
| `Metric` | `label`, `value`, `unit`, `delta`, `tone`: `accent` \| `ok` \| `warn` \| `danger` |
|
|
221
|
+
|
|
222
|
+
### Forms
|
|
223
|
+
|
|
224
|
+
| Component | Key props |
|
|
225
|
+
| --- | --- |
|
|
226
|
+
| `Input` | `label`, `hint`, `error` + all `<input>` attributes |
|
|
227
|
+
| `Textarea` | Same as `Input`, plus `rows` (default `4`) |
|
|
228
|
+
| `Select` | `label`, `hint`, `error`; options as children |
|
|
229
|
+
| `Checkbox` | `label`, `hint`, `defaultChecked` |
|
|
230
|
+
| `Radio` | `label`, `hint`, `name`, `value`; group with the same `name` |
|
|
231
|
+
| `Toggle` | `label`, `hint`; renders a switch |
|
|
232
|
+
| `Slider` | `label`, `value`, `defaultValue`, `min`, `max`, `suffix`, `onChange` |
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
<fieldset>
|
|
236
|
+
<Radio name="route" label="Rooftop" defaultChecked />
|
|
237
|
+
<Radio name="route" label="Freight elevator" />
|
|
238
|
+
</fieldset>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Feedback
|
|
242
|
+
|
|
243
|
+
| Component | Key props |
|
|
244
|
+
| --- | --- |
|
|
245
|
+
| `Alert` | `tone`: `info` \| `ok` \| `warn` \| `danger`; `title`; `onDismiss` |
|
|
246
|
+
| `Badge` | `tone`: `neutral` \| `accent` \| `ok` \| `warn` \| `danger`; `solid`; `pulse` |
|
|
247
|
+
| `Progress` | `value`, `max`, `label`, `showValue`, `segmented`, `segments`, `tone` |
|
|
248
|
+
| `Tooltip` | `label`, `side`: `top` \| `bottom`; child must be focusable |
|
|
249
|
+
| `Toast` | `title`, `tone`, `onDismiss` |
|
|
250
|
+
| `ToastStack` | `items: ToastItem[]`, `onDismiss(id)`, `label` |
|
|
251
|
+
| `Spinner` | `label`, `size`: `sm` \| `md` \| `lg` |
|
|
252
|
+
| `Skeleton` | `width`, `height` |
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
const [toasts, setToasts] = useState<ToastItem[]>([]);
|
|
256
|
+
|
|
257
|
+
<ToastStack
|
|
258
|
+
items={toasts}
|
|
259
|
+
onDismiss={(id) => setToasts((list) => list.filter((t) => t.id !== id))}
|
|
260
|
+
/>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Navigation and disclosure
|
|
264
|
+
|
|
265
|
+
| Component | Key props |
|
|
266
|
+
| --- | --- |
|
|
267
|
+
| `Tabs` | `items: { id, label, count? }[]`, `value`, `onChange`, `label` |
|
|
268
|
+
| `Accordion` | `items: { id, title, meta?, children }[]`, `defaultOpen` |
|
|
269
|
+
| `Breadcrumbs` | `items: { label, href? }[]`, `label` |
|
|
270
|
+
| `Pagination` | `page`, `pageCount`, `onChange`, `label` |
|
|
271
|
+
| `Modal` | `open`, `onClose`, `title`, `kicker`, `footer` |
|
|
272
|
+
|
|
273
|
+
`Tabs` supports arrow-key navigation. `Modal` wraps a native `<dialog>` and gets the focus trap, `Esc` handling and backdrop for free. `Accordion` uses `<details>`/`<summary>` and needs no JavaScript.
|
|
274
|
+
|
|
275
|
+
### Content
|
|
276
|
+
|
|
277
|
+
| Component | Key props |
|
|
278
|
+
| --- | --- |
|
|
279
|
+
| `Avatar` | `name`, `src`, `status`: `online` \| `busy` \| `offline`, `size` |
|
|
280
|
+
| `Kbd` | `children` |
|
|
281
|
+
| `CodeBlock` | `code`, `label`; includes a copy button |
|
|
282
|
+
| `Table` | CSS only: wrap in `.cp-table-wrap` and add `.cp-table` to `<table>` |
|
|
283
|
+
|
|
284
|
+
`Avatar` derives initials from `name` when no `src` is given and exposes the full name through `aria-label`.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Accessibility notes
|
|
289
|
+
|
|
290
|
+
- Focus rings use `--focus-glow` and never rely on color alone.
|
|
291
|
+
- `Tabs` uses `role="tablist"`/`role="tab"`, roving `tabIndex` and Arrow keys.
|
|
292
|
+
- `Tooltip` attaches `aria-describedby` to the trigger; wrap a real control.
|
|
293
|
+
- Toasts use `role="status"` (or `role="alert"` for danger) so they are announced.
|
|
294
|
+
- `prefers-reduced-motion` disables shimmer, pulse and spin animations.
|
|
295
|
+
- Decorative textures, status dots and glyphs are `aria-hidden`.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Project structure
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
src/
|
|
303
|
+
components/ # one file per component group + index.ts barrel
|
|
304
|
+
pages/ # demo: Overview, Components, Playground, Themes, Guide
|
|
305
|
+
styles/
|
|
306
|
+
tokens.css # design tokens and the four themes
|
|
307
|
+
ui.css # component styles
|
|
308
|
+
app.css # demo site layout only
|
|
309
|
+
index.ts # package entry: styles + public exports
|
|
310
|
+
theme.tsx # ThemeProvider + useTheme
|
|
311
|
+
App.tsx # hash router + shell
|
|
312
|
+
data.ts # demo data
|
|
313
|
+
vite.lib.config.ts # library build (npm package)
|
|
314
|
+
tsconfig.lib.json # declaration emit
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Demo pages are not part of the component API; they are only exported by the docs site, never by the package entry.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Publishing
|
|
322
|
+
|
|
323
|
+
### npm
|
|
324
|
+
|
|
325
|
+
`.github/workflows/publish-npm.yml` runs on every push or merge to `main` and with manual dispatch. It installs, runs `npm publish` (which triggers `prepublishOnly` → `npm run build:lib`) and publishes with provenance.
|
|
326
|
+
|
|
327
|
+
Setup, once:
|
|
328
|
+
|
|
329
|
+
1. Create the repository secret **`NPM_SECRET`** for the **environment `npm`** (Settings → Environments → `npm` → Environment secrets). Use an npm **automation** token or a granular token with read/write on `night-city-ui`.
|
|
330
|
+
2. Keep `package.json` `name`, `version` and `repository` in sync.
|
|
331
|
+
|
|
332
|
+
Then bump the version to ship:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
npm version patch # or minor / major
|
|
336
|
+
git push # merge to main publishes the new version
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
If `package.json` still has a version that already exists on npm, the workflow skips the publish and reports it, so merges without a bump stay green.
|
|
340
|
+
|
|
341
|
+
Publishing locally is also possible:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
npm login
|
|
345
|
+
npm publish --access public
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### GitHub Pages
|
|
349
|
+
|
|
350
|
+
The workflow at `.github/workflows/deploy-pages.yml` builds the docs site into `dist/` with `npm run build` on every push or merge to `main` and force-pushes it to the **`gh-pages`** branch. `base: "./"` in `vite.config.ts` keeps asset paths relative, so the site works from the repository subpath.
|
|
351
|
+
|
|
352
|
+
1. Push the repository to GitHub.
|
|
353
|
+
2. Open **Settings → Pages → Build and deployment**.
|
|
354
|
+
3. Set **Source** to **Deploy from a branch**, branch **`gh-pages`**, folder **`/` (root)**.
|
|
355
|
+
4. Push to `main` (or run the workflow manually from **Actions**). The first run creates `gh-pages`; if the branch is not listed yet, run the workflow once and reload the Pages settings.
|
|
356
|
+
|
|
357
|
+
Expected URL: `https://dan-netrunner.github.io/night-city-ui/`.
|
|
358
|
+
|
|
359
|
+
The workflow is intentionally triggered by `main`, not by `gh-pages`: the action writes `dist/` to `gh-pages`, so triggering on that branch would redeploy on its own output. `main` stays the source of truth and `gh-pages` is only the published artifact.
|
|
360
|
+
|
|
361
|
+
<details>
|
|
362
|
+
<summary>Alternative: deploy with a GitHub Actions artifact</summary>
|
|
363
|
+
|
|
364
|
+
If you prefer not to keep a `gh-pages` branch, replace the workflow with the standard `actions/upload-pages-artifact` + `actions/deploy-pages` pair and set **Settings → Pages → Source** to **GitHub Actions**. In that model `main` is both the source and the deployment trigger, and no branch is written.
|
|
365
|
+
</details>
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## License
|
|
370
|
+
|
|
371
|
+
[MIT](./LICENSE). Use it, fork it, sell it — keep the copyright notice.
|
|
372
|
+
|
|
373
|
+
This is an independent fan project. It is not affiliated with or endorsed by CD Projekt Red, and it ships no game assets, logos, characters or fonts owned by them. Cyberpunk 2077 is a trademark of CD Projekt Red.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type AccordionItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
meta?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type AccordionProps = {
|
|
9
|
+
items: AccordionItem[];
|
|
10
|
+
/** Id of the item rendered open on mount. */
|
|
11
|
+
defaultOpen?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function Accordion({ items, defaultOpen, className }: AccordionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from "react";
|
|
2
|
+
type Variant = "primary" | "ghost" | "outline" | "danger";
|
|
3
|
+
type Size = "sm" | "md" | "lg";
|
|
4
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
|
+
variant?: Variant;
|
|
6
|
+
size?: Size;
|
|
7
|
+
block?: boolean;
|
|
8
|
+
/** Optional micro-telemetry tag rendered inside the button (e.g. "01", "NET"). */
|
|
9
|
+
code?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function Button({ variant, size, block, code, className, type, children, ...props }: ButtonProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
type Tone = "neutral" | "accent" | "ok" | "warn" | "danger";
|
|
3
|
+
export type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
|
|
4
|
+
tone?: Tone;
|
|
5
|
+
solid?: boolean;
|
|
6
|
+
/** Renders a pulsing HUD status node before the label. */
|
|
7
|
+
pulse?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function Badge({ tone, solid, pulse, className, children, ...props }: BadgeProps): import("react").JSX.Element;
|
|
10
|
+
export type ProgressProps = {
|
|
11
|
+
value: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
showValue?: boolean;
|
|
15
|
+
tone?: "accent" | "ok" | "warn" | "danger";
|
|
16
|
+
/** Renders discrete Cyberpunk HUD segments instead of a continuous bar. */
|
|
17
|
+
segmented?: boolean;
|
|
18
|
+
segments?: number;
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function Progress({ value, max, label, showValue, tone, segmented, segments, className, }: ProgressProps): import("react").JSX.Element;
|
|
22
|
+
declare const ALERT_GLYPHS: {
|
|
23
|
+
readonly info: "i";
|
|
24
|
+
readonly ok: "✓";
|
|
25
|
+
readonly warn: "!";
|
|
26
|
+
readonly danger: "!";
|
|
27
|
+
};
|
|
28
|
+
export type AlertProps = {
|
|
29
|
+
tone?: keyof typeof ALERT_GLYPHS;
|
|
30
|
+
title?: ReactNode;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
onDismiss?: () => void;
|
|
33
|
+
className?: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function Alert({ tone, title, children, onDismiss, className, }: AlertProps): import("react").JSX.Element;
|
|
36
|
+
export type DividerProps = {
|
|
37
|
+
label?: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
40
|
+
export declare function Divider({ label, className }: DividerProps): import("react").JSX.Element;
|
|
41
|
+
export type KbdProps = HTMLAttributes<HTMLElement>;
|
|
42
|
+
export declare function Kbd({ className, children, ...props }: KbdProps): import("react").JSX.Element;
|
|
43
|
+
export type AvatarProps = {
|
|
44
|
+
name: string;
|
|
45
|
+
src?: string;
|
|
46
|
+
status?: "online" | "busy" | "offline";
|
|
47
|
+
size?: "sm" | "md" | "lg";
|
|
48
|
+
className?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare function Avatar({ name, src, status, size, className, }: AvatarProps): import("react").JSX.Element;
|
|
51
|
+
export type SkeletonProps = {
|
|
52
|
+
width?: string | number;
|
|
53
|
+
height?: string | number;
|
|
54
|
+
className?: string;
|
|
55
|
+
};
|
|
56
|
+
export declare function Skeleton({ width, height, className }: SkeletonProps): import("react").JSX.Element;
|
|
57
|
+
export type SpinnerProps = {
|
|
58
|
+
label?: string;
|
|
59
|
+
size?: "sm" | "md" | "lg";
|
|
60
|
+
className?: string;
|
|
61
|
+
};
|
|
62
|
+
export declare function Spinner({ label, size, className }: SpinnerProps): import("react").JSX.Element;
|
|
63
|
+
export type MetricProps = {
|
|
64
|
+
label: ReactNode;
|
|
65
|
+
value: ReactNode;
|
|
66
|
+
unit?: string;
|
|
67
|
+
delta?: ReactNode;
|
|
68
|
+
tone?: "accent" | "ok" | "warn" | "danger";
|
|
69
|
+
className?: string;
|
|
70
|
+
};
|
|
71
|
+
export declare function Metric({ label, value, unit, delta, tone, className, }: MetricProps): import("react").JSX.Element;
|
|
72
|
+
export type EmptyStateProps = {
|
|
73
|
+
title: ReactNode;
|
|
74
|
+
children?: ReactNode;
|
|
75
|
+
glyph?: ReactNode;
|
|
76
|
+
action?: ReactNode;
|
|
77
|
+
className?: string;
|
|
78
|
+
};
|
|
79
|
+
export declare function EmptyState({ title, children, glyph, action, className, }: EmptyStateProps): import("react").JSX.Element;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type TooltipProps = {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
/** The trigger must be focusable (button, link, input) to open the bubble. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
side?: "top" | "bottom";
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function Tooltip({ label, children, side, className }: TooltipProps): import("react").JSX.Element;
|
|
10
|
+
type Tone = "info" | "ok" | "warn" | "danger";
|
|
11
|
+
export type ToastProps = {
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
tone?: Tone;
|
|
15
|
+
onDismiss?: () => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function Toast({ title, children, tone, onDismiss, className, }: ToastProps): import("react").JSX.Element;
|
|
19
|
+
export type ToastItem = {
|
|
20
|
+
id: string;
|
|
21
|
+
title: ReactNode;
|
|
22
|
+
message?: ReactNode;
|
|
23
|
+
tone?: Tone;
|
|
24
|
+
};
|
|
25
|
+
export type ToastStackProps = {
|
|
26
|
+
items: ToastItem[];
|
|
27
|
+
onDismiss: (id: string) => void;
|
|
28
|
+
label?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function ToastStack({ items, onDismiss, label, className, }: ToastStackProps): import("react").JSX.Element | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ChangeEventHandler, type InputHTMLAttributes, type ReactNode, type SelectHTMLAttributes, type TextareaHTMLAttributes } from "react";
|
|
2
|
+
type FieldExtras = {
|
|
3
|
+
label?: ReactNode;
|
|
4
|
+
hint?: ReactNode;
|
|
5
|
+
error?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export type InputProps = InputHTMLAttributes<HTMLInputElement> & FieldExtras;
|
|
8
|
+
export declare function Input({ label, hint, error, id, className, ...props }: InputProps): import("react").JSX.Element;
|
|
9
|
+
export type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & FieldExtras;
|
|
10
|
+
export declare function Textarea({ label, hint, error, id, className, rows, ...props }: TextareaProps): import("react").JSX.Element;
|
|
11
|
+
export type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & FieldExtras;
|
|
12
|
+
export declare function Select({ label, hint, error, id, className, children, ...props }: SelectProps): import("react").JSX.Element;
|
|
13
|
+
export type CheckboxProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
hint?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
export declare function Checkbox({ label, hint, id, className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
18
|
+
export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
19
|
+
label: ReactNode;
|
|
20
|
+
hint?: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export declare function Radio({ label, hint, id, className, ...props }: RadioProps): import("react").JSX.Element;
|
|
23
|
+
export type ToggleProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
24
|
+
label: ReactNode;
|
|
25
|
+
hint?: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare function Toggle({ label, hint, id, className, ...props }: ToggleProps): import("react").JSX.Element;
|
|
28
|
+
export type SliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "min" | "max"> & {
|
|
29
|
+
label?: ReactNode;
|
|
30
|
+
value?: number;
|
|
31
|
+
defaultValue?: number;
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
suffix?: string;
|
|
35
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
36
|
+
};
|
|
37
|
+
export declare function Slider({ label, value, defaultValue, min, max, suffix, onChange, id, className, ...props }: SliderProps): import("react").JSX.Element;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type ModalProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
kicker?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare function Modal({ open, onClose, title, kicker, children, footer, }: ModalProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type Crumb = {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
href?: string;
|
|
5
|
+
};
|
|
6
|
+
export type BreadcrumbsProps = {
|
|
7
|
+
items: Crumb[];
|
|
8
|
+
label?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function Breadcrumbs({ items, label, className, }: BreadcrumbsProps): import("react").JSX.Element;
|
|
12
|
+
export type PaginationProps = {
|
|
13
|
+
page: number;
|
|
14
|
+
pageCount: number;
|
|
15
|
+
onChange: (page: number) => void;
|
|
16
|
+
label?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function Pagination({ page, pageCount, onChange, label, className, }: PaginationProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export type PanelProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
kicker?: string;
|
|
5
|
+
actions?: ReactNode;
|
|
6
|
+
footer?: ReactNode;
|
|
7
|
+
/** Optional corner telemetry stamp (e.g. "SYS // 01"). */
|
|
8
|
+
telemetry?: string;
|
|
9
|
+
accent?: boolean;
|
|
10
|
+
flush?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function Panel({ title, kicker, actions, footer, telemetry, accent, flush, className, children, ...props }: PanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type TabItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
count?: number | string;
|
|
6
|
+
};
|
|
7
|
+
export type TabsProps = {
|
|
8
|
+
items: TabItem[];
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (id: string) => void;
|
|
11
|
+
label: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function Tabs({ items, value, onChange, label, className, }: TabsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Button, type ButtonProps } from "./Button";
|
|
2
|
+
export { Panel, type PanelProps } from "./Panel";
|
|
3
|
+
export { Input, Select, Checkbox, Toggle, Slider, Textarea, Radio, type InputProps, type SelectProps, type CheckboxProps, type ToggleProps, type SliderProps, type TextareaProps, type RadioProps, } from "./Fields";
|
|
4
|
+
export { Tabs, type TabsProps, type TabItem } from "./Tabs";
|
|
5
|
+
export { Badge, Progress, Alert, Divider, Kbd, Avatar, Skeleton, Spinner, Metric, EmptyState, type BadgeProps, type ProgressProps, type AlertProps, type DividerProps, type KbdProps, type AvatarProps, type SkeletonProps, type SpinnerProps, type MetricProps, type EmptyStateProps, } from "./Display";
|
|
6
|
+
export { Tooltip, Toast, ToastStack, type TooltipProps, type ToastProps, type ToastItem, type ToastStackProps, } from "./Feedback";
|
|
7
|
+
export { Accordion, type AccordionProps, type AccordionItem } from "./Accordion";
|
|
8
|
+
export { Breadcrumbs, Pagination, type Crumb, type BreadcrumbsProps, type PaginationProps, } from "./Nav";
|
|
9
|
+
export { Modal, type ModalProps } from "./Modal";
|
|
10
|
+
export { CodeBlock, type CodeBlockProps } from "./CodeBlock";
|
package/dist/index.d.ts
ADDED