@cere/cere-design-system 0.0.9 → 0.0.11
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/.agent/README.md +154 -0
- package/.agent/rules/AGENTS.md +145 -0
- package/.agent/rules/COMPONENTS.md +1351 -0
- package/.agent/rules/guidelines.md +111 -0
- package/README.md +33 -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
package/.agent/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Cere Design System - AI Agent Context
|
|
2
|
+
|
|
3
|
+
This folder contains documentation and context optimized for AI agents to effectively work with the Cere Design System.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
### `rules/COMPONENTS.md`
|
|
8
|
+
**Comprehensive component reference** for AI agents building applications with the Cere Design System.
|
|
9
|
+
|
|
10
|
+
This file provides:
|
|
11
|
+
- Complete listing of all 70+ available components
|
|
12
|
+
- Detailed props and usage examples for each component
|
|
13
|
+
- TypeScript type information
|
|
14
|
+
- Theme and styling guidelines
|
|
15
|
+
- Best practices and common patterns
|
|
16
|
+
- Installation and setup instructions
|
|
17
|
+
|
|
18
|
+
**Use Case:** Feed this document to AI agents (like Claude, GPT-4, etc.) as context when building React applications. The agent will have immediate access to all component APIs, props, and usage patterns without needing to search documentation or source code.
|
|
19
|
+
|
|
20
|
+
### `rules/AGENTS.md`
|
|
21
|
+
Development guidelines and architecture documentation for AI agents working on the design system codebase itself.
|
|
22
|
+
|
|
23
|
+
### `rules/guidelines.md`
|
|
24
|
+
General coding guidelines and conventions.
|
|
25
|
+
|
|
26
|
+
## Usage Examples
|
|
27
|
+
|
|
28
|
+
### For Building Applications
|
|
29
|
+
|
|
30
|
+
When using an AI agent to build a React application with the Cere Design System:
|
|
31
|
+
|
|
32
|
+
1. **Include the context**: Upload or paste `rules/COMPONENTS.md` into your AI conversation
|
|
33
|
+
2. **Reference components**: Ask the agent to build UI using specific components from the design system
|
|
34
|
+
3. **Get accurate code**: The agent will generate TypeScript/React code with correct imports, props, and patterns
|
|
35
|
+
|
|
36
|
+
Example prompts:
|
|
37
|
+
```
|
|
38
|
+
"Build a login form using TextField, LoadingButton, and Alert components"
|
|
39
|
+
"Create a dashboard with Grid, Card, ChartWidget, and MetricsChart"
|
|
40
|
+
"Implement a data table with pagination using Table and Pagination components"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Injecting Context into Project Prompts
|
|
44
|
+
|
|
45
|
+
You can provide the component reference to AI agents in several ways:
|
|
46
|
+
|
|
47
|
+
**Method 1: Direct File Reference (Recommended)**
|
|
48
|
+
```bash
|
|
49
|
+
# After installing the package, reference the file directly
|
|
50
|
+
cat node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Then paste the output into your AI conversation or include it in your project's AI configuration.
|
|
54
|
+
|
|
55
|
+
**Method 2: Project .cursorrules or .agent Files**
|
|
56
|
+
|
|
57
|
+
Create a rule file in your project root that references the design system components:
|
|
58
|
+
|
|
59
|
+
`.cursorrules` or `.agent/rules/design-system.md`:
|
|
60
|
+
```markdown
|
|
61
|
+
# Design System Components
|
|
62
|
+
|
|
63
|
+
When building UI components, use the Cere Design System.
|
|
64
|
+
|
|
65
|
+
Available components reference:
|
|
66
|
+
|
|
67
|
+
{PASTE CONTENTS OF node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md HERE}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Method 3: Dynamic Import Script**
|
|
71
|
+
|
|
72
|
+
Create a script to automatically inject the context:
|
|
73
|
+
|
|
74
|
+
`scripts/inject-design-system-context.sh`:
|
|
75
|
+
```bash
|
|
76
|
+
#!/bin/bash
|
|
77
|
+
# Inject Cere Design System component reference into project AI context
|
|
78
|
+
|
|
79
|
+
COMPONENTS_FILE="node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md"
|
|
80
|
+
OUTPUT_FILE=".agent/rules/cere-components.md"
|
|
81
|
+
|
|
82
|
+
if [ -f "$COMPONENTS_FILE" ]; then
|
|
83
|
+
echo "Copying Cere Design System component reference..."
|
|
84
|
+
mkdir -p .agent/rules
|
|
85
|
+
cp "$COMPONENTS_FILE" "$OUTPUT_FILE"
|
|
86
|
+
echo "✓ Component reference available at $OUTPUT_FILE"
|
|
87
|
+
else
|
|
88
|
+
echo "Error: Design system not found. Run 'npm install' first."
|
|
89
|
+
exit 1
|
|
90
|
+
fi
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Make it executable and run after installation:
|
|
94
|
+
```bash
|
|
95
|
+
chmod +x scripts/inject-design-system-context.sh
|
|
96
|
+
npm install && ./scripts/inject-design-system-context.sh
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Method 4: Package.json Postinstall Hook**
|
|
100
|
+
|
|
101
|
+
Automatically copy the component reference after package installation:
|
|
102
|
+
|
|
103
|
+
`package.json`:
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"scripts": {
|
|
107
|
+
"postinstall": "mkdir -p .agent/rules && cp node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md .agent/rules/cere-components.md || true"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Method 5: AI Tool Configuration**
|
|
113
|
+
|
|
114
|
+
For tools like Cursor, Cline, or Windsurf, add to your configuration:
|
|
115
|
+
|
|
116
|
+
`.cursor/rules` or `.windsurfrules`:
|
|
117
|
+
```
|
|
118
|
+
When building React components, always use components from @cere/cere-design-system.
|
|
119
|
+
Refer to the complete component API documentation at:
|
|
120
|
+
node_modules/@cere/cere-design-system/.agent/rules/COMPONENTS.md
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### For Package Installation
|
|
124
|
+
|
|
125
|
+
After installing the package:
|
|
126
|
+
```bash
|
|
127
|
+
npm install @cere/cere-design-system
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The `.agent` folder will be available at:
|
|
131
|
+
```
|
|
132
|
+
node_modules/@cere/cere-design-system/.agent/
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
You can reference it in AI agent contexts or documentation tools.
|
|
136
|
+
|
|
137
|
+
## Benefits
|
|
138
|
+
|
|
139
|
+
- **Faster Development**: AI agents have immediate access to all component APIs
|
|
140
|
+
- **Consistency**: Ensures AI-generated code follows design system patterns
|
|
141
|
+
- **Type Safety**: All TypeScript types and interfaces are documented
|
|
142
|
+
- **Best Practices**: Common patterns and usage guidelines included
|
|
143
|
+
- **Complete Reference**: No need to browse Storybook or source code during AI-assisted development
|
|
144
|
+
|
|
145
|
+
## Updating
|
|
146
|
+
|
|
147
|
+
This documentation is maintained alongside the component source code. When components are added or updated, the `COMPONENTS.md` file should be updated to reflect the changes.
|
|
148
|
+
|
|
149
|
+
## Package Information
|
|
150
|
+
|
|
151
|
+
- **Package**: `@cere/cere-design-system`
|
|
152
|
+
- **Version**: 0.0.10
|
|
153
|
+
- **Repository**: https://github.com/cere-io/cere-design-system
|
|
154
|
+
- **License**: MIT
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to WARP (warp.dev) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is a React-based design system library built with Material UI and TypeScript. It's distributed as an npm package (@cere/cere-design-system) containing 40+ reusable UI components organized into categories: buttons, inputs, navigation, layout, and feedback components. The library also includes third-party integrations for ReactFlow (FlowEditor) and Monaco Editor (CodeEditor).
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
### Component Structure
|
|
12
|
+
- All components are in `src/components/` organized by category:
|
|
13
|
+
- `buttons/` - Button, IconButton, LoadingButton, ButtonGroup
|
|
14
|
+
- `inputs/` - TextField, SearchField, Dropdown, Switch, Checkbox, Radio, ToggleButton
|
|
15
|
+
- `navigation/` - Sidebar, Tab, Menu, Pagination, Selector, Stepper
|
|
16
|
+
- `layout/` - Dialog, Drawer, Card, List, Avatar, Table, Grid, AppBar, Paper, etc.
|
|
17
|
+
- `feedback/` - Badge, Chip, Tooltip, Progress, Alert, EmptyState, Loading
|
|
18
|
+
- `third-party/` - FlowEditor (ReactFlow wrapper), CodeEditor (Monaco wrapper)
|
|
19
|
+
|
|
20
|
+
### Component Pattern
|
|
21
|
+
Each component follows this structure:
|
|
22
|
+
- Main component file (e.g., `Button.tsx`) exports component and TypeScript types
|
|
23
|
+
- Storybook story file (e.g., `Button.stories.tsx`) for documentation/testing
|
|
24
|
+
- Jest test file in `__tests__/` subdirectory (e.g., `__tests__/Button.test.tsx`)
|
|
25
|
+
- Components use styled MUI components, not custom CSS files
|
|
26
|
+
|
|
27
|
+
### Theme System
|
|
28
|
+
- Theme defined in `src/theme/index.ts` using Material UI's `createTheme()`
|
|
29
|
+
- Primary color: #1976d2 (blue, not purple as README mentions)
|
|
30
|
+
- Export both `theme` and `colors` objects from theme file
|
|
31
|
+
- Components extend MUI components with custom styled variants (primary, secondary, tertiary)
|
|
32
|
+
- Border radius: 12px for inputs/buttons, 16px for cards/chips
|
|
33
|
+
- Typography: Inter font family, specific font weights/sizes for each variant
|
|
34
|
+
|
|
35
|
+
### Build System
|
|
36
|
+
- Uses `tsup` for bundling (see `tsup.config.ts`)
|
|
37
|
+
- Outputs CommonJS (`dist/index.js`), ESM (`dist/index.mjs`), and TypeScript declarations (`dist/index.d.ts`)
|
|
38
|
+
- All React, MUI, Monaco, and ReactFlow packages are marked as external dependencies (peer dependencies)
|
|
39
|
+
- Entry point: `src/index.ts` - ALL exports must be added here
|
|
40
|
+
|
|
41
|
+
## Development Commands
|
|
42
|
+
|
|
43
|
+
### Build & Development
|
|
44
|
+
```bash
|
|
45
|
+
# Build the library (produces dist/ folder)
|
|
46
|
+
npm run build
|
|
47
|
+
|
|
48
|
+
# Build in watch mode
|
|
49
|
+
npm run dev
|
|
50
|
+
|
|
51
|
+
# Run Storybook for component development
|
|
52
|
+
npm run storybook
|
|
53
|
+
|
|
54
|
+
# Build Storybook for deployment
|
|
55
|
+
npm run build-storybook
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Testing
|
|
59
|
+
```bash
|
|
60
|
+
# Run Jest unit tests
|
|
61
|
+
npm test
|
|
62
|
+
|
|
63
|
+
# Run tests in watch mode
|
|
64
|
+
npm run test:watch
|
|
65
|
+
|
|
66
|
+
# Generate coverage report
|
|
67
|
+
npm run test:coverage
|
|
68
|
+
|
|
69
|
+
# Run tests in CI mode
|
|
70
|
+
npm run test:ci
|
|
71
|
+
|
|
72
|
+
# Run Storybook interaction tests (includes a11y checks)
|
|
73
|
+
npm run test:storybook
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Code Quality
|
|
77
|
+
```bash
|
|
78
|
+
# Run ESLint
|
|
79
|
+
npm run lint
|
|
80
|
+
|
|
81
|
+
# Fix ESLint issues automatically
|
|
82
|
+
npm run lint:fix
|
|
83
|
+
|
|
84
|
+
# TypeScript type checking
|
|
85
|
+
npm run type-check
|
|
86
|
+
|
|
87
|
+
# Type checking for CI
|
|
88
|
+
npm run check-types:ci
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Testing Requirements
|
|
92
|
+
|
|
93
|
+
### Test Structure
|
|
94
|
+
- Unit tests: Use Jest + React Testing Library in `__tests__/` subdirectories
|
|
95
|
+
- Interaction tests: Use Storybook's `play` function in `.stories.tsx` files
|
|
96
|
+
- All components must wrap with `<ThemeProvider theme={theme}>` in tests
|
|
97
|
+
- Standard test helper pattern:
|
|
98
|
+
```tsx
|
|
99
|
+
const renderWithTheme = (component: React.ReactElement) => {
|
|
100
|
+
return render(<ThemeProvider theme={theme}>{component}</ThemeProvider>);
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Test Coverage
|
|
105
|
+
- Target: 80%+ coverage for component logic
|
|
106
|
+
- Test files should cover: rendering, user interactions, prop variants, callbacks, disabled/error states
|
|
107
|
+
- Storybook Test Runner automatically runs accessibility (a11y) checks using axe-playwright
|
|
108
|
+
|
|
109
|
+
## Adding New Components
|
|
110
|
+
|
|
111
|
+
When adding new components:
|
|
112
|
+
1. Create component file in appropriate category folder in `src/components/`
|
|
113
|
+
2. Export component and TypeScript types (props interface)
|
|
114
|
+
3. Add exports to `src/index.ts` (both component and type exports)
|
|
115
|
+
4. Create Storybook story with examples of all variants/states
|
|
116
|
+
5. Write Jest unit tests in `__tests__/` subdirectory
|
|
117
|
+
6. Follow existing component patterns:
|
|
118
|
+
- Use MUI components as base, extend with `styled()`
|
|
119
|
+
- Support custom variants (primary, secondary, tertiary) where applicable
|
|
120
|
+
- Include proper TypeScript types and JSDoc comments
|
|
121
|
+
- Handle theme integration using `useTheme()` hook or `colors` import
|
|
122
|
+
|
|
123
|
+
## Third-Party Components
|
|
124
|
+
|
|
125
|
+
### FlowEditor (ReactFlow)
|
|
126
|
+
- Wrapper around ReactFlow with theme integration
|
|
127
|
+
- ReactFlow CSS imported in Storybook's preview.tsx
|
|
128
|
+
- Custom props: height, showBackground, showControls, showMinimap
|
|
129
|
+
- Re-exports commonly used ReactFlow types (Node, Edge, NodeTypes, etc.)
|
|
130
|
+
|
|
131
|
+
### CodeEditor (Monaco)
|
|
132
|
+
- Wrapper around Monaco Editor
|
|
133
|
+
- Supports fullscreen mode, validation, type definitions injection
|
|
134
|
+
- TypeScript configuration in `configureTypeScript()` function
|
|
135
|
+
- Monaco loads from node_modules automatically (no loader configuration needed)
|
|
136
|
+
- Supports multiple languages: typescript, javascript, json, yaml, python, etc.
|
|
137
|
+
|
|
138
|
+
## Important Notes
|
|
139
|
+
|
|
140
|
+
- This package uses peer dependencies - consumers must install React, MUI, ReactFlow, and Monaco themselves
|
|
141
|
+
- Do NOT add new dependencies without considering if they should be peer dependencies
|
|
142
|
+
- The package name is `@cere/cere-design-system`
|
|
143
|
+
- When updating MUI components, ensure backward compatibility or update version appropriately
|
|
144
|
+
- ESLint ignores: dist/, config files, and .stories files
|
|
145
|
+
- Jest ignores: stories, test files, index.ts, and .d.ts files for coverage
|