nish-ui 1.4.0 → 1.5.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 +101 -496
- package/dist/index.d.ts +45 -2
- package/dist/index.js +279 -78
- package/dist/index.js.map +1 -1
- package/dist/server/hono.d.ts +19 -4
- package/dist/server/hono.js +50 -0
- package/dist/server/hono.js.map +1 -1
- package/dist/server/index.d.ts +4 -54
- package/dist/server/index.js +128 -6
- package/dist/server/index.js.map +1 -1
- package/dist/{spa-EPM1E0Va.d.ts → spa-DuVB5O7S.d.ts} +104 -2
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -1,562 +1,167 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nish-ui
|
|
2
2
|
|
|
3
|
-
Design tokens, seven themes, theme switching
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Design tokens, seven themes, flash-free theme switching and accessible React 19 components,
|
|
4
|
+
built for Tailwind 4 and usable from plain CSS and static HTML. It is the design system
|
|
5
|
+
behind every `*.nish.software` app.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**See every component and token live, in every theme: [design.nish.software](https://design.nish.software)**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/nish-ui)
|
|
10
|
+
[](https://github.com/nishant/ui/blob/master/LICENSE)
|
|
11
11
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
|
-
From npm:
|
|
15
|
-
|
|
16
14
|
```bash
|
|
17
15
|
npm install nish-ui
|
|
18
|
-
pnpm add nish-ui
|
|
19
16
|
```
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
React and react-dom are optional peers (19 or later), so a static site or a Node tool that
|
|
19
|
+
only uses the CSS and `nish-ui/theme` never gets React. The package ships built files, with
|
|
20
|
+
no install or build step.
|
|
21
|
+
|
|
22
|
+
The docs site and the nish.software apps write the package as `@nish/ui`. To use their
|
|
23
|
+
examples exactly as written, install it under that name with an npm alias:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
npm install @nish/ui@npm:nish-ui
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The nish.software apps pin that alias to an exact version,
|
|
30
|
+
`"@nish/ui": "npm:nish-ui@X.Y.Z"`. The release fan-out keeps the pin current, so the version is
|
|
31
|
+
never written by hand.
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
"@nish/ui": "https://codeload.github.com/nishant/ui/tar.gz/refs/tags/v1.2.0"
|
|
33
|
-
```
|
|
33
|
+
### Fallback: without the npm registry
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
Every release tag carries the same built files, so a machine that cannot reach npm can pin the
|
|
36
|
+
tag's tarball, which needs only HTTPS:
|
|
37
|
+
`"@nish/ui": "https://codeload.github.com/nishant/ui/tar.gz/refs/tags/vX.Y.Z"`.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
only use the CSS and `@nish/ui/theme` do not get React installed. The `@nish/ui/server`,
|
|
41
|
-
`@nish/ui/server/hono` and `@nish/ui/inbox-client` entries are the nish.software apps' login
|
|
42
|
-
and inbox kit; other projects can ignore them.
|
|
39
|
+
## Usage
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
### React + Tailwind 4
|
|
45
42
|
|
|
46
43
|
```css
|
|
47
44
|
/* src/index.css */
|
|
48
45
|
@import 'tailwindcss';
|
|
49
|
-
@import '
|
|
46
|
+
@import 'nish-ui/tailwind.css';
|
|
50
47
|
```
|
|
51
48
|
|
|
52
|
-
The `nishThemeInit()` plugin from `@nish/ui/vite` inlines `theme-init.js` at the top of `<head>`, so
|
|
53
|
-
the saved theme is on `<html>` before the first paint. Options: `position: 'after-charset'`,
|
|
54
|
-
`prelude`, `legacyKey` (see [Vite plugin and lint](https://design.nish.software/#/components/vite-plugin)).
|
|
55
|
-
|
|
56
49
|
```ts
|
|
57
|
-
// vite.config.ts
|
|
58
|
-
import { nishThemeInit } from '
|
|
50
|
+
// vite.config.ts: inlines theme-init.js at the top of <head>, so there is no flash of the wrong theme
|
|
51
|
+
import { nishThemeInit } from 'nish-ui/vite';
|
|
59
52
|
// plugins: [nishThemeInit(), react(), tailwindcss()]
|
|
60
53
|
```
|
|
61
54
|
|
|
62
55
|
```tsx
|
|
63
|
-
import { initTheme, ThemeToggle, Toaster, Button, toast } from '
|
|
56
|
+
import { initTheme, ThemeToggle, Toaster, Button, toast } from 'nish-ui';
|
|
64
57
|
|
|
65
58
|
initTheme(); // once, before render
|
|
66
59
|
|
|
67
|
-
<ThemeToggle presets />
|
|
68
|
-
<Toaster />
|
|
60
|
+
<ThemeToggle presets />
|
|
61
|
+
<Toaster />
|
|
69
62
|
<Button variant="primary" onClick={() => toast.success('Saved')}>Save</Button>
|
|
70
63
|
```
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
element silently loses its background) from shipping.
|
|
76
|
-
|
|
77
|
-
```js
|
|
78
|
-
// eslint.config.js: after tseslint.configs.recommended; it ships rules only, no parser
|
|
79
|
-
import tseslint from 'typescript-eslint';
|
|
80
|
-
import nish from '@nish/ui/eslint';
|
|
81
|
-
|
|
82
|
-
export default [...tseslint.configs.recommended, ...nish.configs.react]; // servers: nish.configs.node
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
The preset is the plugin `nish` with six rules, all errors: `no-unknown-th-class`, `no-raw-palette`,
|
|
86
|
-
`no-white-black`, `no-legacy-th-alias`, `no-hand-mixed-tint` and `no-arbitrary-text-size`. It has its
|
|
87
|
-
own rules rather than `no-restricted-syntax`, so it never replaces an app's own options.
|
|
65
|
+
Style with color roles, never raw palette classes: `bg-th-surface text-th-hi border-th-line`.
|
|
66
|
+
They change with the theme. [Getting started](https://design.nish.software/#/getting-started)
|
|
67
|
+
covers the full setup, Electron included.
|
|
88
68
|
|
|
89
|
-
|
|
90
|
-
and exits 1 with file:line for each hit. Add `"th-check": "nish-th-check src"` to `package.json` and run it
|
|
91
|
-
in `check`. This repo runs it over `src site demo` in `npm run check`.
|
|
69
|
+
### Plain CSS and static HTML
|
|
92
70
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
```json
|
|
96
|
-
// tsconfig.json of a Vite + React app; servers and scripts extend node.json
|
|
97
|
-
{ "extends": "@nish/ui/tsconfig/react.json", "include": ["src"] }
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
`base.json` is strict, ES2023, Bundler resolution, isolatedModules and noEmit. `react.json` adds the DOM libs,
|
|
101
|
-
`react-jsx` and `vite/client` types. `node.json` switches to NodeNext with `node` types.
|
|
102
|
-
|
|
103
|
-
## Icons
|
|
104
|
-
|
|
105
|
-
Apps use `lucide-react` (^1): per-icon tree-shaking, a large maintained set, MIT, and trading, startpage
|
|
106
|
-
and nishboard already use it. `@nish/ui` never depends on an icon package. Its components inline the few
|
|
107
|
-
icons they need, drawn on lucide's 24px grid with a 2px stroke so they match, and it exports five of them
|
|
108
|
-
(`CheckIcon`, `ClockIcon`, `MoreIcon`, `BellIcon`, `SettingsIcon`). Sizes: 16px inline with text, 20px in
|
|
109
|
-
buttons and IconButtons, 20 to 24px in navigation (`NavItem.icon`). Details: [Icons](https://design.nish.software/#/icons).
|
|
110
|
-
|
|
111
|
-
## Quick start: static HTML
|
|
112
|
-
|
|
113
|
-
Copy the files listed in `dist/files.json` from a tag (`nish.css`, `nish-components.css`,
|
|
114
|
-
`theme-init.js`, `theme.js`, `theme.global.js` and `fonts/*`). hosting does this with
|
|
115
|
-
`scripts/sync-ui.mjs`. Then:
|
|
71
|
+
Copy the files listed in `dist/files.json` (CSS, `theme-init.js`, `theme.js` and the fonts),
|
|
72
|
+
then:
|
|
116
73
|
|
|
117
74
|
```html
|
|
118
75
|
<head>
|
|
119
76
|
<script src="nish/theme-init.js"></script>
|
|
120
77
|
<link rel="stylesheet" href="nish/nish.css">
|
|
121
|
-
<!-- optional: .nish-btn, .nish-card,
|
|
122
|
-
<link rel="stylesheet" href="nish/nish-components.css">
|
|
78
|
+
<link rel="stylesheet" href="nish/nish-components.css"> <!-- optional: .nish-btn, .nish-card, ... -->
|
|
123
79
|
</head>
|
|
124
80
|
<body>
|
|
125
81
|
<button id="theme" type="button" class="nish-theme-btn"></button>
|
|
126
82
|
<script type="module">
|
|
127
83
|
import { initTheme, mountThemeToggle } from './nish/theme.js';
|
|
128
84
|
initTheme();
|
|
129
|
-
// Fills the button with the System, Light and Dark icons, keeps its label right, cycles on click.
|
|
130
85
|
mountThemeToggle(document.querySelector('#theme'));
|
|
131
86
|
</script>
|
|
132
87
|
</body>
|
|
133
88
|
```
|
|
134
89
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
`readToken`, `registerThemes`, `getThemeChoice` and `mountThemeToggle`:
|
|
138
|
-
|
|
139
|
-
```html
|
|
140
|
-
<script src="nish/theme.global.js"></script>
|
|
141
|
-
<script>
|
|
142
|
-
nishTheme.initTheme();
|
|
143
|
-
nishTheme.mountThemeToggle(document.querySelector('#theme'));
|
|
144
|
-
</script>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Style with the variables: `background: var(--nish-surface); color: var(--nish-hi2);`.
|
|
148
|
-
Font files have content-hashed names (`inter-latin-wght-normal.<hash>.woff2`), so the
|
|
149
|
-
folder they live in can be served with a one-year immutable cache.
|
|
150
|
-
|
|
151
|
-
## Quick start: Electron
|
|
152
|
-
|
|
153
|
-
The renderer is a React + Tailwind app: same install, same CSS import. Two differences:
|
|
154
|
-
|
|
155
|
-
- Inline `theme-init.js` (`nishThemeInit()` above). The packaged app loads from `file://`,
|
|
156
|
-
where only an inline, render-blocking script is guaranteed to run before the first paint.
|
|
157
|
-
- There is no shared domain, so the choice lives in `localStorage` only. Keep the native
|
|
158
|
-
window chrome in step from the renderer:
|
|
159
|
-
|
|
160
|
-
```ts
|
|
161
|
-
import { initTheme, onThemeChange, schemeOf } from '@nish/ui';
|
|
162
|
-
initTheme();
|
|
163
|
-
onThemeChange((_choice, theme) => window.api.setNativeTheme(schemeOf(theme)));
|
|
164
|
-
// main process: ipcMain.on('theme', (_e, s) => (nativeTheme.themeSource = s));
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Themes
|
|
168
|
-
|
|
169
|
-
`dark` (the default), `light`, and the presets `slate`, `terminal`, `mocha`, `ocean` and
|
|
170
|
-
`contrast` (high contrast). Each preset declares whether it is dark or light, so a page
|
|
171
|
-
limited to light and dark (`<html data-nish-themes="dark light">`) shows the one it is
|
|
172
|
-
based on.
|
|
173
|
-
|
|
174
|
-
The choice (`system` or a theme name) is shared across subdomains:
|
|
175
|
-
|
|
176
|
-
- `setThemeChoice()` writes a `nish-theme` cookie on `.nish.software`
|
|
177
|
-
(`Path=/; Max-Age=31536000; SameSite=Lax; Secure`) and the same value to `localStorage`.
|
|
178
|
-
Another site shares it across its own subdomains with `<html data-nish-domain="example.com">`
|
|
179
|
-
(it applies only on that domain and its subdomains). Without the attribute, hosts outside
|
|
180
|
-
nish.software keep the choice in `localStorage` only.
|
|
181
|
-
- `theme-init.js` reads the cookie first, then `localStorage` (the only store on localhost
|
|
182
|
-
and in Electron), then follows the OS.
|
|
183
|
-
- `theme.ts` re-applies the choice when another tab saves one, when the OS scheme flips
|
|
184
|
-
(for `system`), and when a tab comes back into view after another subdomain changed the
|
|
185
|
-
cookie.
|
|
186
|
-
|
|
187
|
-
So picking Mocha on jobs.nish.software opens trading.nish.software in Mocha too.
|
|
188
|
-
|
|
189
|
-
A theme can also be scoped to part of a page: `<div data-theme="light" data-scheme="light">`
|
|
190
|
-
gets that theme's colors, tints and shadows for its subtree. The docs site's all-themes
|
|
191
|
-
views work this way. Tailwind's `dark:` variant matches when any ancestor has
|
|
192
|
-
`data-scheme="dark"`, so inside a light container on a dark page it still applies; use
|
|
193
|
-
roles instead of `dark:` in scoped content.
|
|
194
|
-
|
|
195
|
-
## Color roles
|
|
196
|
-
|
|
197
|
-
Pick colors by role, never by hue. Each role is a CSS variable and a Tailwind color
|
|
198
|
-
(`bg-`, `text-`, `border-`, `ring-`, `fill-`, `stroke-` all work, as do opacity
|
|
199
|
-
modifiers like `bg-th-surface/50`). Never use raw palette classes such as `neutral-800`:
|
|
200
|
-
they do not change with the theme.
|
|
201
|
-
|
|
202
|
-
| Role | Purpose | Tailwind | CSS variable |
|
|
203
|
-
|---|---|---|---|
|
|
204
|
-
| bg | Page background | `bg-th-bg` | `--nish-bg` |
|
|
205
|
-
| surface | Cards, panels, table bodies | `bg-th-surface` | `--nish-surface` |
|
|
206
|
-
| elevated | Popovers, hovered rows, inputs, raised things inside cards | `bg-th-elevated` | `--nish-elevated` |
|
|
207
|
-
| overlay | Deepest layer: chips inside raised things, skeleton sheen | `bg-th-overlay` | `--nish-overlay` |
|
|
208
|
-
| line | Borders and dividers | `border-th-line` | `--nish-line` |
|
|
209
|
-
| line-strong | Input borders, outlines that are not the accent | `border-th-line-strong` | `--nish-line-strong` |
|
|
210
|
-
| hi | Primary text | `text-th-hi` | `--nish-hi` |
|
|
211
|
-
| hi2 | Secondary text | `text-th-hi2` | `--nish-hi2` |
|
|
212
|
-
| hi3 | Tertiary text, labels | `text-th-hi3` | `--nish-hi3` |
|
|
213
|
-
| ghost | Placeholders, disabled text, decorative icons (not body text) | `text-th-ghost` | `--nish-ghost` |
|
|
214
|
-
| accent | Links, primary buttons, active nav, focus ring | `text-th-accent`, `bg-th-accent` | `--nish-accent` |
|
|
215
|
-
| accent2 | Second accent for paired highlights | `text-th-accent2` | `--nish-accent2` |
|
|
216
|
-
| ok / loss / warn / info | Status text: success, errors, warnings, notices | `text-th-ok` | `--nish-ok` |
|
|
217
|
-
| *-soft | A role at 14% for badges, banners, selected rows (accent, ok, loss, warn, info) | `bg-th-ok-soft` | `--nish-ok-soft` |
|
|
218
|
-
| *-fill | Status colors for bars, meters, dots and chart lines (brighter than the text versions in light themes) | `bg-th-ok-fill` | `--nish-ok-fill` |
|
|
219
|
-
| on-accent | Text and icons on an accent fill | `text-th-on-accent` | `--nish-on-accent` |
|
|
220
|
-
| on-accent2 | Text and icons on an accent2 fill | `text-th-on-accent2` | `--nish-on-accent2` |
|
|
221
|
-
| on-ok / on-loss / on-warn / on-info | Text and icons on the matching `-fill` (on-loss also on `loss`, for danger buttons) | `text-th-on-ok` | `--nish-on-ok` |
|
|
222
|
-
| scrim | Modal and drawer backdrop tone | `bg-th-scrim/60` | `--nish-scrim` |
|
|
223
|
-
| invert-bg / invert-text | Inverted pill: a today marker, an active segment | `bg-th-invert-bg` | `--nish-invert-bg` |
|
|
224
|
-
| chart-1 … chart-8 | Categorical chart series; neighbors never share a hue family | `stroke-th-chart-1` | `--nish-chart-1` |
|
|
225
|
-
| emerald, indigo, amber, lime, rose, sky, violet, teal | Hues for tags and tile accents, when a color has no meaning | `text-th-rose` | `--nish-rose` |
|
|
226
|
-
|
|
227
|
-
Aliases kept for older apps: `th-gain` (ok), `th-danger` (loss), `th-2` (hi2), `th-3`
|
|
228
|
-
(hi3), `th-bar` (surface), `th-focus`.
|
|
229
|
-
|
|
230
|
-
Every value per theme, live, is on the [Color page](https://design.nish.software/#/color).
|
|
231
|
-
|
|
232
|
-
## Layout contract
|
|
233
|
-
|
|
234
|
-
Bars publish their height to CSS variables on `<html>` (a ResizeObserver; the variable is removed when the bar unmounts or is hidden). Everything else reads the variables, so no React context is needed, and static pages use the same contract through `mountHeightVar`.
|
|
235
|
-
|
|
236
|
-
| Variable | Written by | Value | Read by |
|
|
237
|
-
|---|---|---|---|
|
|
238
|
-
| `--nish-header-h` | AppHeader when `sticky` (default) | measured height in px | PageHeader sticky top, StickyBar default top, SectionNav top, `.nish-scroll-target` scroll margin |
|
|
239
|
-
| `--nish-bottom-nav-h` | BottomNav while visible (below `hideFrom`) | measured height, safe area included | `--nish-bottom-inset`, StickyActionBar, MoreSheet |
|
|
240
|
-
| `--nish-bottom-bar-h` | StickyActionBar while open | measured height | `--nish-bottom-inset` |
|
|
241
|
-
| `--nish-bottom-inset` | base.css only | `calc(var(--nish-bottom-nav-h, 0px) + var(--nish-bottom-bar-h, 0px))` | Toaster, PageContainer bottom padding, `.nish-pad-bottom-inset` |
|
|
242
|
-
| `--nish-sticky-extra` | SectionNav and StickyBar when sticky | measured height | `.nish-scroll-target` scroll margin |
|
|
243
|
-
| `--nish-page-gutter` | base.css (1rem, 1.5rem from 640px) | side padding | AppHeader, PageHeader, PageContainer |
|
|
244
|
-
|
|
245
|
-
`html[data-nish-layer-open]` is set while any Modal, Drawer or ConfirmDialog is open; Toaster uses it to move to the top on phones. A custom bar publishes its height with `useHeightVar(ref, '--nish-bottom-bar-h')`; a sticky element can use `useStuck(ref)` for a stuck shadow, and a scroller `useScrollEdges(ref)` with `.nish-scroll-fade` for edge fades.
|
|
246
|
-
|
|
247
|
-
## Phone chrome
|
|
248
|
-
|
|
249
|
-
A header on top, a tab bar at the bottom on phones, a rail on wide screens and a "More" sheet for the rest. Toaster needs no `offset`: it sits above the tab bar through `--nish-bottom-inset`.
|
|
250
|
-
|
|
251
|
-
```tsx
|
|
252
|
-
import { AppHeader, BottomNav, MoreSheet, NavRail, PageContainer, Toaster } from '@nish/ui';
|
|
253
|
-
|
|
254
|
-
const [more, setMore] = useState(false);
|
|
255
|
-
|
|
256
|
-
<AppHeader name="Trackers" hubHref="https://nish.software" actions={<Search />} />
|
|
257
|
-
<NavRail items={primary} /> {/* md and up */}
|
|
258
|
-
<PageContainer>{children}</PageContainer> {/* pads for the bottom inset */}
|
|
259
|
-
<BottomNav {/* below md */}
|
|
260
|
-
items={primary}
|
|
261
|
-
more={{ active: false, expanded: more, onToggle: () => setMore((v) => !v) }}
|
|
262
|
-
/>
|
|
263
|
-
<MoreSheet open={more} onClose={() => setMore(false)} items={secondary} />
|
|
264
|
-
<Toaster /> {/* no offset */}
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
`items` are `NavItem`s (`key`, `label`, `icon`, `href` or `onSelect`, `active`, `badge`). Pass `renderLink` to use your router's Link.
|
|
268
|
-
|
|
269
|
-
Use this viewport meta in `<head>`:
|
|
270
|
-
|
|
271
|
-
```html
|
|
272
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content">
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
Do not ship a static `<meta name="theme-color">`: `theme-init.js` creates and updates its own from the active theme, and removes any static one at load.
|
|
276
|
-
|
|
277
|
-
## Formatting: `@nish/ui/format`
|
|
278
|
-
|
|
279
|
-
A React-free entry for money, percentages, numbers, bytes, durations and dates: `money`, `signedMoney`, `pct`, `num`, `signed`, `bytes`, `duration`, `ago`, `date`, `time`, `dateTime`, `dateRange`. Each returns an en dash for null, undefined, NaN and invalid dates, and works in static pages and on servers. It is not re-exported from `@nish/ui`.
|
|
280
|
-
|
|
281
|
-
```ts
|
|
282
|
-
import { money, pct, ago } from '@nish/ui/format';
|
|
283
|
-
|
|
284
|
-
money(1234.5); // "$1,234.50"
|
|
285
|
-
pct(0.0312, { fromRatio: true }); // "3.1%"
|
|
286
|
-
ago(Date.now() - 3 * 60_000); // "3m"
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
## Components
|
|
290
|
-
|
|
291
|
-
| Component | What it is | Docs |
|
|
292
|
-
|---|---|---|
|
|
293
|
-
| `Button`, `buttonClass()` | The standard action: primary, secondary, ghost, danger, soft, subtle and link; xs to lg; loading; `buttonClass()` for links | [Button](https://design.nish.software/#/components/button) |
|
|
294
|
-
| `IconButton`, `iconButtonClass()` | Icon-only button, 2xs/xs/sm/md, ghost/subtle/soft, danger tone; the required label is its accessible name and title | [IconButton](https://design.nish.software/#/components/icon-button) |
|
|
295
|
-
| `Card`, `cardClass()` | Surface panel: padding none/sm/md/lg, `as`, inset variant, optional header via title/description/action | [Card](https://design.nish.software/#/components/card) |
|
|
296
|
-
| `CardHeader` | Card header row: title, description, icon, action slot, divided | [CardHeader](https://design.nish.software/#/components/card-header) |
|
|
297
|
-
| `Badge`, `badgeClass()` | Status pill: 6 tones plus on-accent, 8 hues, xs/sm, pill or tag, optional dot | [Badge](https://design.nish.software/#/components/badge) |
|
|
298
|
-
| `Input`, `fieldClass()` | Text field: xs/sm/md, leading/trailing slots, invalid; 16px text and 44px on touch | [Input](https://design.nish.software/#/components/input) |
|
|
299
|
-
| `Textarea` | Multi-line text with the field look; sm/md, `autoGrow` | [Textarea](https://design.nish.software/#/components/textarea) |
|
|
300
|
-
| `Checkbox` | A checkbox with its label and hint, indeterminate, trailing slot; the whole row is the tap target | [Checkbox](https://design.nish.software/#/components/checkbox) |
|
|
301
|
-
| `Field` | Label, one control and its hint or error, wired for screen readers | [Field](https://design.nish.software/#/components/field) |
|
|
302
|
-
| `FieldGroup` | Field for a group of controls: a fieldset and legend, hint and error tied to the group | [FieldGroup](https://design.nish.software/#/components/field-group) |
|
|
303
|
-
| `Switch` | On/off setting that applies at once (`role="switch"`), with label and description | [Switch](https://design.nish.software/#/components/switch) |
|
|
304
|
-
| `SearchInput` | Search field with icon, Clear button and Escape to clear | [SearchInput](https://design.nish.software/#/components/search-input) |
|
|
305
|
-
| `Select` | Native select with the field look, xs/sm/md; keeps the platform picker on phones | [Select](https://design.nish.software/#/components/select) |
|
|
306
|
-
| `Label` | Small uppercase label for fields and card sections | [Label](https://design.nish.software/#/components/label) |
|
|
307
|
-
| `Skeleton`, `SkeletonLines` | Shimmer placeholders: one sized block, or a ready-made card body | [Skeleton](https://design.nish.software/#/components/skeleton) |
|
|
308
|
-
| `SkeletonRows` | A loading column of full-width rounded rows for lists and card pages | [SkeletonRows](https://design.nish.software/#/components/skeleton-rows) |
|
|
309
|
-
| `Spinner` | Loader in the current text color; with a label it is `role="status"` | [Spinner](https://design.nish.software/#/components/spinner) |
|
|
310
|
-
| `EmptyState` | What an empty list or widget shows: title, one line of why, an action | [EmptyState](https://design.nish.software/#/components/empty-state) |
|
|
311
|
-
| `ErrorState` | A failed load, announced to screen readers, with an optional Retry | [ErrorState](https://design.nish.software/#/components/error-state) |
|
|
312
|
-
| `Toaster`, `toast()` | Toast stack; `toast.success/error/warn/info` from anywhere, with body, action, duration and slot id; `offset` and `offsetUntil` clear a bottom tab bar | [Toast](https://design.nish.software/#/components/toast) |
|
|
313
|
-
| `Callout` | Inline tinted notice: tone, icon, title, action, dismiss, box or bar | [Callout](https://design.nish.software/#/components/callout) |
|
|
314
|
-
| `StatusDot` | Round status mark on the `-fill` roles, optional pulse and halo | [StatusDot](https://design.nish.software/#/components/status-dot) |
|
|
315
|
-
| `Stat`, `StatGrid`, `signTone()` | Labelled numbers in a `<dl>` grid; tone from a signed number | [Stat](https://design.nish.software/#/components/stat) |
|
|
316
|
-
| `Meter`, `toneFor()` | Thin meter or progress bar with threshold tones, or a neutral fill | [Meter](https://design.nish.software/#/components/meter) |
|
|
317
|
-
| `FlowSteps` | Animated plan: numbered steps joined by connectors that fill, a rippling active step, check draw, vertical or horizontal | [FlowSteps](https://design.nish.software/#/components/flow-steps) |
|
|
318
|
-
| `StepBar` | Compact segmented progress bar with a pulsing current segment | [StepBar](https://design.nish.software/#/components/step-bar) |
|
|
319
|
-
| `AgentNode` | Card for one agent or task: state icon, model badge, live activity line, running comet border | [AgentNode](https://design.nish.software/#/components/agent-node) |
|
|
320
|
-
| `WorkflowBoard` | Phases as columns (stacked when narrow) holding AgentNodes, with glow, progress and flowing connectors | [WorkflowBoard](https://design.nish.software/#/components/workflow-board) |
|
|
321
|
-
| `ActivityFeed` | Timeline of short updates, newest first; new rows open, fade in and flash | [ActivityFeed](https://design.nish.software/#/components/activity-feed) |
|
|
322
|
-
| `TickerText` | One line of text that slides when it changes | [TickerText](https://design.nish.software/#/components/ticker-text) |
|
|
323
|
-
| `AnimatedList`, `usePrefersReducedMotion()` | List with enter, exit and FLIP move animations; hook for the reduced-motion preference | [AnimatedList](https://design.nish.software/#/components/animated-list) |
|
|
324
|
-
| `SystemCanvas`, `layoutSystem()`, `pickLayout()`, `routeEdges()` | Pannable, zoomable graph-paper canvas of grouped nodes and right-angled edges, laid out in bands or columns (`layout="auto"` picks); edge kinds with a legend, hover focus, follow mode and a minimap. Also importable on its own from `@nish/ui/system-canvas` | [SystemCanvas](https://design.nish.software/#/components/system-canvas) |
|
|
325
|
-
| `Sparkline` | Dependency-free SVG trend line | [Sparkline](https://design.nish.software/#/components/sparkline) |
|
|
326
|
-
| `Disclosure` | `<details>` show-more, plain or card | [Disclosure](https://design.nish.software/#/components/disclosure) |
|
|
327
|
-
| `Kbd` | Keyboard key | [Kbd](https://design.nish.software/#/components/kbd) |
|
|
328
|
-
| `CopyButton`, `copyText()` | Copy to clipboard with a "Copied" state and a live announcement | [CopyButton](https://design.nish.software/#/components/copy-button) |
|
|
329
|
-
| `PageHeader` | Page title block with back link, eyebrow, description and actions | [PageHeader](https://design.nish.software/#/components/page-header) |
|
|
330
|
-
| `AppHeader` | Shared app header: hub pill, wordmark (optionally a home link, icon only on phones), actions, theme toggle, named nav row | [AppHeader](https://design.nish.software/#/components/app-header) |
|
|
331
|
-
| `SectionHeader` | A section's heading row inside a page, with meta and an action | [SectionHeader](https://design.nish.software/#/components/section-header) |
|
|
332
|
-
| `KeyValueList` | Label and value rows with dividers, as a list or a `<dl>` | [KeyValueList](https://design.nish.software/#/components/key-value-list) |
|
|
333
|
-
| `ChartLegend` | The key for multi-series charts: a color mark and a name per series | [ChartLegend](https://design.nish.software/#/components/chart-legend) |
|
|
334
|
-
| `TableWrap`, `Table`, `Th`, `Td`, `Tr`, `tableClass` | Table primitives (sticky header, sort, tone edge) and class recipes for TanStack | [Table](https://design.nish.software/#/components/table) |
|
|
335
|
-
| `Modal` | Dialog; bottom sheet under 640px; sizes md to full, top placement, custom header; Escape, focus trap, focus return, html and body scroll lock | [Modal](https://design.nish.software/#/components/modal) |
|
|
336
|
-
| `Drawer` | Side or bottom panel with the Modal's focus trap, Escape and scroll lock | [Drawer](https://design.nish.software/#/components/drawer) |
|
|
337
|
-
| `ConfirmDialog` | Yes-or-no question before an action, in place of `window.confirm` | [ConfirmDialog](https://design.nish.software/#/components/confirm-dialog) |
|
|
338
|
-
| `Tooltip` | Hover and focus hint in a portal on any side, flipped and clamped to the screen; `hint` variant | [Tooltip](https://design.nish.software/#/components/tooltip) |
|
|
339
|
-
| `Popover`, `menuItemClass()` | Non-modal panel anchored to an element; Escape and outside press close it (with the reason; `dismissOnOutside`); `menuItemClass()` for menu-looking rows inside it | [Popover](https://design.nish.software/#/components/popover) |
|
|
340
|
-
| `DropdownMenu` | Menu of actions behind a button, with `MenuItem`, `MenuLabel`, `MenuSeparator`, `MenuSubHeader` | [DropdownMenu](https://design.nish.software/#/components/dropdown-menu) |
|
|
341
|
-
| `Segmented` | Two to five mutually exclusive choices side by side (xs to md, block, disabled options, per-option tip and tone) | [Segmented](https://design.nish.software/#/components/segmented) |
|
|
342
|
-
| `MediaRow`, `MediaChip`, `MediaThumb` | A list row with a 16:9, round or square thumbnail, a two-line title, meta and detail lines and Live/Offline badges; a pill chip with a thumbnail; the thumbnail alone (https or relative sources only) | [MediaRow](https://design.nish.software/#/components/media-row) |
|
|
343
|
-
| `SplitStage`, `SplitDividers`, `LayoutPresetPicker`, `LayoutPresetIcon` | Up to four panes in a resizable split layout with a flat DOM (panes never move when the layout changes), separator handles, and a preset picker. The layout math is React-free at `@nish/ui/split-layout` | [SplitStage](https://design.nish.software/#/components/split-stage) |
|
|
344
|
-
| `Chip`, `ChipGroup`, `chipClass()` | Multi-select filter chips, suggestions and removable tags; `chipClass()` for links | [Chip](https://design.nish.software/#/components/chip) |
|
|
345
|
-
| `Tabs`, `TabPanel`, `tabClass()` | ARIA tabs (underline or pill, xs to md, block, responsive panes); `tabClass()` for router links | [Tabs](https://design.nish.software/#/components/tabs) |
|
|
346
|
-
| `Inbox` | One list for events from every app: Open, Snoozed and Handled views, source filter, handle and snooze actions; see [Inbox](#inbox) | [Inbox](https://design.nish.software/#/components/inbox) |
|
|
347
|
-
| `AppShell` | The app frame from one `nav` list: AppHeader with desktop tabs and a More menu, NavRail on tablets, BottomNav and MoreSheet on phones, PageContainer, Toaster, ConnectionBanner, LoadingBar and a skip link | [AppShell](https://design.nish.software/#/components/app-shell) |
|
|
348
|
-
| `apiFetch()`, `ApiError`, `configureApi()`, `useResource()` | JSON fetch with typed errors (status 0 for network failures, 401 hook), and a data hook that pauses while the tab is hidden, refetches on reconnect and when visible again, polls, and aborts on unmount | [useResource](https://design.nish.software/#/components/use-resource) |
|
|
349
|
-
| `AppErrorBoundary` | Themed fallback for a render crash or a failed lazy chunk, with Try again and Reload | [AppErrorBoundary](https://design.nish.software/#/components/app-error-boundary) |
|
|
350
|
-
| `FilterBar`, `FilterSheet`, `useUrlState()` | Filter row that becomes a Filters button and bottom sheet when narrow; filters that live in the URL (arrays as repeated keys) with an optional router adapter | [FilterBar](https://design.nish.software/#/components/filter-bar) |
|
|
351
|
-
| `SettingsSection`, `SettingRow`, `NumberField`, `useSaveStatus()` | Settings page rows with a label, hint and live save status; a number field that saves on blur and Enter | [Settings](https://design.nish.software/#/components/settings) |
|
|
352
|
-
| `Combobox` | ARIA 1.2 combobox with a listbox: filter, async search, custom values, keyboard and touch | [Combobox](https://design.nish.software/#/components/combobox) |
|
|
353
|
-
| `BREAKPOINTS`, `PHONE_QUERY`, `NARROW_QUERY`, `usePhone()`, `useNarrow()` | The Tailwind breakpoints as data, and hooks for phone (under 640px) and narrow (under 768px) | [Hooks](https://design.nish.software/#/components/hooks) |
|
|
354
|
-
| `@nish/ui/vite`, `@nish/ui/eslint`, `nish-th-check` | The theme-init Vite plugin, the lint preset and the class checker (Node only) | [Vite plugin and lint](https://design.nish.software/#/components/vite-plugin) |
|
|
355
|
-
| `ThemeToggle`, `useTheme()` | System / Light / Dark control with labels, compact mode, a pill variant and an optional preset picker | [ThemeToggle](https://design.nish.software/#/components/theme-toggle) |
|
|
356
|
-
| `mountThemeToggle()` | `@nish/ui/theme` and `window.nishTheme`: the one-button theme toggle for static pages, optionally with the word | [mountThemeToggle](https://design.nish.software/#/components/mount-theme-toggle) |
|
|
357
|
-
| `showToast()` | `@nish/ui/theme` and `window.nishTheme`: one toast for static pages, with the React toast's timer policy | [showToast](https://design.nish.software/#/components/show-toast) |
|
|
358
|
-
| `@nish/ui/system-canvas` | `SystemCanvas` and its layout and routing helpers, for loading the canvas in a lazy chunk | [SystemCanvas](https://design.nish.software/#/components/system-canvas) |
|
|
359
|
-
| `@nish/ui/chart` | `seriesColor`, `CHART`, `tooltipStyle`, `chartTheme`, `useChartTheme` for any chart library | [Chart colors](https://design.nish.software/#/components/chart) |
|
|
360
|
-
| `@nish/ui/tokens` | Token data for Node scripts, with no React import | [Color](https://design.nish.software/#/color) |
|
|
361
|
-
| `.nish-prose` | Markdown and rich text styles (nish.css, tailwind.css) | [Prose](https://design.nish.software/#/components/prose) |
|
|
362
|
-
| `.nish-skip-link`, `kbd`, `.scrollbar-none` | Base helpers (nish.css, tailwind.css) | [Base utilities](https://design.nish.software/#/components/base-utilities) |
|
|
363
|
-
| `nish-components.css` | Static component classes for pages without React: `.nish-btn`, `.nish-card`, `.nish-badge`, fields, `.nish-seg`, `.nish-chip`, `.nish-callout`, `.nish-stats`, `.nish-table-wrap`, `.nish-meter`, `.nish-disclosure`, `.nish-dot`, `.nish-search`, `.nish-theme-btn` (and `--pill`, `--labelled`), `.nish-toast`, `.nish-glass`, empty and error states. Link it after `nish.css`. | [Static sites](https://design.nish.software/#/static-sites) |
|
|
364
|
-
|
|
365
|
-
Also exported: `cn()` (clsx plus a tailwind-merge that knows the `th-*` colors), the theme
|
|
366
|
-
functions, and `THEMES`, `SCALE`, `COLOR_ROLES`, `SOFT_ROLES`, `HUE_ROLES`, `SHADOWS`, `PRESETS`.
|
|
367
|
-
|
|
368
|
-
## Inbox
|
|
369
|
-
|
|
370
|
-
`Inbox` renders the list; the page owns the data. Props: `items`, `view` and `onViewChange`
|
|
371
|
-
(open, snoozed, handled), `counts`, `sources`, `source` and `onSourceChange`, the actions
|
|
372
|
-
`onHandle`, `onUnhandle`, `onSnooze(id, until)`, `onUnsnooze` and optional `onHandleAll`, plus
|
|
373
|
-
`loading`, `error`, `onRetry`, `hasMore`, `onLoadMore`, `loadingMore`, `selectedId`, `sourceLabels` and
|
|
374
|
-
`onAction(itemId, actionId)` (returns a Promise; shows each item's `actions` as buttons).
|
|
375
|
-
The event types and `INBOX_SOURCE_LABELS` are exported from `@nish/ui` as well.
|
|
376
|
-
|
|
377
|
-
Apps send events with the React-free client:
|
|
378
|
-
|
|
379
|
-
```ts
|
|
380
|
-
import { createInboxClient } from '@nish/ui/inbox-client';
|
|
381
|
-
|
|
382
|
-
const inbox = createInboxClient({ source: 'trackers' });
|
|
383
|
-
await inbox.send({ kind: 'price-drop', title: 'Headphones dropped to $298', url, dedupeKey: sku });
|
|
384
|
-
await inbox.resolve(sku); // marks the open item handled
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
The client never throws and queues up to 200 events while the service is down. It posts to
|
|
388
|
-
`INBOX_URL` (default `http://127.0.0.1:8805`); `INBOX_URL=off` turns it into a no-op for tests and CI.
|
|
389
|
-
Producers import it at runtime, so list `@nish/ui` under `dependencies`.
|
|
390
|
-
|
|
391
|
-
### Item actions
|
|
392
|
-
|
|
393
|
-
An event can carry up to 3 buttons. Tapping one makes the inbox service call the producer, server to
|
|
394
|
-
server:
|
|
395
|
-
|
|
396
|
-
```ts
|
|
397
|
-
await inbox.send({
|
|
398
|
-
kind: 'run-failed', title: 'ui: check failed', dedupeKey: runId,
|
|
399
|
-
actions: [{ id: 'rerun', label: 'Re-run', target: 'http://127.0.0.1:8820/actions/rerun' }],
|
|
400
|
-
});
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
| Field | Rule |
|
|
404
|
-
|---|---|
|
|
405
|
-
| `id` | `/^[a-z0-9][a-z0-9-]{0,31}$/`, unique in the event |
|
|
406
|
-
| `label` | trimmed, 1-40 characters (longer is cut with an ellipsis) |
|
|
407
|
-
| `method` | `'POST'`, may be left out |
|
|
408
|
-
| `target` | `http://127.0.0.1:<port>/…` only: explicit port, no credentials, no `#hash`, ≤ 2000 characters (`isInboxActionTarget`) |
|
|
409
|
-
|
|
410
|
-
The service POSTs an `InboxActionCall` JSON body, `{ itemId, actionId, source, kind, dedupeKey, data }`,
|
|
411
|
-
with the header `X-Inbox-Action: 1` (`INBOX_ACTION_HEADER`), waits at most 8 s (`INBOX_ACTION_TIMEOUT_MS`)
|
|
412
|
-
and follows no redirects. A 2xx answer marks the item handled. Anything else leaves it open. Either way the
|
|
413
|
-
outcome is stored as `item.lastAction` (`InboxActionResult`). A repeat event with the same dedupeKey replaces
|
|
414
|
-
the item's actions.
|
|
415
|
-
|
|
416
|
-
## An app's own themes: registerThemes
|
|
417
|
-
|
|
418
|
-
Shared themes cover most apps. To offer more, style them with `[data-theme='<id>']`
|
|
419
|
-
blocks that set every `--nish-*` color role, then register them so the theme logic accepts
|
|
420
|
-
the names and knows whether each is dark or light:
|
|
421
|
-
|
|
422
|
-
```html
|
|
423
|
-
<!-- before theme-init.js, so the first paint knows them -->
|
|
424
|
-
<script>window.__nishExtraThemes = { rose: 'dark', paper: 'light' };</script>
|
|
90
|
+
```css
|
|
91
|
+
.panel { background: var(--nish-surface); color: var(--nish-hi2); }
|
|
425
92
|
```
|
|
426
93
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
registerThemes({ rose: 'dark', paper: 'light' });
|
|
430
|
-
initTheme();
|
|
431
|
-
```
|
|
94
|
+
A classic-script build (`theme.global.js`, `window.nishTheme`) covers pages that cannot use
|
|
95
|
+
modules. See [Static sites](https://design.nish.software/#/static-sites).
|
|
432
96
|
|
|
433
|
-
|
|
434
|
-
back to their default, so pick ids that will not collide with future shared themes.
|
|
97
|
+
## Theming
|
|
435
98
|
|
|
436
|
-
|
|
99
|
+
Seven themes: `dark` (the default), `light`, and the presets `slate`, `terminal`, `mocha`,
|
|
100
|
+
`ocean` and `contrast`. Each preset is dark or light, so a page limited to those two shows
|
|
101
|
+
the one it is based on.
|
|
437
102
|
|
|
438
|
-
|
|
439
|
-
|
|
103
|
+
- **Before first paint.** `theme-init.js` puts the saved theme on `<html>` before anything
|
|
104
|
+
renders, then the page follows the OS when the choice is `system`.
|
|
105
|
+
- **Across subdomains.** The choice is saved to `localStorage` and, on nish.software or the
|
|
106
|
+
domain named by `<html data-nish-domain="example.com">`, to a cookie on that domain, so
|
|
107
|
+
picking Mocha on one app opens its sibling apps in Mocha too.
|
|
108
|
+
- **Scoped.** `<div data-theme="light" data-scheme="light">` themes one subtree.
|
|
109
|
+
- **Your own themes.** `registerThemes({ rose: 'dark' })` plus `[data-theme='rose']` CSS.
|
|
110
|
+
- **Canvas and charts.** `readToken('chart-1')` and `onThemeChange()`, or `nish-ui/chart`.
|
|
440
111
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const colors = () => ({
|
|
445
|
-
series: Array.from({ length: 8 }, (_, i) => readToken(`chart-${i + 1}`)),
|
|
446
|
-
grid: readToken('line'),
|
|
447
|
-
text: readToken('hi3'),
|
|
448
|
-
});
|
|
449
|
-
const off = onThemeChange(() => chart.update(colors()));
|
|
450
|
-
```
|
|
112
|
+
Every role and its value in each theme: [Color](https://design.nish.software/#/color) and
|
|
113
|
+
[Themes](https://design.nish.software/#/themes).
|
|
451
114
|
|
|
452
|
-
|
|
453
|
-
other non-color tokens are in `SCALE` (`SCALE['bp-md']`).
|
|
454
|
-
|
|
455
|
-
## Accessibility guarantees
|
|
456
|
-
|
|
457
|
-
- **Contrast.** `tools/contrast.mjs` (run by `npm run check`, CI and every release) checks
|
|
458
|
-
every theme: body text at 4.5:1 on bg, surface and elevated; status and accent text at
|
|
459
|
-
4.5:1 on bg, surface and their own soft tint; every `on-*` color at 4.5:1 on its fill;
|
|
460
|
-
placeholders, chart series, fills and hues at 3:1. The docs site's
|
|
461
|
-
[Themes page](https://design.nish.software/#/themes) shows the same pairs as a matrix.
|
|
462
|
-
- **Target device: Samsung Galaxy Z Fold 7.** Every app built on this package is reviewed
|
|
463
|
-
on it. The cover screen is narrow (about 360–390 CSS px), and unfolded it is a near-square
|
|
464
|
-
~840px. Components, and every page that uses them, must look right with no horizontal page
|
|
465
|
-
scroll at 360px, at ~840px and at desktop width, in light and dark. `visual-check.mjs`
|
|
466
|
-
checks exactly those sizes by default (`phone-small`, `fold`, `desktop`).
|
|
467
|
-
- **Tap targets.** Buttons, icon buttons, fields and toggles grow to 44px on touch screens
|
|
468
|
-
(`pointer-coarse:`) and stay compact under a mouse.
|
|
469
|
-
- **Tips on touch.** Tooltip and Segmented `tip` open on mouse hover and keyboard focus, never
|
|
470
|
-
on a tap of the control they explain, so a tip never stays pinned over a phone screen. A
|
|
471
|
-
hint term (the trigger itself) still opens on a tap.
|
|
472
|
-
- **Focus.** base.css gives every element a visible `:focus-visible` ring in the accent
|
|
473
|
-
color. Modal traps Tab and returns focus to the opener; Tooltip triggers are focusable.
|
|
474
|
-
- **Reduced motion.** Under `prefers-reduced-motion`, base.css cuts animations and
|
|
475
|
-
transitions to 1ms and the skeleton shimmer stops.
|
|
476
|
-
- **Semantics.** ErrorState is `role="alert"`, toasts are a live region, IconButton requires
|
|
477
|
-
a label, Modal is `role="dialog"` with `aria-modal` and a labelled title.
|
|
478
|
-
|
|
479
|
-
`tools/visual-check.mjs` screenshots any site at desktop and phone sizes in each theme and
|
|
480
|
-
fails on sideways scrolling, clipped text, axe contrast and tap-target violations, console
|
|
481
|
-
errors, missing focus rings and empty screenshots.
|
|
482
|
-
|
|
483
|
-
## Releasing
|
|
484
|
-
|
|
485
|
-
Releases run in CI (`release.yml`), go to every nish.software app through the fan-out, and are
|
|
486
|
-
published to npm as `nish-ui`. The whole flow, the merge policy and the npm setup:
|
|
487
|
-
[docs/RELEASING.md](docs/RELEASING.md).
|
|
488
|
-
|
|
489
|
-
## The docs site
|
|
490
|
-
|
|
491
|
-
The site at https://design.nish.software is built from this repo's own `src` and `dist`, so it
|
|
492
|
-
always shows exactly the code being released.
|
|
115
|
+
## What's in it
|
|
493
116
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
npm run build:site # builds dist/, then the static site into site-dist/
|
|
497
|
-
npm run preview:site # serves site-dist/ at http://localhost:5191
|
|
498
|
-
```
|
|
117
|
+
More than 60 components, each with live stories, props and guidelines on the
|
|
118
|
+
[docs site](https://design.nish.software/#/components):
|
|
499
119
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
120
|
+
- **Actions and inputs:** Button, IconButton, Input, Textarea, Select, Combobox, Checkbox,
|
|
121
|
+
Switch, Segmented, Chip, SearchInput, Field
|
|
122
|
+
- **Feedback:** Toast, Callout, Spinner, Skeleton, EmptyState, ErrorState, StatusDot, Meter
|
|
123
|
+
- **Overlays:** Modal, Drawer, ConfirmDialog, Popover, DropdownMenu, Tooltip
|
|
124
|
+
- **Settings:** SettingsSection, SettingRow, NumberField, ServiceTokensSection (list and revoke
|
|
125
|
+
service tokens)
|
|
126
|
+
- **Layout and navigation:** AppShell, AppHeader, BottomNav, NavRail, MoreSheet, Tabs,
|
|
127
|
+
PageHeader, Card, Table, FilterBar, SplitStage
|
|
128
|
+
- **Data and motion:** Stat, Sparkline, MediaRow, ActivityFeed, WorkflowBoard, SystemCanvas,
|
|
129
|
+
AnimatedList
|
|
505
130
|
|
|
506
|
-
|
|
131
|
+
Entry points:
|
|
507
132
|
|
|
508
|
-
|
|
|
133
|
+
| Import | What |
|
|
509
134
|
|---|---|
|
|
510
|
-
| `
|
|
511
|
-
| `
|
|
512
|
-
| `
|
|
513
|
-
| `
|
|
514
|
-
| `
|
|
515
|
-
| `
|
|
516
|
-
| `
|
|
517
|
-
| `
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
**The page flashes the wrong theme on load.** `theme-init.js` must run before any
|
|
545
|
-
stylesheet and must not be `async`, `defer` or a module. Inline it at the top of `<head>`
|
|
546
|
-
(or load it render-blocking). If the app registers its own themes,
|
|
547
|
-
`window.__nishExtraThemes` must be set before it.
|
|
548
|
-
|
|
549
|
-
**A preset chosen on another site shows as dark or light here.** The page limits itself
|
|
550
|
-
with `data-nish-themes`; that is the intended fallback.
|
|
551
|
-
|
|
552
|
-
**Fonts 404 on a static site after an upgrade.** Font names now carry a hash. Copy every
|
|
553
|
-
file in `dist/files.json`, not a fixed list.
|
|
554
|
-
|
|
555
|
-
## Versioning
|
|
556
|
-
|
|
557
|
-
Semver on the git tags. A change is **breaking** when an app has to edit its code or
|
|
558
|
-
markup to keep working or keep its look: removing or renaming a token, role, class,
|
|
559
|
-
export, prop or file; changing a component's default; changing the cookie or storage key.
|
|
560
|
-
Before 1.0 a breaking change bumped the minor (0.2.0); from 1.0 it bumps the major, so a major means app code must change, a minor adds, a patch fixes. New roles,
|
|
561
|
-
components, props and files, and color adjustments that keep every contrast check passing,
|
|
562
|
-
are minor or patch. Record every change in `CHANGELOG.md`.
|
|
135
|
+
| `nish-ui` | React components, hooks, theme functions |
|
|
136
|
+
| `nish-ui/tailwind.css` | Tailwind 4 theme and base styles |
|
|
137
|
+
| `nish-ui/nish.css` | The same without Tailwind |
|
|
138
|
+
| `nish-ui/theme` | Theme switching, React-free |
|
|
139
|
+
| `nish-ui/format` | Money, percent, date formatters |
|
|
140
|
+
| `nish-ui/chart` | Chart colors for any library |
|
|
141
|
+
| `nish-ui/vite` | The theme-init Vite plugin |
|
|
142
|
+
| `nish-ui/eslint` | Lint rules for theme classes |
|
|
143
|
+
|
|
144
|
+
Also `nish-ui/tokens` (token data for Node), `nish-ui/tsconfig/*` (strict presets), the
|
|
145
|
+
`nish-th-check` CLI, and `nish-ui/server`, `nish-ui/server/hono` and `nish-ui/inbox-client`
|
|
146
|
+
(the nish.software apps' login and inbox kit, which other projects can ignore).
|
|
147
|
+
Details: [Vite plugin and lint](https://design.nish.software/#/components/vite-plugin).
|
|
148
|
+
|
|
149
|
+
## Accessibility
|
|
150
|
+
|
|
151
|
+
- Every theme passes WCAG contrast (4.5:1 text, 3:1 graphics), checked in CI and shown as a
|
|
152
|
+
matrix on [Themes](https://design.nish.software/#/themes).
|
|
153
|
+
- Controls grow to 44px tap targets on touch screens and stay compact under a mouse.
|
|
154
|
+
- Visible focus rings, focus traps in dialogs, live regions for toasts, and reduced motion
|
|
155
|
+
respected everywhere.
|
|
156
|
+
- Every component is checked at 360px, 840px and desktop widths, in light and dark.
|
|
157
|
+
|
|
158
|
+
## Links
|
|
159
|
+
|
|
160
|
+
- Docs and live components: [design.nish.software](https://design.nish.software)
|
|
161
|
+
- Changelog: [CHANGELOG.md](https://github.com/nishant/ui/blob/master/CHANGELOG.md)
|
|
162
|
+
- Releasing (CI, the app fan-out, npm): [docs/RELEASING.md](https://github.com/nishant/ui/blob/master/docs/RELEASING.md)
|
|
163
|
+
- Working on this repo: [docs/DEVELOPING.md](https://github.com/nishant/ui/blob/master/docs/DEVELOPING.md)
|
|
164
|
+
- Troubleshooting and versioning: [Getting started](https://design.nish.software/#/getting-started)
|
|
165
|
+
- Issues: [github.com/nishant/ui/issues](https://github.com/nishant/ui/issues)
|
|
166
|
+
|
|
167
|
+
MIT licensed.
|