@common-origin/design-system 2.14.0 → 2.16.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.
Files changed (55) hide show
  1. package/README.md +50 -184
  2. package/dist/client.esm.js +975 -610
  3. package/dist/client.esm.js.map +1 -1
  4. package/dist/client.js +978 -609
  5. package/dist/client.js.map +1 -1
  6. package/dist/components/atoms/Badge/Badge.d.ts +2 -0
  7. package/dist/components/atoms/Button/Button.d.ts +13 -1
  8. package/dist/components/atoms/CategoryBadge/CategoryBadge.d.ts +12 -52
  9. package/dist/components/atoms/CategoryBadge/index.d.ts +1 -1
  10. package/dist/components/atoms/CategoryLabel/CategoryLabel.d.ts +69 -0
  11. package/dist/components/atoms/CategoryLabel/index.d.ts +2 -0
  12. package/dist/components/atoms/Chip/BooleanChip.d.ts +6 -1
  13. package/dist/components/atoms/Chip/Chip.d.ts +17 -12
  14. package/dist/components/atoms/Chip/FilterChip.d.ts +10 -24
  15. package/dist/components/atoms/Chip/InputChip.d.ts +27 -0
  16. package/dist/components/atoms/Chip/index.d.ts +1 -0
  17. package/dist/components/atoms/Chip/shared/types.d.ts +15 -1
  18. package/dist/components/atoms/Chip/shared/utils.d.ts +1 -82
  19. package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +4 -0
  20. package/dist/components/atoms/StatusBadge/StatusBadge.d.ts +9 -55
  21. package/dist/components/atoms/StatusBadge/index.d.ts +1 -1
  22. package/dist/components/atoms/StatusLabel/StatusLabel.d.ts +17 -0
  23. package/dist/components/atoms/StatusLabel/StatusLabelBase.d.ts +49 -0
  24. package/dist/components/atoms/StatusLabel/index.d.ts +2 -0
  25. package/dist/components/atoms/Tag/Tag.d.ts +5 -0
  26. package/dist/components/atoms/index.d.ts +2 -0
  27. package/dist/components/layout/GridSystem/GridSystem.d.ts +6 -0
  28. package/dist/components/molecules/Alert/Alert.d.ts +15 -2
  29. package/dist/components/molecules/CardLarge/CardLarge.d.ts +3 -1
  30. package/dist/components/molecules/CardSmall/CardSmall.d.ts +2 -0
  31. package/dist/components/molecules/Dropdown/Dropdown.d.ts +2 -0
  32. package/dist/components/molecules/FeatureBlock/FeatureBlock.d.ts +2 -0
  33. package/dist/components/molecules/InlineAlert/InlineAlert.d.ts +54 -0
  34. package/dist/components/molecules/InlineAlert/index.d.ts +2 -0
  35. package/dist/components/molecules/Modal/Modal.d.ts +6 -2
  36. package/dist/components/molecules/PageTitle/PageTitle.d.ts +13 -0
  37. package/dist/components/molecules/TabBar/TabBar.d.ts +8 -5
  38. package/dist/components/molecules/index.d.ts +1 -0
  39. package/dist/data.esm.js +94 -12
  40. package/dist/data.esm.js.map +1 -1
  41. package/dist/data.js +94 -12
  42. package/dist/data.js.map +1 -1
  43. package/dist/index.esm.js +1 -1
  44. package/dist/index.js +4 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/styles/tokens.json +94 -12
  47. package/dist/tokens/index.esm.js +94 -12
  48. package/dist/tokens/index.esm.js.map +1 -1
  49. package/dist/tokens/index.js +94 -12
  50. package/dist/tokens/index.js.map +1 -1
  51. package/dist/tokens/types/tokens.d.ts +85 -3
  52. package/dist/tokens.css +769 -0
  53. package/dist/tokens.css.d.ts +4 -0
  54. package/dist/types/tokens.d.ts +85 -3
  55. package/package.json +20 -10
package/README.md CHANGED
@@ -1,220 +1,86 @@
1
1
  # Common Origin Design System
2
2
 
3
- A production-ready, **framework-agnostic** design system built with atomic design principles, design tokens, and WCAG 2.2 AA accessibility compliance. This package provides reusable React components and design tokens for building consistent user interfaces.
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
- ## ⚠️ Version 2.0 Breaking Changes
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
- **Version 2.0.0** removes Next.js dependencies, making the design system work in **any React application** (Next.js, Create React App, Vite, etc.).
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
- ### Usage
14
+ Peer dependencies: `react` and `react-dom` 18 or 19, and `styled-components` 6.
22
15
 
23
16
  ```tsx
24
- import { Button, Typography, Stack } from '@common-origin/design-system'
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 App() {
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
- ### Development
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
- ```bash
48
- # Install dependencies
49
- npm install
31
+ Upgrading from v1? See [MIGRATION-V2.md](MIGRATION-V2.md).
50
32
 
51
- # Build design tokens
52
- npm run build:tokens
33
+ ## What's in the package
53
34
 
54
- # Start development server
55
- npm run dev
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
- Visit `http://localhost:3000` to view the interactive component documentation.
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
- ## 📁 Project Structure
42
+ ## Repository layout
61
43
 
62
44
  ```
63
45
  src/
64
- ├── components/ # Complete atomic design system
65
- │ ├── atoms/ # 12 foundational components (Button, Typography, etc.)
66
- │ ├── molecules/ # 8 composed components (Dropdown, CodeBlock, etc.)
67
- │ ├── organisms/ # 3 complex components (Navigation, Footer, etc.)
68
- │ └── layout/ # 1 layout system (GridSystem)
69
- ├── tokens/ # Design token source definitions
70
- ├── styles/ # Generated tokens, CSS, and icon definitions
71
- └── index.ts # Main package exports
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
- ## 🎯 Component Library
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
- **✅ Layout (1 system)**:
162
- - GridSystem
59
+ ## Development
163
60
 
164
- ## � Production Ready
61
+ Requires Node 22 or later to work on the repository: the token build uses Style Dictionary 5. The published package supports 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
- ### Documentation
209
- - **Contributing Guide**: [CONTRIBUTING.md](./CONTRIBUTING.md)
210
- - **Release Process**: [.github/RELEASE_PROCESS.md](./.github/RELEASE_PROCESS.md)
211
- - **Documentation Standards**: [.github/DOCUMENTATION_STANDARDS.md](./.github/DOCUMENTATION_STANDARDS.md)
212
- - **Quick Reference**: [.github/RELEASE_CHEATSHEET.md](./.github/RELEASE_CHEATSHEET.md)
213
-
214
- ### Development Standards
215
- 1. Components follow the atomic design hierarchy
216
- 2. All styling uses design tokens from `src/styles/tokens.json`
217
- 3. Each component includes `.test.tsx`, `.docs.tsx`, and implementation files
218
- 4. Tests must include accessibility validation with jest-axe
219
- 5. Documentation includes live examples and prop descriptions
220
- 6. Use conventional commit messages for all commits
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.