@common-origin/design-system 2.14.0 → 2.15.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 +50 -184
- package/dist/client.esm.js +182 -98
- package/dist/client.esm.js.map +1 -1
- package/dist/client.js +182 -98
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Badge/Badge.d.ts +2 -0
- package/dist/components/atoms/Chip/shared/utils.d.ts +3 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +4 -0
- package/dist/components/layout/GridSystem/GridSystem.d.ts +6 -0
- package/dist/components/molecules/CardLarge/CardLarge.d.ts +3 -1
- package/dist/components/molecules/CardSmall/CardSmall.d.ts +2 -0
- package/dist/components/molecules/Dropdown/Dropdown.d.ts +2 -0
- package/dist/components/molecules/FeatureBlock/FeatureBlock.d.ts +2 -0
- package/dist/components/molecules/PageTitle/PageTitle.d.ts +13 -0
- package/dist/data.esm.js +5 -1
- package/dist/data.esm.js.map +1 -1
- package/dist/data.js +5 -1
- package/dist/data.js.map +1 -1
- package/dist/styles/tokens.json +5 -1
- package/dist/tokens/index.esm.js +5 -1
- package/dist/tokens/index.esm.js.map +1 -1
- package/dist/tokens/index.js +5 -1
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/types/tokens.d.ts +4 -0
- package/dist/types/tokens.d.ts +4 -0
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -1,220 +1,86 @@
|
|
|
1
1
|
# Common Origin Design System
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components and design tokens for Common Origin products, published as [`@common-origin/design-system`](https://www.npmjs.com/package/@common-origin/design-system). Components work in any React app (Next.js, Vite, React Router and so on), are built from design tokens, and meet WCAG 2.2 AA.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Docs site:** https://common-origin-design-system.vercel.app/ (components at `/components`, tokens at `/tokens`)
|
|
6
|
+
- **Why it exists, who it serves and how decisions are made:** [docs/foundation/](docs/foundation/README.md)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
If you're upgrading from v1.x, see **[MIGRATION-V2.md](./MIGRATION-V2.md)** for the complete migration guide.
|
|
10
|
-
|
|
11
|
-
**Quick summary:** Components like `Button`, `Breadcrumbs`, and `CardSmall` now accept an optional `linkComponent` prop. Pass your framework's Link component (e.g., Next.js Link, React Router Link) for client-side navigation, or omit it to use standard HTML links.
|
|
12
|
-
|
|
13
|
-
## 🚀 Getting Started
|
|
14
|
-
|
|
15
|
-
### Installation
|
|
8
|
+
## Install
|
|
16
9
|
|
|
17
10
|
```bash
|
|
18
|
-
npm install @common-origin/design-system styled-components
|
|
11
|
+
npm install @common-origin/design-system react react-dom styled-components
|
|
19
12
|
```
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
Peer dependencies: `react` and `react-dom` 18 or 19, and `styled-components` 6.
|
|
22
15
|
|
|
23
16
|
```tsx
|
|
24
|
-
import { Button,
|
|
25
|
-
|
|
26
|
-
// For Next.js apps, pass Link component for client-side routing
|
|
27
|
-
import Link from 'next/link'
|
|
17
|
+
import { Button, Stack, Typography } from '@common-origin/design-system'
|
|
28
18
|
|
|
29
|
-
function
|
|
19
|
+
export function Welcome() {
|
|
30
20
|
return (
|
|
31
21
|
<Stack direction="column" gap="md">
|
|
32
22
|
<Typography variant="h1">Welcome</Typography>
|
|
33
|
-
<Button
|
|
34
|
-
purpose="link"
|
|
35
|
-
url="/about"
|
|
36
|
-
linkComponent={Link}
|
|
37
|
-
>
|
|
38
|
-
Learn More
|
|
39
|
-
</Button>
|
|
23
|
+
<Button variant="primary">Get started</Button>
|
|
40
24
|
</Stack>
|
|
41
25
|
)
|
|
42
26
|
}
|
|
43
27
|
```
|
|
44
28
|
|
|
45
|
-
|
|
29
|
+
Tokens are exported from the main entry and from `@common-origin/design-system/tokens`. Fonts, links and routing, server rendering and known issues are covered in the [usage guide](docs/foundation/usage.md).
|
|
46
30
|
|
|
47
|
-
|
|
48
|
-
# Install dependencies
|
|
49
|
-
npm install
|
|
31
|
+
Upgrading from v1? See [MIGRATION-V2.md](MIGRATION-V2.md).
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
npm run build:tokens
|
|
33
|
+
## What's in the package
|
|
53
34
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
- **Atoms** (`src/components/atoms/`): 18 components, including Button, Typography, Stack, Box, Chip and Icon
|
|
36
|
+
- **Molecules** (`src/components/molecules/`): 25 components, including Alert, Dropdown, List, Modal, TextField and TabBar
|
|
37
|
+
- **Layout** (`src/components/layout/`): GridSystem (Grid, GridCol, ResponsiveGrid)
|
|
38
|
+
- **Tokens** (`src/tokens/`): base, semantic and component tiers, compiled by Style Dictionary to `src/styles/tokens.json`, `.css` and `.d.ts` ([pipeline](docs/tokens/pipeline.md))
|
|
57
39
|
|
|
58
|
-
|
|
40
|
+
The docs site lists every component with its props, examples and accessibility notes, except PageTitle, which is deprecated and will be removed in the next major version: use `Typography variant="h1"` in a `Stack` instead ([#81](https://github.com/common-origin/common-origin-design-system/issues/81)).
|
|
59
41
|
|
|
60
|
-
##
|
|
42
|
+
## Repository layout
|
|
61
43
|
|
|
62
44
|
```
|
|
63
45
|
src/
|
|
64
|
-
├── components/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
├──
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
pages/ # Interactive documentation
|
|
74
|
-
├── design/
|
|
75
|
-
│ ├── components.tsx # Live component gallery
|
|
76
|
-
│ └── tokens.tsx # Design token reference
|
|
77
|
-
└── index.tsx # Landing page
|
|
78
|
-
|
|
79
|
-
lib/ # Documentation tooling
|
|
80
|
-
└── docgen/ # Automated component documentation system
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## 🎨 Features
|
|
84
|
-
|
|
85
|
-
- **Production Ready**: Complete design system with 24+ components
|
|
86
|
-
- **Atomic Design**: Components organized by complexity (atoms → molecules → organisms)
|
|
87
|
-
- **Design Tokens**: Comprehensive token system built with Style Dictionary
|
|
88
|
-
- **Accessibility**: WCAG 2.2 AA compliance with automated jest-axe testing
|
|
89
|
-
- **TypeScript**: Full type safety and IntelliSense support
|
|
90
|
-
- **Interactive Docs**: Live component gallery with code examples
|
|
91
|
-
- **Comprehensive Testing**: 500+ tests with React Testing Library
|
|
92
|
-
- **Token-Driven**: All styling uses semantic design tokens (no hardcoded values)
|
|
93
|
-
|
|
94
|
-
## 📖 Documentation
|
|
95
|
-
|
|
96
|
-
- **Components**: `/design/components` - Interactive component gallery with live examples
|
|
97
|
-
- **Tokens**: `/design/tokens` - Complete design token reference
|
|
98
|
-
- **Home**: `/` - Design system overview and navigation
|
|
99
|
-
|
|
100
|
-
## 🔧 Development Commands
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
npm run dev # Start development server
|
|
104
|
-
npm run build # Build Next.js app
|
|
105
|
-
npm run build:package # Build npm package
|
|
106
|
-
npm run build:tokens # Generate design tokens
|
|
107
|
-
npm run test # Run tests
|
|
108
|
-
npm run test:watch # Run tests in watch mode
|
|
109
|
-
npm run test:coverage # Run tests with coverage
|
|
110
|
-
npm run typecheck # Type checking
|
|
111
|
-
npm run docs:generate # Generate component docs
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## � Requirements
|
|
115
|
-
|
|
116
|
-
This design system supports:
|
|
117
|
-
- **React**: 18.x or 19.x
|
|
118
|
-
- **TypeScript**: 4.x or higher (recommended)
|
|
119
|
-
|
|
120
|
-
## �📦 Package Usage
|
|
121
|
-
|
|
122
|
-
Install the design system in your project:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
npm install @common-origin/design-system
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Import and use components:
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
import { Button, Typography, Stack, Alert } from '@common-origin/design-system'
|
|
132
|
-
import tokens from '@common-origin/design-system/tokens'
|
|
133
|
-
|
|
134
|
-
function MyApp() {
|
|
135
|
-
return (
|
|
136
|
-
<Stack direction="column" gap="md">
|
|
137
|
-
<Typography variant="heading1">Welcome</Typography>
|
|
138
|
-
<Alert variant="info">Design system is ready!</Alert>
|
|
139
|
-
<Button variant="primary" size="lg">
|
|
140
|
-
Get Started
|
|
141
|
-
</Button>
|
|
142
|
-
</Stack>
|
|
143
|
-
)
|
|
144
|
-
}
|
|
46
|
+
├── components/ # The published package: atoms, molecules, layout
|
|
47
|
+
├── tokens/ # Token sources
|
|
48
|
+
├── styles/ # Generated tokens (JSON, CSS, types) and icon data
|
|
49
|
+
├── lib/ # Shared helpers (styleUtils, usePresence) and docs-site data (componentsData.ts registers each .docs.tsx)
|
|
50
|
+
├── page-components/ # Docs-site only (layout, navigation, footer, hero)
|
|
51
|
+
├── patterns/ # Docs-site only (pattern examples)
|
|
52
|
+
└── index.ts # Package entry
|
|
53
|
+
pages/ # Docs site (Next.js): /, /components, /tokens, /patterns, /releases
|
|
54
|
+
docs/foundation/ # Purpose, users, principles, visual language, decisions
|
|
145
55
|
```
|
|
146
56
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
**✅ Atoms (12 components)**:
|
|
150
|
-
- Alert, Avatar, Box, Button, Chip, Container
|
|
151
|
-
- Picture, Icon, IconButton, Divider
|
|
152
|
-
- Stack, Typography
|
|
153
|
-
|
|
154
|
-
**✅ Molecules (8 components)**:
|
|
155
|
-
- ArtCard, Breadcrumbs, ChipGroup, CodeBlock
|
|
156
|
-
- DesignCard, Dropdown, PageTitle, ReleaseCard
|
|
157
|
-
|
|
158
|
-
**✅ Organisms (3 components)**:
|
|
159
|
-
- Footer, HeroBanner, Navigation
|
|
57
|
+
Package components never import from `src/page-components/`, `src/patterns/` or `pages/`.
|
|
160
58
|
|
|
161
|
-
|
|
162
|
-
- GridSystem
|
|
59
|
+
## Development
|
|
163
60
|
|
|
164
|
-
|
|
61
|
+
Requires Node 20 or later.
|
|
165
62
|
|
|
166
|
-
This design system is production-ready with:
|
|
167
|
-
- **24+ tested components** with comprehensive test coverage
|
|
168
|
-
- **Semantic design tokens** for consistent theming
|
|
169
|
-
- **Accessibility compliance** (WCAG 2.2 AA)
|
|
170
|
-
- **TypeScript support** with full type definitions
|
|
171
|
-
- **Interactive documentation** for easy adoption
|
|
172
|
-
- **Optimized bundle** with tree-shaking support
|
|
173
|
-
|
|
174
|
-
## 🤝 Contributing
|
|
175
|
-
|
|
176
|
-
We welcome contributions! Please follow our established standards:
|
|
177
|
-
|
|
178
|
-
### Quick Start
|
|
179
63
|
```bash
|
|
180
|
-
# Fork and clone
|
|
181
|
-
git clone <your-fork>
|
|
182
|
-
cd common-origin-design-system
|
|
183
64
|
npm install
|
|
184
|
-
|
|
185
|
-
# Start development
|
|
186
|
-
npm run docs:dev # Starts dev server with docs
|
|
187
|
-
npm test # Run tests
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Commit Convention
|
|
191
|
-
We use [Conventional Commits](https://www.conventionalcommits.org/) for automatic changelog generation:
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
feat(Component): add new feature
|
|
195
|
-
fix(Component): fix bug
|
|
196
|
-
docs: update documentation
|
|
197
|
-
chore: bump version to X.Y.Z
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### Release Process
|
|
201
|
-
```bash
|
|
202
|
-
# Automated release (recommended)
|
|
203
|
-
npm run release:create
|
|
204
|
-
|
|
205
|
-
# Manual release - see .github/RELEASE_PROCESS.md
|
|
65
|
+
npm run docs:dev # build tokens, then start the docs site at http://localhost:3000
|
|
206
66
|
```
|
|
207
67
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
68
|
+
| Command | What it does |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `npm run dev` | Docs site dev server |
|
|
71
|
+
| `npm run build` | Build the docs site |
|
|
72
|
+
| `npm run build:tokens` | Compile token sources |
|
|
73
|
+
| `npm run build:package` | Build the package to `dist/` (Rollup) |
|
|
74
|
+
| `npm run verify:package` | After `build:package`: check published types, consumer type-check, publint, attw |
|
|
75
|
+
| `npm test` | Jest, including jest-axe accessibility tests |
|
|
76
|
+
| `npm run typecheck` | `tsc --noEmit` |
|
|
77
|
+
| `npm run lint` | ESLint, with a warnings ratchet: never raise the limit, lower it when you fix warnings |
|
|
78
|
+
| `npm run verify:docs` | Fails if a doc references a missing file, folder or npm script |
|
|
79
|
+
|
|
80
|
+
Before proposing a change: `typecheck`, `lint`, `test`, `build:package` and `verify:package`.
|
|
81
|
+
|
|
82
|
+
## Contributing and releases
|
|
83
|
+
|
|
84
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md): component structure, testing and pull requests
|
|
85
|
+
- [RELEASE.md](RELEASE.md): how releases are made
|
|
86
|
+
- Commits follow [Conventional Commits](https://www.conventionalcommits.org/); the changelog is generated from them.
|