@wearenotch/ui-react 0.3.2 → 0.6.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 -0
- package/dist/index.cjs.js +19 -19
- package/dist/index.css +1 -1
- package/dist/index.d.ts +235 -36
- package/dist/index.esm.js +6236 -6108
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @wearenotch/ui-react
|
|
2
|
+
|
|
3
|
+
React components for the Notch Design System.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @wearenotch/ui-react @wearenotch/tokens
|
|
9
|
+
# or
|
|
10
|
+
npm install @wearenotch/ui-react @wearenotch/tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`react` and `react-dom` (**>=19**) are peer dependencies.
|
|
14
|
+
|
|
15
|
+
> **On React 18?** Pin to the `0.3.x` line: `"@wearenotch/ui-react": "~0.3.2"`. Versions `0.4.0+` require React 19 — see the [migration note](#migrating-from-03x-react-18) below.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Import the tokens stylesheet **once** in your app entry, then use components anywhere:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
// app entry (e.g. src/main.tsx)
|
|
23
|
+
import '@wearenotch/tokens/css';
|
|
24
|
+
import '@wearenotch/ui-react/css';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Button, Input, FormField } from '@wearenotch/ui-react';
|
|
29
|
+
|
|
30
|
+
export function SignIn() {
|
|
31
|
+
return (
|
|
32
|
+
<form>
|
|
33
|
+
<FormField label="Email" htmlFor="email">
|
|
34
|
+
<Input id="email" type="email" />
|
|
35
|
+
</FormField>
|
|
36
|
+
<Button variant="primary" type="submit">Sign in</Button>
|
|
37
|
+
</form>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Dark mode
|
|
43
|
+
|
|
44
|
+
Dark mode is CSS-only — toggle the `data-theme` attribute on `<html>`:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
document.documentElement.setAttribute('data-theme', 'dark');
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
No JavaScript color switching, no provider — every component reads tokens that respond to `data-theme="dark"`.
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
35 components covering primitives, forms, feedback, navigation, layout, and data display:
|
|
55
|
+
|
|
56
|
+
**Primitives** Button, IconButton, Badge, Tag, Avatar, Spinner, Skeleton, Tooltip
|
|
57
|
+
**Forms** Input, Textarea, Select, MultiSelect, Checkbox, Switch, Slider, FormField, FileUpload, DatePicker, RichTextEditor
|
|
58
|
+
**Feedback** Alert, Notification, ProgressBar, EmptyState
|
|
59
|
+
**Navigation** Tabs, Accordion, Breadcrumbs, Pagination, Stepper
|
|
60
|
+
**Layout** Card, Modal, List, Carousel
|
|
61
|
+
**Data display** Table, Chart
|
|
62
|
+
|
|
63
|
+
## Conventions
|
|
64
|
+
|
|
65
|
+
- All components forward refs where applicable and spread unknown HTML attributes onto their root element.
|
|
66
|
+
- Sizes use `sm | md | lg`.
|
|
67
|
+
- Form controls expose `value` / `onChange` and accept `id`, `name`, `disabled`, etc.
|
|
68
|
+
- Every interactive component has an accessible name — pass a visible label or `aria-label`.
|
|
69
|
+
|
|
70
|
+
## Storybook
|
|
71
|
+
|
|
72
|
+
Browse all components and variants:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pnpm --filter @notch/storybook dev
|
|
76
|
+
# http://localhost:6006
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Migrating from 0.3.x (React 18)
|
|
80
|
+
|
|
81
|
+
Version `0.4.0` bumps the React peer dependency to `>=19.0.0` and adopts the React 19 ref-as-prop pattern internally. **No code changes are required in consumer apps** — `*Props` interfaces are unchanged. The break is purely at the peer dependency level.
|
|
82
|
+
|
|
83
|
+
To migrate:
|
|
84
|
+
|
|
85
|
+
1. Upgrade your app to React 19 (`react`, `react-dom`, `@types/react`, `@types/react-dom`).
|
|
86
|
+
2. Bump `@wearenotch/ui-react` to `^0.4.0`.
|
|
87
|
+
3. If you were doing `forwardRef`-style ref forwarding around our components, that still works — `ref` is now a regular prop and is forwarded automatically.
|
|
88
|
+
|
|
89
|
+
If you can't upgrade React yet, stay on `~0.3.2`. We will not backport new features to `0.3.x`, but security fixes will land there if needed.
|
|
90
|
+
|
|
91
|
+
## Scripts
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pnpm --filter @wearenotch/ui-react build # build dist/
|
|
95
|
+
pnpm --filter @wearenotch/ui-react test # run vitest
|
|
96
|
+
pnpm --filter @wearenotch/ui-react type-check # tsc --noEmit
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT
|