@cere/cere-design-system 0.0.9 → 0.0.13
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/.specify/memory/agent-factory.md +44 -0
- package/.specify/memory/architecture.md +143 -0
- package/.specify/memory/component-architecture.md +73 -0
- package/.specify/memory/components-reference.md +1353 -0
- package/.specify/memory/constitution.md +295 -0
- package/.specify/memory/design-tokens.md +139 -0
- package/.specify/memory/package-usage-guide.md +99 -0
- package/.specify/memory/toolkits.md +57 -0
- package/.specify/memory/workflow.md +87 -0
- package/README.md +197 -3
- package/dist/HumanSans-Black-C4YJONK7.otf +0 -0
- package/dist/HumanSans-Bold-4EAJ3L3T.otf +0 -0
- package/dist/HumanSans-BoldOblique-4D325T4F.otf +0 -0
- package/dist/HumanSans-ExtraLight-VL7DEKQ4.otf +0 -0
- package/dist/HumanSans-ExtraLightOblique-VK2JTUXF.otf +0 -0
- package/dist/HumanSans-Light-YV7AFKRB.otf +0 -0
- package/dist/HumanSans-LightOblique-VIXV7QA6.otf +0 -0
- package/dist/HumanSans-Medium-UULJ3PIR.otf +0 -0
- package/dist/HumanSans-MediumOblique-M7FHDZRS.otf +0 -0
- package/dist/HumanSans-Regular-QMFEP3F6.otf +0 -0
- package/dist/HumanSans-RegularOblique-YPKQJAAM.otf +0 -0
- package/dist/index.css +79 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +242 -94
- package/dist/index.d.ts +242 -94
- package/dist/index.js +3158 -553
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3020 -456
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -4
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Cere Design System Constitution
|
|
2
|
+
|
|
3
|
+
This constitution defines the immutable principles and standards that govern the development of the Cere Design System (@cere/cere-design-system). All components, features, and changes must comply with these articles.
|
|
4
|
+
|
|
5
|
+
## Article I: Material UI Foundation
|
|
6
|
+
|
|
7
|
+
**All components MUST extend Material UI components using `styled()` or `sx` prop patterns.**
|
|
8
|
+
|
|
9
|
+
### Requirements
|
|
10
|
+
- Components must be built on top of Material UI base components
|
|
11
|
+
- Use MUI's `styled()` API from `@mui/material/styles` or the `sx` prop for styling
|
|
12
|
+
- Components must support MUI's theming system and be compatible with `ThemeProvider`
|
|
13
|
+
- Follow MUI's component API conventions (props, variants, sizes, event handlers)
|
|
14
|
+
- Maintain backward compatibility with existing component APIs unless a major version bump is warranted
|
|
15
|
+
|
|
16
|
+
### Rationale
|
|
17
|
+
Material UI provides a battle-tested foundation with accessibility, theming, and responsive design built-in. Extending MUI ensures consistency and reduces maintenance burden.
|
|
18
|
+
|
|
19
|
+
## Article II: Component Modularity
|
|
20
|
+
|
|
21
|
+
**Each component must be self-contained, independently exportable, and follow the established file structure.**
|
|
22
|
+
|
|
23
|
+
### Requirements
|
|
24
|
+
- Each component must reside in its appropriate category folder under `src/components/`:
|
|
25
|
+
- `buttons/`, `inputs/`, `navigation/`, `layout/`, `feedback/`, `charts/`, `third-party/`, `utilities/`
|
|
26
|
+
- Components must export both the component itself and its TypeScript type interfaces
|
|
27
|
+
- All public exports must be registered in `src/index.ts` (both component and type exports)
|
|
28
|
+
- Components must not have tight coupling; prefer composition patterns and prop-based configuration
|
|
29
|
+
- Each component must be independently importable: `import { Button } from '@cere/cere-design-system'`
|
|
30
|
+
|
|
31
|
+
### File Structure
|
|
32
|
+
```
|
|
33
|
+
src/components/[category]/
|
|
34
|
+
├── [ComponentName].tsx # Component implementation
|
|
35
|
+
├── [ComponentName].stories.tsx # Storybook documentation
|
|
36
|
+
└── __tests__/
|
|
37
|
+
└── [ComponentName].test.tsx # Jest tests
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Article III: Testing Standards (NON-NEGOTIABLE)
|
|
41
|
+
|
|
42
|
+
**Every component MUST have comprehensive test coverage before being merged.**
|
|
43
|
+
|
|
44
|
+
### Requirements
|
|
45
|
+
1. **Jest Unit Tests** (in `__tests__/` subdirectory):
|
|
46
|
+
- Target: 80%+ code coverage
|
|
47
|
+
- Test rendering, user interactions, prop variants, callbacks, disabled/error states
|
|
48
|
+
- Use React Testing Library idioms (prefer `getByRole`, `getByLabelText`, user-event)
|
|
49
|
+
- Tests must wrap components with `ThemeProvider` using the design system theme
|
|
50
|
+
|
|
51
|
+
2. **Storybook Stories** (with all variants/states documented):
|
|
52
|
+
- Create stories for all visual variants, sizes, and states
|
|
53
|
+
- Include interaction tests using `play` functions from `@storybook/test`
|
|
54
|
+
- Document props with JSDoc comments that appear in Storybook
|
|
55
|
+
|
|
56
|
+
3. **Accessibility Tests**:
|
|
57
|
+
- Storybook integration with axe-playwright automatically checks accessibility
|
|
58
|
+
- Run via `npm run test:storybook`
|
|
59
|
+
- All interactive components must pass WCAG AA standards
|
|
60
|
+
|
|
61
|
+
### Test Pattern
|
|
62
|
+
```typescript
|
|
63
|
+
import { render, screen } from '@testing-library/react';
|
|
64
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
65
|
+
import { theme } from '@/theme';
|
|
66
|
+
|
|
67
|
+
const renderWithTheme = (component: React.ReactElement) => {
|
|
68
|
+
return render(
|
|
69
|
+
<ThemeProvider theme={theme}>
|
|
70
|
+
{component}
|
|
71
|
+
</ThemeProvider>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Article IV: Type Safety
|
|
77
|
+
|
|
78
|
+
**All components must be written in TypeScript with explicit, strict type definitions.**
|
|
79
|
+
|
|
80
|
+
### Requirements
|
|
81
|
+
- All components must be written in TypeScript (`.tsx` files)
|
|
82
|
+
- Export all prop interfaces with `Props` suffix (e.g., `ButtonProps`, `TextFieldProps`)
|
|
83
|
+
- Use strict TypeScript configuration; avoid `any` types
|
|
84
|
+
- Provide comprehensive JSDoc comments for all public APIs and prop interfaces
|
|
85
|
+
- Type exports must be separate from component exports in `src/index.ts`:
|
|
86
|
+
```typescript
|
|
87
|
+
export { Button } from './components/buttons/Button';
|
|
88
|
+
export type { ButtonProps } from './components/buttons/Button';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Type Definition Pattern
|
|
92
|
+
```typescript
|
|
93
|
+
import type { ButtonProps as MuiButtonProps } from '@mui/material/Button';
|
|
94
|
+
|
|
95
|
+
export interface ButtonProps extends Omit<MuiButtonProps, 'variant'> {
|
|
96
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
97
|
+
// Custom props with JSDoc
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Article V: Build System Integrity
|
|
102
|
+
|
|
103
|
+
**The package build system must produce optimized, tree-shakeable outputs with proper peer dependencies.**
|
|
104
|
+
|
|
105
|
+
### Requirements
|
|
106
|
+
- Package builds via `tsup` producing:
|
|
107
|
+
- CommonJS format (`dist/index.js`)
|
|
108
|
+
- ESM format (`dist/index.mjs`)
|
|
109
|
+
- TypeScript declarations (`dist/index.d.ts`)
|
|
110
|
+
- All React, MUI, Monaco, and ReactFlow packages must be peer dependencies (not bundled)
|
|
111
|
+
- No new dependencies without evaluating if they should be peer dependencies
|
|
112
|
+
- Entry point is `src/index.ts` - all public APIs must export through this single file
|
|
113
|
+
- Build must complete without errors: `npm run build`
|
|
114
|
+
- Type checking must pass: `npm run type-check`
|
|
115
|
+
- Linting must pass: `npm run lint`
|
|
116
|
+
|
|
117
|
+
### Peer Dependencies
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"peerDependencies": {
|
|
121
|
+
"react": "^18.0.0",
|
|
122
|
+
"react-dom": "^18.0.0",
|
|
123
|
+
"@mui/material": "^5.0.0",
|
|
124
|
+
"@emotion/react": "^11.0.0",
|
|
125
|
+
"@emotion/styled": "^11.0.0"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Article VI: Documentation Requirements
|
|
131
|
+
|
|
132
|
+
**Every component must have comprehensive, up-to-date documentation.**
|
|
133
|
+
|
|
134
|
+
### Requirements
|
|
135
|
+
1. **Storybook Documentation**:
|
|
136
|
+
- Every component must have a `.stories.tsx` file
|
|
137
|
+
- Stories must demonstrate all variants, sizes, and states
|
|
138
|
+
- Include interactive examples and code snippets
|
|
139
|
+
|
|
140
|
+
2. **Component Reference**:
|
|
141
|
+
- Keep `.specify/memory/components-reference.md` synchronized with all component changes
|
|
142
|
+
- Document all props, usage examples, and best practices
|
|
143
|
+
- Update after every component addition or API change
|
|
144
|
+
|
|
145
|
+
3. **Type Documentation**:
|
|
146
|
+
- Add JSDoc comments to all exported interfaces and components
|
|
147
|
+
- Document prop purposes, default values, and constraints
|
|
148
|
+
|
|
149
|
+
4. **Versioning**:
|
|
150
|
+
- Breaking changes require version updates following semver (MAJOR.MINOR.PATCH)
|
|
151
|
+
- Maintain a changelog documenting all changes
|
|
152
|
+
|
|
153
|
+
## Article VII: Design Consistency
|
|
154
|
+
|
|
155
|
+
**All components must follow the design tokens defined in the theme.**
|
|
156
|
+
|
|
157
|
+
### Design Tokens (Defined in `src/theme/index.ts`)
|
|
158
|
+
- **Primary color**: `#1976d2` (blue)
|
|
159
|
+
- **Border radius**:
|
|
160
|
+
- Inputs/buttons: `12px`
|
|
161
|
+
- Cards/chips: `16px`
|
|
162
|
+
- **Typography**: Inter font family
|
|
163
|
+
- **Component variants**: primary, secondary, tertiary (where applicable)
|
|
164
|
+
- **Spacing**: Use theme's spacing system (`theme.spacing(n)` where n is a multiple of 8px)
|
|
165
|
+
|
|
166
|
+
### Requirements
|
|
167
|
+
- Components must reference theme tokens, not hardcoded values
|
|
168
|
+
- Use `useTheme()` hook or `colors` import for accessing theme values
|
|
169
|
+
- Maintain visual consistency across the design system
|
|
170
|
+
- Responsive design using MUI Grid system or custom responsive hooks
|
|
171
|
+
|
|
172
|
+
### Theme Usage Pattern
|
|
173
|
+
```typescript
|
|
174
|
+
import { useTheme } from '@mui/material/styles';
|
|
175
|
+
import { colors } from '@cere/cere-design-system';
|
|
176
|
+
|
|
177
|
+
const theme = useTheme();
|
|
178
|
+
// Use: theme.palette.primary.main
|
|
179
|
+
// Use: colors.primary.main
|
|
180
|
+
// Use: theme.spacing(2) // 16px
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Article VIII: Accessibility First
|
|
184
|
+
|
|
185
|
+
**All interactive components must be fully accessible to keyboard and assistive technology users.**
|
|
186
|
+
|
|
187
|
+
### Requirements
|
|
188
|
+
- All interactive components must be keyboard navigable (Tab, Enter, Space, Arrow keys)
|
|
189
|
+
- Provide proper ARIA labels, roles, and live regions
|
|
190
|
+
- Ensure color contrast meets WCAG AA standards (4.5:1 for normal text, 3:1 for large text)
|
|
191
|
+
- Support screen readers and assistive technologies
|
|
192
|
+
- Test with Storybook's axe-playwright integration
|
|
193
|
+
- Focus management for dialogs, drawers, and modals
|
|
194
|
+
|
|
195
|
+
### Accessibility Checklist
|
|
196
|
+
- [ ] Keyboard navigation works correctly
|
|
197
|
+
- [ ] ARIA attributes are present and accurate
|
|
198
|
+
- [ ] Color contrast passes WCAG AA
|
|
199
|
+
- [ ] Screen reader announces changes appropriately
|
|
200
|
+
- [ ] Focus indicators are visible
|
|
201
|
+
- [ ] No keyboard traps
|
|
202
|
+
|
|
203
|
+
## Article IX: Third-Party Integration
|
|
204
|
+
|
|
205
|
+
**Third-party component wrappers must provide typed interfaces and maintain clear boundaries.**
|
|
206
|
+
|
|
207
|
+
### Requirements
|
|
208
|
+
For wrappers around third-party libraries (e.g., FlowEditor wrapping ReactFlow, CodeEditor wrapping Monaco):
|
|
209
|
+
|
|
210
|
+
1. **Type Safety**:
|
|
211
|
+
- Provide typed interfaces aligned with the underlying library
|
|
212
|
+
- Re-export commonly used types from the third-party library
|
|
213
|
+
- Make wrapper-specific props clearly distinct from pass-through props
|
|
214
|
+
|
|
215
|
+
2. **Theme Integration**:
|
|
216
|
+
- Include theme integration where applicable
|
|
217
|
+
- Respect design system colors, typography, and spacing
|
|
218
|
+
|
|
219
|
+
3. **Documentation**:
|
|
220
|
+
- Maintain clear documentation of wrapper-specific vs. pass-through props
|
|
221
|
+
- Document which third-party features are exposed vs. hidden
|
|
222
|
+
- Provide migration guides if wrapper APIs change
|
|
223
|
+
|
|
224
|
+
4. **Peer Dependencies**:
|
|
225
|
+
- Third-party libraries must be peer dependencies
|
|
226
|
+
- Document minimum required versions
|
|
227
|
+
|
|
228
|
+
### Example: FlowEditor
|
|
229
|
+
```typescript
|
|
230
|
+
import type { Node, Edge, ReactFlowInstance } from 'reactflow';
|
|
231
|
+
|
|
232
|
+
export interface FlowEditorProps {
|
|
233
|
+
nodes: Node[]; // From reactflow
|
|
234
|
+
edges: Edge[]; // From reactflow
|
|
235
|
+
height?: string; // Wrapper-specific
|
|
236
|
+
showBackground?: boolean; // Wrapper-specific
|
|
237
|
+
// ... other props
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Re-export common types
|
|
241
|
+
export type { Node, Edge, NodeTypes, EdgeTypes, ReactFlowInstance } from 'reactflow';
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Development Workflow
|
|
245
|
+
|
|
246
|
+
### Component Development Process
|
|
247
|
+
1. **Specification**: Create a feature spec using `/speckit.specify`
|
|
248
|
+
2. **Planning**: Generate implementation plan using `/speckit.plan`
|
|
249
|
+
3. **Task Breakdown**: Create task checklist using `/speckit.tasks`
|
|
250
|
+
4. **Implementation**: Follow the tasks, adhering to all articles above
|
|
251
|
+
5. **Validation**: Run all checks before PR:
|
|
252
|
+
```bash
|
|
253
|
+
npm run type-check && npm run lint && npm run test && npm run build && npm run test:storybook
|
|
254
|
+
```
|
|
255
|
+
6. **Review**: Code review must verify constitutional compliance
|
|
256
|
+
7. **Documentation**: Update `components-reference.md` before merging
|
|
257
|
+
|
|
258
|
+
### Quality Gates
|
|
259
|
+
All PRs must pass:
|
|
260
|
+
- ✅ TypeScript compilation
|
|
261
|
+
- ✅ ESLint checks
|
|
262
|
+
- ✅ Jest tests (80%+ coverage)
|
|
263
|
+
- ✅ Build succeeds
|
|
264
|
+
- ✅ Storybook accessibility tests
|
|
265
|
+
- ✅ Component reference updated
|
|
266
|
+
- ✅ Constitutional compliance verified
|
|
267
|
+
|
|
268
|
+
## Governance
|
|
269
|
+
|
|
270
|
+
### Constitutional Supremacy
|
|
271
|
+
- This constitution supersedes all other development practices and guidelines
|
|
272
|
+
- When in conflict, the constitution takes precedence
|
|
273
|
+
- All code reviews must verify compliance with these articles
|
|
274
|
+
|
|
275
|
+
### Amendments
|
|
276
|
+
- Constitutional amendments require:
|
|
277
|
+
1. Documented rationale for the change
|
|
278
|
+
2. Team approval/consensus
|
|
279
|
+
3. Migration plan for existing components if needed
|
|
280
|
+
4. Version update in this document
|
|
281
|
+
|
|
282
|
+
### Non-Negotiable Articles
|
|
283
|
+
- **Article III (Testing Standards)**: Cannot be waived or reduced
|
|
284
|
+
- **Article VIII (Accessibility First)**: Cannot be compromised
|
|
285
|
+
|
|
286
|
+
### Guidance Documents
|
|
287
|
+
For detailed development patterns and examples, consult:
|
|
288
|
+
- `.specify/memory/architecture.md` - Component architecture patterns
|
|
289
|
+
- `.specify/memory/design-tokens.md` - Complete design token reference
|
|
290
|
+
- `.specify/memory/workflow.md` - Step-by-step development workflow
|
|
291
|
+
- `.specify/memory/components-reference.md` - Complete component API documentation
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
**Version**: 1.0.0 | **Ratified**: 2026-02-03 | **Last Amended**: 2026-02-03
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Cere Design System - Design Tokens
|
|
2
|
+
|
|
3
|
+
## Color Palette
|
|
4
|
+
|
|
5
|
+
### Primary Colors
|
|
6
|
+
- Primary Main: `#1976d2` (blue)
|
|
7
|
+
- Primary Light: `#42a5f5`
|
|
8
|
+
- Primary Dark: `#1565c0`
|
|
9
|
+
- Primary Contrast Text: `#ffffff`
|
|
10
|
+
|
|
11
|
+
### Secondary Colors
|
|
12
|
+
- Secondary Main: `#dc004e`
|
|
13
|
+
- Secondary Light: `#f50057`
|
|
14
|
+
- Secondary Dark: `#9a0036`
|
|
15
|
+
- Secondary Contrast Text: `#ffffff`
|
|
16
|
+
|
|
17
|
+
### Tertiary Colors
|
|
18
|
+
- Tertiary Main: `#ff9800` (orange/amber)
|
|
19
|
+
|
|
20
|
+
### Semantic Colors
|
|
21
|
+
- Error: `#f44336`
|
|
22
|
+
- Warning: `#ff9800`
|
|
23
|
+
- Info: `#2196f3`
|
|
24
|
+
- Success: `#4caf50`
|
|
25
|
+
|
|
26
|
+
### Grey Scale
|
|
27
|
+
- Grey 50: `#fafafa`
|
|
28
|
+
- Grey 100: `#f5f5f5`
|
|
29
|
+
- Grey 200: `#eeeeee`
|
|
30
|
+
- Grey 300: `#e0e0e0`
|
|
31
|
+
- Grey 400: `#bdbdbd`
|
|
32
|
+
- Grey 500: `#9e9e9e`
|
|
33
|
+
- Grey 600: `#757575`
|
|
34
|
+
- Grey 700: `#616161`
|
|
35
|
+
- Grey 800: `#424242`
|
|
36
|
+
- Grey 900: `#212121`
|
|
37
|
+
|
|
38
|
+
### Background
|
|
39
|
+
- Default: `#fafafa`
|
|
40
|
+
- Paper: `#ffffff`
|
|
41
|
+
- Selected: `rgba(25, 118, 210, 0.08)`
|
|
42
|
+
|
|
43
|
+
### Text
|
|
44
|
+
- Primary: `rgba(0, 0, 0, 0.87)`
|
|
45
|
+
- Secondary: `rgba(0, 0, 0, 0.6)`
|
|
46
|
+
- Disabled: `rgba(0, 0, 0, 0.38)`
|
|
47
|
+
|
|
48
|
+
## Typography
|
|
49
|
+
|
|
50
|
+
### Font Family
|
|
51
|
+
- Primary: `'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif`
|
|
52
|
+
|
|
53
|
+
### Font Weights
|
|
54
|
+
- Light: 300
|
|
55
|
+
- Regular: 400
|
|
56
|
+
- Medium: 500
|
|
57
|
+
- Semi-Bold: 600
|
|
58
|
+
- Bold: 700
|
|
59
|
+
|
|
60
|
+
### Type Scale
|
|
61
|
+
- h1: 2.5rem (40px), weight: 700
|
|
62
|
+
- h2: 2rem (32px), weight: 700
|
|
63
|
+
- h3: 1.75rem (28px), weight: 600
|
|
64
|
+
- h4: 1.5rem (24px), weight: 600
|
|
65
|
+
- h5: 1.25rem (20px), weight: 600
|
|
66
|
+
- h6: 1rem (16px), weight: 600
|
|
67
|
+
- subtitle1: 1rem (16px), weight: 500
|
|
68
|
+
- subtitle2: 0.875rem (14px), weight: 500
|
|
69
|
+
- body1: 1rem (16px), weight: 400
|
|
70
|
+
- body2: 0.875rem (14px), weight: 400
|
|
71
|
+
- caption: 0.75rem (12px), weight: 400
|
|
72
|
+
- button: 0.875rem (14px), weight: 500, uppercase
|
|
73
|
+
- overline: 0.625rem (10px), weight: 400, uppercase
|
|
74
|
+
|
|
75
|
+
## Spacing System
|
|
76
|
+
Based on 8px scale:
|
|
77
|
+
- 0: 0px
|
|
78
|
+
- 1: 8px
|
|
79
|
+
- 2: 16px
|
|
80
|
+
- 3: 24px
|
|
81
|
+
- 4: 32px
|
|
82
|
+
- 5: 40px
|
|
83
|
+
- 6: 48px
|
|
84
|
+
- 7: 56px
|
|
85
|
+
- 8: 64px
|
|
86
|
+
- 9: 72px
|
|
87
|
+
- 10: 80px
|
|
88
|
+
|
|
89
|
+
## Border Radius
|
|
90
|
+
- Small (inputs, buttons): 12px
|
|
91
|
+
- Medium (cards, chips): 16px
|
|
92
|
+
- Large: 24px
|
|
93
|
+
- Circle: 50%
|
|
94
|
+
|
|
95
|
+
## Elevation (Shadows)
|
|
96
|
+
Follows Material Design elevation levels:
|
|
97
|
+
- Level 0: none
|
|
98
|
+
- Level 1: `0px 2px 4px rgba(0,0,0,0.1)`
|
|
99
|
+
- Level 2: `0px 4px 8px rgba(0,0,0,0.1)`
|
|
100
|
+
- Level 3: `0px 6px 12px rgba(0,0,0,0.1)`
|
|
101
|
+
- Level 24: Maximum elevation
|
|
102
|
+
|
|
103
|
+
## Breakpoints
|
|
104
|
+
- xs: 0px (mobile)
|
|
105
|
+
- sm: 600px (tablet)
|
|
106
|
+
- md: 960px (desktop)
|
|
107
|
+
- lg: 1280px (large desktop)
|
|
108
|
+
- xl: 1920px (extra large)
|
|
109
|
+
|
|
110
|
+
## Custom Breakpoint Hooks
|
|
111
|
+
- `useIsMobile()`: < 768px
|
|
112
|
+
- `useIsTablet()`: 768px - 1024px
|
|
113
|
+
- `useIsDesktop()`: > 1024px
|
|
114
|
+
|
|
115
|
+
## Transitions
|
|
116
|
+
- Duration: 300ms (standard)
|
|
117
|
+
- Easing: cubic-bezier(0.4, 0, 0.2, 1)
|
|
118
|
+
|
|
119
|
+
## Z-Index Scale
|
|
120
|
+
- Drawer: 1200
|
|
121
|
+
- AppBar: 1100
|
|
122
|
+
- Modal: 1300
|
|
123
|
+
- Snackbar: 1400
|
|
124
|
+
- Tooltip: 1500
|
|
125
|
+
|
|
126
|
+
## Implementation
|
|
127
|
+
All tokens are defined in `src/theme/index.ts` using MUI's `createTheme()`.
|
|
128
|
+
Components should reference theme tokens, not hardcoded values.
|
|
129
|
+
|
|
130
|
+
Example:
|
|
131
|
+
```typescript
|
|
132
|
+
import { useTheme } from '@mui/material';
|
|
133
|
+
import { colors } from '@cere/cere-design-system';
|
|
134
|
+
|
|
135
|
+
const theme = useTheme();
|
|
136
|
+
// Use: theme.palette.primary.main
|
|
137
|
+
// Use: colors.primary.main
|
|
138
|
+
// Use: theme.spacing(2) // 16px
|
|
139
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Using Cere Design System in Your Application's Spec Kit
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This guide shows how to reference and use the Cere Design System (@cere/cere-design-system) in your application's Spec-Driven Development workflow.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
```bash
|
|
8
|
+
npm install @cere/cere-design-system
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Referencing in Your Application's Specs
|
|
12
|
+
|
|
13
|
+
### Method 1: Direct Reference in Constitution
|
|
14
|
+
In your application's `.specify/memory/constitution.md`, add an article requiring the design system:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
# Application Constitution
|
|
18
|
+
|
|
19
|
+
## Article: UI Component Standards
|
|
20
|
+
|
|
21
|
+
### Design System Requirement
|
|
22
|
+
All UI components MUST use the Cere Design System (@cere/cere-design-system).
|
|
23
|
+
|
|
24
|
+
### Component Reference
|
|
25
|
+
Available components and their APIs are documented at:
|
|
26
|
+
`node_modules/@cere/cere-design-system/.specify/memory/components-reference.md`
|
|
27
|
+
|
|
28
|
+
All developers and AI agents MUST consult this reference before implementing UI features.
|
|
29
|
+
|
|
30
|
+
### Usage Requirements
|
|
31
|
+
1. Always wrap application with ThemeProvider:
|
|
32
|
+
```tsx
|
|
33
|
+
import { ThemeProvider, theme } from '@cere/cere-design-system';
|
|
34
|
+
|
|
35
|
+
<ThemeProvider theme={theme}>
|
|
36
|
+
<App />
|
|
37
|
+
</ThemeProvider>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. Import components from the package:
|
|
41
|
+
```tsx
|
|
42
|
+
import { Button, TextField, Card } from '@cere/cere-design-system';
|
|
43
|
+
import type { ButtonProps } from '@cere/cere-design-system';
|
|
44
|
+
```
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Method 2: Create Design System Memory Reference
|
|
48
|
+
Create `.specify/memory/design-system.md` in your application:
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# Cere Design System Reference
|
|
52
|
+
|
|
53
|
+
This application uses @cere/cere-design-system
|
|
54
|
+
|
|
55
|
+
## Quick Reference
|
|
56
|
+
See complete component reference:
|
|
57
|
+
`node_modules/@cere/cere-design-system/.specify/memory/components-reference.md`
|
|
58
|
+
|
|
59
|
+
## Example Usage
|
|
60
|
+
```tsx
|
|
61
|
+
import { Card, TextField, LoadingButton, Alert } from '@cere/cere-design-system';
|
|
62
|
+
|
|
63
|
+
<Card>
|
|
64
|
+
<CardContent>
|
|
65
|
+
<Stack spacing={2}>
|
|
66
|
+
<TextField label="Email" />
|
|
67
|
+
<LoadingButton variant="primary">Submit</LoadingButton>
|
|
68
|
+
</Stack>
|
|
69
|
+
</CardContent>
|
|
70
|
+
</Card>
|
|
71
|
+
```
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## AI Agent Instructions
|
|
75
|
+
|
|
76
|
+
When AI agents work on specs that use the Cere Design System:
|
|
77
|
+
|
|
78
|
+
### 1. Always Reference Component Documentation
|
|
79
|
+
Before suggesting code, agents should reference:
|
|
80
|
+
`node_modules/@cere/cere-design-system/.specify/memory/components-reference.md`
|
|
81
|
+
|
|
82
|
+
### 2. Follow Design System Patterns
|
|
83
|
+
- Use ThemeProvider wrapper
|
|
84
|
+
- Import components from package root
|
|
85
|
+
- Use design system colors/theme tokens
|
|
86
|
+
|
|
87
|
+
### 3. Type Safety
|
|
88
|
+
Always import TypeScript types:
|
|
89
|
+
```tsx
|
|
90
|
+
import type { ButtonProps, TextFieldProps } from '@cere/cere-design-system';
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Best Practices Summary
|
|
94
|
+
|
|
95
|
+
1. ✅ **Always reference** `components-reference.md` before using components
|
|
96
|
+
2. ✅ **Import types** for TypeScript safety
|
|
97
|
+
3. ✅ **Use ThemeProvider** at application root
|
|
98
|
+
4. ✅ **Follow design system patterns** for consistency
|
|
99
|
+
5. ✅ **Include design system requirements** in feature specs
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# AI Coding Agent Toolkits for Material UI Design Systems
|
|
2
|
+
|
|
3
|
+
## Supported Toolkits
|
|
4
|
+
|
|
5
|
+
### 1. Material UI Component Generator (Primary)
|
|
6
|
+
**Specialization:** MUI-based React component development
|
|
7
|
+
**Use Cases:** Creating new components, extending MUI components
|
|
8
|
+
**Configuration:**
|
|
9
|
+
- Base library: @mui/material
|
|
10
|
+
- Styling approach: styled-components + emotion
|
|
11
|
+
- Theme system: MUI theming
|
|
12
|
+
|
|
13
|
+
### 2. Storybook Documentation Toolkit
|
|
14
|
+
**Specialization:** Component documentation and interaction testing
|
|
15
|
+
**Use Cases:** Creating stories, play functions, a11y tests
|
|
16
|
+
**Configuration:**
|
|
17
|
+
- Framework: Storybook 7+
|
|
18
|
+
- Testing: @storybook/test, axe-playwright
|
|
19
|
+
|
|
20
|
+
### 3. Jest Testing Toolkit
|
|
21
|
+
**Specialization:** Unit and integration testing
|
|
22
|
+
**Use Cases:** Writing tests, achieving coverage targets
|
|
23
|
+
**Configuration:**
|
|
24
|
+
- Framework: Jest + React Testing Library
|
|
25
|
+
- Coverage target: 80%+
|
|
26
|
+
- Setup: src/setupTests.ts
|
|
27
|
+
|
|
28
|
+
### 4. TypeScript Type System Toolkit
|
|
29
|
+
**Specialization:** Type definitions and interfaces
|
|
30
|
+
**Use Cases:** Creating types, ensuring type safety
|
|
31
|
+
**Configuration:**
|
|
32
|
+
- Strict mode: enabled
|
|
33
|
+
- Export pattern: ComponentProps interfaces
|
|
34
|
+
|
|
35
|
+
## Toolkit Selection Strategy
|
|
36
|
+
Based on the feature type, select appropriate toolkit(s):
|
|
37
|
+
|
|
38
|
+
| Feature Type | Primary Toolkit | Secondary Toolkits |
|
|
39
|
+
|--------------|----------------|---------------------|
|
|
40
|
+
| New Component | MUI Component Generator | Storybook, Jest, TypeScript |
|
|
41
|
+
| Component Enhancement | MUI Component Generator | Jest, TypeScript |
|
|
42
|
+
| Documentation | Storybook | - |
|
|
43
|
+
| Testing | Jest | - |
|
|
44
|
+
| Type Updates | TypeScript | - |
|
|
45
|
+
| Integration | All | - |
|
|
46
|
+
|
|
47
|
+
## Dynamic Loading
|
|
48
|
+
Toolkits can be referenced in specs using:
|
|
49
|
+
```yaml
|
|
50
|
+
required_toolkits:
|
|
51
|
+
- mui-component-generator
|
|
52
|
+
- storybook-docs
|
|
53
|
+
- jest-testing
|
|
54
|
+
- typescript-types
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The AI agent should activate appropriate context and specialized knowledge for each toolkit.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Spec-Driven Development Workflow for Cere Design System
|
|
2
|
+
|
|
3
|
+
## Workflow Phases
|
|
4
|
+
|
|
5
|
+
### 1. Constitution (One-time Setup)
|
|
6
|
+
Run once when starting spec-driven development:
|
|
7
|
+
```bash
|
|
8
|
+
/speckit.constitution
|
|
9
|
+
```
|
|
10
|
+
Review and customize the constitution to match team principles.
|
|
11
|
+
|
|
12
|
+
### 2. Specify (Feature Definition)
|
|
13
|
+
For each new component or feature:
|
|
14
|
+
```bash
|
|
15
|
+
/speckit.specify Create a [ComponentName] component that...
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This creates:
|
|
19
|
+
- New git branch: `001-component-name`
|
|
20
|
+
- Spec file: `specs/001-component-name/spec.md`
|
|
21
|
+
- Populates spec from template with feature details
|
|
22
|
+
|
|
23
|
+
**Review the spec:**
|
|
24
|
+
- Verify component category
|
|
25
|
+
- Confirm Material UI base component
|
|
26
|
+
- Review props interface
|
|
27
|
+
- Validate accessibility requirements
|
|
28
|
+
|
|
29
|
+
### 3. Plan (Technical Design)
|
|
30
|
+
After spec is approved:
|
|
31
|
+
```bash
|
|
32
|
+
/speckit.plan
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This creates:
|
|
36
|
+
- Plan file: `specs/001-component-name/plan.md`
|
|
37
|
+
- Technical implementation details
|
|
38
|
+
- Phase-by-phase breakdown
|
|
39
|
+
|
|
40
|
+
### 4. Tasks (Implementation Breakdown)
|
|
41
|
+
After plan is approved:
|
|
42
|
+
```bash
|
|
43
|
+
/speckit.tasks
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This creates:
|
|
47
|
+
- Tasks file: `specs/001-component-name/tasks.md`
|
|
48
|
+
- Granular checklist of implementation steps
|
|
49
|
+
|
|
50
|
+
### 5. Implement (Execution)
|
|
51
|
+
Work through tasks systematically:
|
|
52
|
+
|
|
53
|
+
**Setup Phase:**
|
|
54
|
+
- Create component file
|
|
55
|
+
- Create test file
|
|
56
|
+
- Create story file
|
|
57
|
+
|
|
58
|
+
**Implementation Phase:**
|
|
59
|
+
- Define TypeScript interfaces
|
|
60
|
+
- Implement component logic
|
|
61
|
+
- Add theme integration
|
|
62
|
+
|
|
63
|
+
**Testing Phase:**
|
|
64
|
+
- Write unit tests
|
|
65
|
+
- Create Storybook stories
|
|
66
|
+
- Run accessibility checks
|
|
67
|
+
|
|
68
|
+
**Validation Phase:**
|
|
69
|
+
```bash
|
|
70
|
+
npm run type-check && npm run lint && npm test && npm run build && npm run test:storybook
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 6. Review (Quality Assurance)
|
|
74
|
+
- Code review on PR
|
|
75
|
+
- Visual design review in Storybook
|
|
76
|
+
- Accessibility audit results
|
|
77
|
+
|
|
78
|
+
### 7. Merge & Document
|
|
79
|
+
- Merge feature branch to main
|
|
80
|
+
- Update package version if needed
|
|
81
|
+
- Update changelog
|
|
82
|
+
|
|
83
|
+
## Best Practices
|
|
84
|
+
1. Always start with a spec - don't code directly
|
|
85
|
+
2. One component per spec/branch
|
|
86
|
+
3. Keep specs focused and atomic
|
|
87
|
+
4. Update components-reference.md after merging
|