@cere/cere-design-system 0.0.8 → 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 +3245 -564
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3108 -468
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -4
|
@@ -0,0 +1,1351 @@
|
|
|
1
|
+
You are a senior UI developer with expertise in React, TypeScript, Material-UI, and the Cere Design System.
|
|
2
|
+
When building applications using this design system, follow these guidelines and use the components documented below.
|
|
3
|
+
|
|
4
|
+
## Installation & Setup
|
|
5
|
+
|
|
6
|
+
```typescript
|
|
7
|
+
import { ThemeProvider } from '@emotion/react';
|
|
8
|
+
import { theme } from '@cere/cere-design-system';
|
|
9
|
+
|
|
10
|
+
// Wrap your application with the theme provider
|
|
11
|
+
<ThemeProvider theme={theme}>
|
|
12
|
+
<YourApp />
|
|
13
|
+
</ThemeProvider>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Theme & Colors
|
|
17
|
+
|
|
18
|
+
Import theme and colors from the package:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { theme, colors } from '@cere/cere-design-system';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Theme Configuration:**
|
|
25
|
+
- Primary color: `#1976d2` (blue)
|
|
26
|
+
- Font family: Inter
|
|
27
|
+
- Border radius: 12px for inputs/buttons, 16px for cards/chips
|
|
28
|
+
- Breakpoints: xs, sm, md, lg, xl (standard Material-UI)
|
|
29
|
+
|
|
30
|
+
**Available Color Palettes:**
|
|
31
|
+
- `colors.primary` - main, light, dark, contrastText
|
|
32
|
+
- `colors.secondary` - main, light, dark, contrastText
|
|
33
|
+
- `colors.tertiary` - main (orange/amber)
|
|
34
|
+
- `colors.error`, `colors.warning`, `colors.info`, `colors.success`
|
|
35
|
+
- `colors.grey` - 50, 100, 200, 300, 400, 500, 600, 700, 800, 900
|
|
36
|
+
- `colors.background` - default, paper, selected
|
|
37
|
+
- `colors.text` - primary, secondary, disabled
|
|
38
|
+
|
|
39
|
+
## Responsive Hooks
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { useIsDesktop, useIsTablet, useIsMobile } from '@cere/cere-design-system';
|
|
43
|
+
|
|
44
|
+
const isDesktop = useIsDesktop(); // > 1024px
|
|
45
|
+
const isTablet = useIsTablet(); // 768px - 1024px
|
|
46
|
+
const isMobile = useIsMobile(); // < 768px
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Messaging System
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { MessagesProvider, useMessages } from '@cere/cere-design-system';
|
|
53
|
+
|
|
54
|
+
// Wrap app with MessagesProvider
|
|
55
|
+
<MessagesProvider><App /></MessagesProvider>
|
|
56
|
+
|
|
57
|
+
// Use in components
|
|
58
|
+
const { showMessage } = useMessages();
|
|
59
|
+
showMessage('Success!', { severity: 'success', duration: 3000 });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## BUTTONS
|
|
65
|
+
|
|
66
|
+
### Button
|
|
67
|
+
Primary, secondary, and tertiary button variants with icons.
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { Button } from '@cere/cere-design-system';
|
|
71
|
+
import type { ButtonProps } from '@cere/cere-design-system';
|
|
72
|
+
|
|
73
|
+
<Button variant="primary" size="medium" startIcon={<Icon />}>
|
|
74
|
+
Click Me
|
|
75
|
+
</Button>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Props:**
|
|
79
|
+
- `variant?: 'primary' | 'secondary' | 'tertiary'` - Button style (default: 'primary')
|
|
80
|
+
- `size?: 'small' | 'medium' | 'large'` - Button size
|
|
81
|
+
- `startIcon?: ReactNode` - Icon before text
|
|
82
|
+
- `endIcon?: ReactNode` - Icon after text
|
|
83
|
+
- `disabled?: boolean` - Disable button
|
|
84
|
+
- `onClick?: () => void` - Click handler
|
|
85
|
+
- `fullWidth?: boolean` - Full width button
|
|
86
|
+
- `type?: 'button' | 'submit' | 'reset'` - Button type
|
|
87
|
+
- All standard MUI Button props
|
|
88
|
+
|
|
89
|
+
### IconButton
|
|
90
|
+
Button with only an icon, no text.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { IconButton } from '@cere/cere-design-system';
|
|
94
|
+
|
|
95
|
+
<IconButton size="medium" aria-label="delete">
|
|
96
|
+
<DeleteIcon />
|
|
97
|
+
</IconButton>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Props:**
|
|
101
|
+
- `size?: 'small' | 'medium' | 'large'`
|
|
102
|
+
- `disabled?: boolean`
|
|
103
|
+
- `onClick?: () => void`
|
|
104
|
+
- `edge?: 'start' | 'end' | false`
|
|
105
|
+
- `color?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'`
|
|
106
|
+
|
|
107
|
+
### LoadingButton
|
|
108
|
+
Button with loading state and spinner.
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { LoadingButton } from '@cere/cere-design-system';
|
|
112
|
+
|
|
113
|
+
<LoadingButton loading={isLoading} variant="primary">
|
|
114
|
+
Submit
|
|
115
|
+
</LoadingButton>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Props:**
|
|
119
|
+
- Same as `Button` props
|
|
120
|
+
- `loading?: boolean` - Show loading spinner
|
|
121
|
+
- `loadingPosition?: 'start' | 'end' | 'center'` - Spinner position
|
|
122
|
+
|
|
123
|
+
### ButtonGroup
|
|
124
|
+
Group related buttons together.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { ButtonGroup, Button } from '@cere/cere-design-system';
|
|
128
|
+
|
|
129
|
+
<ButtonGroup variant="contained" size="medium">
|
|
130
|
+
<Button>One</Button>
|
|
131
|
+
<Button>Two</Button>
|
|
132
|
+
<Button>Three</Button>
|
|
133
|
+
</ButtonGroup>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Props:**
|
|
137
|
+
- `variant?: 'text' | 'outlined' | 'contained'`
|
|
138
|
+
- `size?: 'small' | 'medium' | 'large'`
|
|
139
|
+
- `orientation?: 'horizontal' | 'vertical'`
|
|
140
|
+
- `disabled?: boolean`
|
|
141
|
+
- `fullWidth?: boolean`
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## INPUTS
|
|
146
|
+
|
|
147
|
+
### TextField
|
|
148
|
+
Text input field with label and validation.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { TextField } from '@cere/cere-design-system';
|
|
152
|
+
|
|
153
|
+
<TextField
|
|
154
|
+
label="Email"
|
|
155
|
+
value={email}
|
|
156
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
157
|
+
error={!!error}
|
|
158
|
+
helperText={error}
|
|
159
|
+
required
|
|
160
|
+
/>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Props:**
|
|
164
|
+
- `size?: 'small' | 'medium'`
|
|
165
|
+
- `label?: string` - Input label
|
|
166
|
+
- `value?: string` - Input value
|
|
167
|
+
- `onChange?: (e) => void` - Change handler
|
|
168
|
+
- `error?: boolean` - Show error state
|
|
169
|
+
- `helperText?: string` - Helper/error text below input
|
|
170
|
+
- `required?: boolean` - Required field indicator
|
|
171
|
+
- `disabled?: boolean`
|
|
172
|
+
- `multiline?: boolean` - Textarea mode
|
|
173
|
+
- `rows?: number` - Number of rows for multiline
|
|
174
|
+
- `type?: string` - Input type (text, password, email, etc.)
|
|
175
|
+
- `placeholder?: string`
|
|
176
|
+
- `fullWidth?: boolean`
|
|
177
|
+
- `InputProps?: object` - Custom input props (adornments, etc.)
|
|
178
|
+
|
|
179
|
+
### SearchField
|
|
180
|
+
Search input with search icon.
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import { SearchField } from '@cere/cere-design-system';
|
|
184
|
+
|
|
185
|
+
<SearchField
|
|
186
|
+
value={query}
|
|
187
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
188
|
+
placeholder="Search..."
|
|
189
|
+
/>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Props:**
|
|
193
|
+
- Same as `TextField` props
|
|
194
|
+
- Automatically includes search icon
|
|
195
|
+
|
|
196
|
+
### Dropdown (Select/Autocomplete)
|
|
197
|
+
Two variants: input dropdown and navigation dropdown.
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
// Input variant (Select)
|
|
201
|
+
import { Dropdown } from '@cere/cere-design-system';
|
|
202
|
+
|
|
203
|
+
<Dropdown
|
|
204
|
+
label="Select Option"
|
|
205
|
+
value={value}
|
|
206
|
+
onChange={(e) => setValue(e.target.value)}
|
|
207
|
+
options={[
|
|
208
|
+
{ value: '1', label: 'Option 1' },
|
|
209
|
+
{ value: '2', label: 'Option 2' }
|
|
210
|
+
]}
|
|
211
|
+
/>
|
|
212
|
+
|
|
213
|
+
// Navigation variant (Popover)
|
|
214
|
+
<Dropdown
|
|
215
|
+
variant="button"
|
|
216
|
+
label="Menu"
|
|
217
|
+
open={open}
|
|
218
|
+
onToggle={(isOpen) => setOpen(isOpen)}
|
|
219
|
+
>
|
|
220
|
+
<MenuItem>Item 1</MenuItem>
|
|
221
|
+
<MenuItem>Item 2</MenuItem>
|
|
222
|
+
</Dropdown>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Props (Navigation Dropdown):**
|
|
226
|
+
- `variant: 'header' | 'button'` - Dropdown style (required)
|
|
227
|
+
- `open: boolean` - Open state (required)
|
|
228
|
+
- `onToggle?: (open: boolean) => void` - Toggle handler
|
|
229
|
+
- `label?: string` - Button label
|
|
230
|
+
- `leftElement?: ReactNode` - Icon/element before label
|
|
231
|
+
- `direction?: 'right' | 'left'` - Dropdown direction (default: 'left')
|
|
232
|
+
- `dense?: boolean` - Compact spacing
|
|
233
|
+
- `disableGutters?: boolean` - Remove horizontal padding
|
|
234
|
+
- `disablePaddings?: boolean` - Remove all padding
|
|
235
|
+
- `renderAnchor?: (options) => ReactNode` - Custom anchor renderer
|
|
236
|
+
|
|
237
|
+
### Switch
|
|
238
|
+
Toggle switch component.
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { Switch } from '@cere/cere-design-system';
|
|
242
|
+
|
|
243
|
+
<Switch checked={enabled} onChange={(e) => setEnabled(e.target.checked)} />
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Props:**
|
|
247
|
+
- `checked?: boolean` - Checked state
|
|
248
|
+
- `onChange?: (e) => void` - Change handler
|
|
249
|
+
- `disabled?: boolean`
|
|
250
|
+
- `size?: 'small' | 'medium'`
|
|
251
|
+
- `color?: 'primary' | 'secondary' | 'default'`
|
|
252
|
+
|
|
253
|
+
### Checkbox
|
|
254
|
+
Checkbox input.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
import { Checkbox } from '@cere/cere-design-system';
|
|
258
|
+
|
|
259
|
+
<Checkbox checked={agreed} onChange={(e) => setAgreed(e.target.checked)} />
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Props:**
|
|
263
|
+
- `checked?: boolean`
|
|
264
|
+
- `onChange?: (e) => void`
|
|
265
|
+
- `disabled?: boolean`
|
|
266
|
+
- `indeterminate?: boolean` - Partially checked state
|
|
267
|
+
- `size?: 'small' | 'medium'`
|
|
268
|
+
- `color?: 'primary' | 'secondary' | 'default'`
|
|
269
|
+
|
|
270
|
+
### Radio & RadioGroup
|
|
271
|
+
Radio button inputs.
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { Radio, RadioGroup, FormControlLabel } from '@cere/cere-design-system';
|
|
275
|
+
|
|
276
|
+
<RadioGroup value={value} onChange={(e) => setValue(e.target.value)}>
|
|
277
|
+
<FormControlLabel value="1" control={<Radio />} label="Option 1" />
|
|
278
|
+
<FormControlLabel value="2" control={<Radio />} label="Option 2" />
|
|
279
|
+
</RadioGroup>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Props:**
|
|
283
|
+
- `value?: string` - Selected value
|
|
284
|
+
- `onChange?: (e) => void` - Change handler
|
|
285
|
+
- `name?: string` - Group name
|
|
286
|
+
- `row?: boolean` - Horizontal layout
|
|
287
|
+
|
|
288
|
+
### ToggleButton & ToggleButtonGroup
|
|
289
|
+
Toggle button for selecting options.
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
import { ToggleButton, ToggleButtonGroup } from '@cere/cere-design-system';
|
|
293
|
+
|
|
294
|
+
<ToggleButtonGroup value={alignment} exclusive onChange={(e, val) => setAlignment(val)}>
|
|
295
|
+
<ToggleButton value="left">Left</ToggleButton>
|
|
296
|
+
<ToggleButton value="center">Center</ToggleButton>
|
|
297
|
+
<ToggleButton value="right">Right</ToggleButton>
|
|
298
|
+
</ToggleButtonGroup>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**Props:**
|
|
302
|
+
- `value?: any` - Selected value(s)
|
|
303
|
+
- `onChange?: (e, value) => void` - Change handler
|
|
304
|
+
- `exclusive?: boolean` - Single selection mode
|
|
305
|
+
- `size?: 'small' | 'medium' | 'large'`
|
|
306
|
+
- `disabled?: boolean`
|
|
307
|
+
- `orientation?: 'horizontal' | 'vertical'`
|
|
308
|
+
|
|
309
|
+
### Form Components
|
|
310
|
+
Form control wrappers and labels.
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
import {
|
|
314
|
+
FormControl,
|
|
315
|
+
FormLabel,
|
|
316
|
+
FormHelperText,
|
|
317
|
+
FormControlLabel,
|
|
318
|
+
InputLabel,
|
|
319
|
+
InputAdornment
|
|
320
|
+
} from '@cere/cere-design-system';
|
|
321
|
+
|
|
322
|
+
<FormControl>
|
|
323
|
+
<FormLabel>Label</FormLabel>
|
|
324
|
+
<TextField />
|
|
325
|
+
<FormHelperText>Helper text</FormHelperText>
|
|
326
|
+
</FormControl>
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## NAVIGATION
|
|
332
|
+
|
|
333
|
+
### Sidebar & SidebarItem
|
|
334
|
+
Application sidebar navigation.
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import { Sidebar, SidebarItem } from '@cere/cere-design-system';
|
|
338
|
+
|
|
339
|
+
<Sidebar>
|
|
340
|
+
<SidebarItem icon={<HomeIcon />} label="Home" active />
|
|
341
|
+
<SidebarItem icon={<SettingsIcon />} label="Settings" />
|
|
342
|
+
</Sidebar>
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Sidebar Props:**
|
|
346
|
+
- `width?: number` - Sidebar width in pixels
|
|
347
|
+
- `collapsed?: boolean` - Collapsed state
|
|
348
|
+
|
|
349
|
+
**SidebarItem Props:**
|
|
350
|
+
- `icon?: ReactNode` - Item icon
|
|
351
|
+
- `label: string` - Item label
|
|
352
|
+
- `active?: boolean` - Active/selected state
|
|
353
|
+
- `onClick?: () => void` - Click handler
|
|
354
|
+
- `disabled?: boolean`
|
|
355
|
+
- `badge?: string | number` - Badge content
|
|
356
|
+
|
|
357
|
+
### Tab
|
|
358
|
+
Tab navigation component.
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
import { Tab } from '@cere/cere-design-system';
|
|
362
|
+
|
|
363
|
+
<Tab value={value} onChange={(e, val) => setValue(val)}>
|
|
364
|
+
<Tab label="Tab 1" value="1" />
|
|
365
|
+
<Tab label="Tab 2" value="2" />
|
|
366
|
+
</Tab>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**Props:**
|
|
370
|
+
- `value?: any` - Active tab value
|
|
371
|
+
- `onChange?: (e, value) => void` - Change handler
|
|
372
|
+
- `variant?: 'standard' | 'scrollable' | 'fullWidth'`
|
|
373
|
+
- `orientation?: 'horizontal' | 'vertical'`
|
|
374
|
+
|
|
375
|
+
### Menu & MenuItem
|
|
376
|
+
Context menu or dropdown menu.
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
import { Menu, MenuItem } from '@cere/cere-design-system';
|
|
380
|
+
|
|
381
|
+
<Menu open={open} onClose={() => setOpen(false)} anchorEl={anchorEl}>
|
|
382
|
+
<MenuItem onClick={handleEdit}>Edit</MenuItem>
|
|
383
|
+
<MenuItem onClick={handleDelete}>Delete</MenuItem>
|
|
384
|
+
</Menu>
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Menu Props:**
|
|
388
|
+
- `open: boolean` - Open state
|
|
389
|
+
- `onClose?: () => void` - Close handler
|
|
390
|
+
- `anchorEl?: Element` - Anchor element
|
|
391
|
+
|
|
392
|
+
**MenuItem Props:**
|
|
393
|
+
- `onClick?: () => void` - Click handler
|
|
394
|
+
- `disabled?: boolean`
|
|
395
|
+
- `selected?: boolean`
|
|
396
|
+
|
|
397
|
+
### Pagination
|
|
398
|
+
Pagination controls.
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
import { Pagination } from '@cere/cere-design-system';
|
|
402
|
+
|
|
403
|
+
<Pagination
|
|
404
|
+
count={10}
|
|
405
|
+
page={page}
|
|
406
|
+
onChange={(e, p) => setPage(p)}
|
|
407
|
+
/>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Props:**
|
|
411
|
+
- `count: number` - Total pages
|
|
412
|
+
- `page?: number` - Current page (1-indexed)
|
|
413
|
+
- `onChange?: (e, page) => void` - Page change handler
|
|
414
|
+
- `size?: 'small' | 'medium' | 'large'`
|
|
415
|
+
- `variant?: 'text' | 'outlined'`
|
|
416
|
+
- `color?: 'primary' | 'secondary' | 'standard'`
|
|
417
|
+
- `showFirstButton?: boolean`
|
|
418
|
+
- `showLastButton?: boolean`
|
|
419
|
+
|
|
420
|
+
### Selector
|
|
421
|
+
Option selector dropdown.
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
import { Selector } from '@cere/cere-design-system';
|
|
425
|
+
import type { SelectorOption } from '@cere/cere-design-system';
|
|
426
|
+
|
|
427
|
+
const options: SelectorOption[] = [
|
|
428
|
+
{ id: '1', label: 'Option 1', value: 'val1' },
|
|
429
|
+
{ id: '2', label: 'Option 2', value: 'val2' }
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
<Selector
|
|
433
|
+
options={options}
|
|
434
|
+
value={selected}
|
|
435
|
+
onChange={(option) => setSelected(option)}
|
|
436
|
+
/>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**Props:**
|
|
440
|
+
- `options: SelectorOption[]` - Available options
|
|
441
|
+
- `value?: SelectorOption` - Selected option
|
|
442
|
+
- `onChange?: (option) => void` - Change handler
|
|
443
|
+
- `placeholder?: string`
|
|
444
|
+
|
|
445
|
+
### Stepper
|
|
446
|
+
Step-by-step progress indicator.
|
|
447
|
+
|
|
448
|
+
```typescript
|
|
449
|
+
import { Stepper, Step, StepLabel, StepContent, StepButton } from '@cere/cere-design-system';
|
|
450
|
+
|
|
451
|
+
<Stepper activeStep={activeStep} orientation="vertical">
|
|
452
|
+
<Step>
|
|
453
|
+
<StepLabel>Step 1</StepLabel>
|
|
454
|
+
<StepContent>Content 1</StepContent>
|
|
455
|
+
</Step>
|
|
456
|
+
<Step>
|
|
457
|
+
<StepLabel>Step 2</StepLabel>
|
|
458
|
+
<StepContent>Content 2</StepContent>
|
|
459
|
+
</Step>
|
|
460
|
+
</Stepper>
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**Props:**
|
|
464
|
+
- `activeStep?: number` - Current step index
|
|
465
|
+
- `orientation?: 'horizontal' | 'vertical'`
|
|
466
|
+
- `alternativeLabel?: boolean`
|
|
467
|
+
- `nonLinear?: boolean` - Allow non-sequential navigation
|
|
468
|
+
|
|
469
|
+
### Service & Workspace Selectors
|
|
470
|
+
Special navigation components for selecting services/workspaces.
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
import { ServiceSelectorButton, WorkspaceSelectorButton } from '@cere/cere-design-system';
|
|
474
|
+
import type { Service, Workspace } from '@cere/cere-design-system';
|
|
475
|
+
|
|
476
|
+
<ServiceSelectorButton
|
|
477
|
+
services={services}
|
|
478
|
+
selected={currentService}
|
|
479
|
+
onSelect={(service) => setCurrentService(service)}
|
|
480
|
+
/>
|
|
481
|
+
|
|
482
|
+
<WorkspaceSelectorButton
|
|
483
|
+
workspaces={workspaces}
|
|
484
|
+
selected={currentWorkspace}
|
|
485
|
+
onSelect={(workspace) => setCurrentWorkspace(workspace)}
|
|
486
|
+
/>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Breadcrumbs
|
|
490
|
+
Breadcrumb navigation.
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
import { Breadcrumbs } from '@cere/cere-design-system';
|
|
494
|
+
import type { BreadcrumbItem } from '@cere/cere-design-system';
|
|
495
|
+
|
|
496
|
+
const items: BreadcrumbItem[] = [
|
|
497
|
+
{ label: 'Home', href: '/' },
|
|
498
|
+
{ label: 'Category', href: '/category' },
|
|
499
|
+
{ label: 'Current Page' }
|
|
500
|
+
];
|
|
501
|
+
|
|
502
|
+
<Breadcrumbs items={items} />
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**Props:**
|
|
506
|
+
- `items: BreadcrumbItem[]` - Breadcrumb items
|
|
507
|
+
- `maxItems?: number` - Max items to display before collapsing
|
|
508
|
+
- `separator?: ReactNode` - Custom separator
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## LAYOUT
|
|
513
|
+
|
|
514
|
+
### Card
|
|
515
|
+
Container card with header, content, and actions.
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
import { Card, CardHeader, CardContent, CardActions, Button } from '@cere/cere-design-system';
|
|
519
|
+
|
|
520
|
+
<Card hoverable clickable onClick={handleClick}>
|
|
521
|
+
<CardHeader title="Card Title" subheader="Subtitle" />
|
|
522
|
+
<CardContent>Card content here</CardContent>
|
|
523
|
+
<CardActions>
|
|
524
|
+
<Button>Action</Button>
|
|
525
|
+
</CardActions>
|
|
526
|
+
</Card>
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**Card Props:**
|
|
530
|
+
- `hoverable?: boolean` - Lift on hover effect
|
|
531
|
+
- `clickable?: boolean` - Cursor pointer, click effect
|
|
532
|
+
- `elevation?: number` - Shadow elevation (0-24)
|
|
533
|
+
- All standard MUI Card props
|
|
534
|
+
|
|
535
|
+
### Dialog
|
|
536
|
+
Modal dialog/popup.
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
import { Dialog, Button } from '@cere/cere-design-system';
|
|
540
|
+
|
|
541
|
+
<Dialog
|
|
542
|
+
open={open}
|
|
543
|
+
onClose={() => setOpen(false)}
|
|
544
|
+
title="Dialog Title"
|
|
545
|
+
maxWidth="sm"
|
|
546
|
+
fullWidth
|
|
547
|
+
>
|
|
548
|
+
<div>Dialog content</div>
|
|
549
|
+
</Dialog>
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
**Props:**
|
|
553
|
+
- `open: boolean` - Open state
|
|
554
|
+
- `onClose?: () => void` - Close handler
|
|
555
|
+
- `title?: string` - Dialog title
|
|
556
|
+
- `maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false`
|
|
557
|
+
- `fullWidth?: boolean`
|
|
558
|
+
- `fullScreen?: boolean`
|
|
559
|
+
|
|
560
|
+
### Drawer
|
|
561
|
+
Side drawer panel.
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
import { Drawer } from '@cere/cere-design-system';
|
|
565
|
+
|
|
566
|
+
<Drawer
|
|
567
|
+
open={open}
|
|
568
|
+
onClose={() => setOpen(false)}
|
|
569
|
+
anchor="right"
|
|
570
|
+
>
|
|
571
|
+
<div>Drawer content</div>
|
|
572
|
+
</Drawer>
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
**Props:**
|
|
576
|
+
- `open: boolean` - Open state
|
|
577
|
+
- `onClose?: () => void` - Close handler
|
|
578
|
+
- `anchor?: 'left' | 'right' | 'top' | 'bottom'`
|
|
579
|
+
- `variant?: 'permanent' | 'persistent' | 'temporary'`
|
|
580
|
+
|
|
581
|
+
### List & ListItem
|
|
582
|
+
Lists with items.
|
|
583
|
+
|
|
584
|
+
```typescript
|
|
585
|
+
import { List, ListItem, ListItemText, ListItemIcon, ListItemSecondaryAction } from '@cere/cere-design-system';
|
|
586
|
+
|
|
587
|
+
<List>
|
|
588
|
+
<ListItem button onClick={handleClick}>
|
|
589
|
+
<ListItemIcon><Icon /></ListItemIcon>
|
|
590
|
+
<ListItemText primary="Primary Text" secondary="Secondary Text" />
|
|
591
|
+
<ListItemSecondaryAction>
|
|
592
|
+
<IconButton><MoreIcon /></IconButton>
|
|
593
|
+
</ListItemSecondaryAction>
|
|
594
|
+
</ListItem>
|
|
595
|
+
</List>
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
**Props:**
|
|
599
|
+
- `dense?: boolean` - Compact spacing
|
|
600
|
+
- `disablePadding?: boolean`
|
|
601
|
+
- `button?: boolean` - Make item clickable (ListItem prop)
|
|
602
|
+
- `divider?: boolean` - Show divider (ListItem prop)
|
|
603
|
+
|
|
604
|
+
### Table
|
|
605
|
+
Data table with headers.
|
|
606
|
+
|
|
607
|
+
```typescript
|
|
608
|
+
import { Table, TableHeader } from '@cere/cere-design-system';
|
|
609
|
+
|
|
610
|
+
const columns = [
|
|
611
|
+
{ id: 'name', label: 'Name' },
|
|
612
|
+
{ id: 'email', label: 'Email' }
|
|
613
|
+
];
|
|
614
|
+
|
|
615
|
+
<Table
|
|
616
|
+
columns={columns}
|
|
617
|
+
data={rows}
|
|
618
|
+
onSort={(column) => handleSort(column)}
|
|
619
|
+
/>
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
**Props:**
|
|
623
|
+
- `columns: TableColumn[]` - Column definitions
|
|
624
|
+
- `data: any[]` - Table data rows
|
|
625
|
+
- `onSort?: (column) => void` - Sort handler
|
|
626
|
+
- `stickyHeader?: boolean`
|
|
627
|
+
- `size?: 'small' | 'medium'`
|
|
628
|
+
|
|
629
|
+
### Avatar
|
|
630
|
+
User avatar image or initials.
|
|
631
|
+
|
|
632
|
+
```typescript
|
|
633
|
+
import { Avatar } from '@cere/cere-design-system';
|
|
634
|
+
|
|
635
|
+
<Avatar src="/avatar.jpg" alt="User" />
|
|
636
|
+
<Avatar>JD</Avatar>
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
**Props:**
|
|
640
|
+
- `src?: string` - Image source
|
|
641
|
+
- `alt?: string` - Alt text
|
|
642
|
+
- `size?: 'small' | 'medium' | 'large'` | number
|
|
643
|
+
- `variant?: 'circular' | 'rounded' | 'square'`
|
|
644
|
+
- `children?: ReactNode` - Text/initials
|
|
645
|
+
|
|
646
|
+
### Grid
|
|
647
|
+
Responsive grid layout.
|
|
648
|
+
|
|
649
|
+
```typescript
|
|
650
|
+
import { Grid } from '@cere/cere-design-system';
|
|
651
|
+
|
|
652
|
+
<Grid container spacing={2}>
|
|
653
|
+
<Grid item xs={12} md={6}>Column 1</Grid>
|
|
654
|
+
<Grid item xs={12} md={6}>Column 2</Grid>
|
|
655
|
+
</Grid>
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**Props:**
|
|
659
|
+
- `container?: boolean` - Grid container
|
|
660
|
+
- `item?: boolean` - Grid item
|
|
661
|
+
- `spacing?: number` - Gap between items (0-10)
|
|
662
|
+
- `xs?: number | 'auto'` - Mobile columns (1-12)
|
|
663
|
+
- `sm?: number | 'auto'` - Tablet columns
|
|
664
|
+
- `md?: number | 'auto'` - Desktop columns
|
|
665
|
+
- `lg?: number | 'auto'` - Large desktop columns
|
|
666
|
+
- `xl?: number | 'auto'` - XL desktop columns
|
|
667
|
+
|
|
668
|
+
### Box, Stack, Container
|
|
669
|
+
Layout utilities.
|
|
670
|
+
|
|
671
|
+
```typescript
|
|
672
|
+
import { Box, Stack, Container } from '@cere/cere-design-system';
|
|
673
|
+
|
|
674
|
+
<Container maxWidth="lg">
|
|
675
|
+
<Stack spacing={2} direction="row">
|
|
676
|
+
<Box sx={{ p: 2, bgcolor: 'primary.main' }}>Box 1</Box>
|
|
677
|
+
<Box sx={{ p: 2, bgcolor: 'secondary.main' }}>Box 2</Box>
|
|
678
|
+
</Stack>
|
|
679
|
+
</Container>
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
**Stack Props:**
|
|
683
|
+
- `spacing?: number` - Gap between children
|
|
684
|
+
- `direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse'`
|
|
685
|
+
- `divider?: ReactNode` - Divider between items
|
|
686
|
+
- `alignItems?: string` - CSS align-items
|
|
687
|
+
- `justifyContent?: string` - CSS justify-content
|
|
688
|
+
|
|
689
|
+
**Container Props:**
|
|
690
|
+
- `maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false`
|
|
691
|
+
- `disableGutters?: boolean`
|
|
692
|
+
- `fixed?: boolean`
|
|
693
|
+
|
|
694
|
+
### Paper
|
|
695
|
+
Elevated surface.
|
|
696
|
+
|
|
697
|
+
```typescript
|
|
698
|
+
import { Paper } from '@cere/cere-design-system';
|
|
699
|
+
|
|
700
|
+
<Paper elevation={3} sx={{ p: 2 }}>
|
|
701
|
+
Content
|
|
702
|
+
</Paper>
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
**Props:**
|
|
706
|
+
- `elevation?: number` - Shadow depth (0-24)
|
|
707
|
+
- `variant?: 'elevation' | 'outlined'`
|
|
708
|
+
- `square?: boolean` - Sharp corners
|
|
709
|
+
|
|
710
|
+
### Typography
|
|
711
|
+
Text component with semantic variants.
|
|
712
|
+
|
|
713
|
+
```typescript
|
|
714
|
+
import { Typography } from '@cere/cere-design-system';
|
|
715
|
+
|
|
716
|
+
<Typography variant="h1" color="primary">
|
|
717
|
+
Heading
|
|
718
|
+
</Typography>
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
**Props:**
|
|
722
|
+
- `variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'button' | 'overline'`
|
|
723
|
+
- `color?: string` - Text color
|
|
724
|
+
- `align?: 'left' | 'center' | 'right' | 'justify'`
|
|
725
|
+
- `gutterBottom?: boolean` - Bottom margin
|
|
726
|
+
- `noWrap?: boolean` - Prevent wrapping
|
|
727
|
+
|
|
728
|
+
### Link
|
|
729
|
+
Styled link component.
|
|
730
|
+
|
|
731
|
+
```typescript
|
|
732
|
+
import { Link } from '@cere/cere-design-system';
|
|
733
|
+
|
|
734
|
+
<Link href="/path" underline="hover">
|
|
735
|
+
Link Text
|
|
736
|
+
</Link>
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
**Props:**
|
|
740
|
+
- `href?: string` - Link URL
|
|
741
|
+
- `underline?: 'none' | 'hover' | 'always'`
|
|
742
|
+
- `color?: string`
|
|
743
|
+
- `target?: string`
|
|
744
|
+
|
|
745
|
+
### AppBar & Toolbar
|
|
746
|
+
Application header bar.
|
|
747
|
+
|
|
748
|
+
```typescript
|
|
749
|
+
import { AppBar, Toolbar, Typography } from '@cere/cere-design-system';
|
|
750
|
+
|
|
751
|
+
<AppBar position="fixed">
|
|
752
|
+
<Toolbar>
|
|
753
|
+
<Typography variant="h6">App Title</Typography>
|
|
754
|
+
</Toolbar>
|
|
755
|
+
</AppBar>
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
**AppBar Props:**
|
|
759
|
+
- `position?: 'fixed' | 'absolute' | 'sticky' | 'static' | 'relative'`
|
|
760
|
+
- `color?: 'default' | 'primary' | 'secondary' | 'transparent'`
|
|
761
|
+
- `elevation?: number`
|
|
762
|
+
|
|
763
|
+
### Accordion
|
|
764
|
+
Collapsible content panels.
|
|
765
|
+
|
|
766
|
+
```typescript
|
|
767
|
+
import { Accordion } from '@cere/cere-design-system';
|
|
768
|
+
|
|
769
|
+
<Accordion expanded={expanded} onChange={() => setExpanded(!expanded)}>
|
|
770
|
+
<AccordionSummary>Header</AccordionSummary>
|
|
771
|
+
<AccordionDetails>Content</AccordionDetails>
|
|
772
|
+
</Accordion>
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
**Props:**
|
|
776
|
+
- `expanded?: boolean` - Expanded state
|
|
777
|
+
- `onChange?: () => void` - Toggle handler
|
|
778
|
+
- `disabled?: boolean`
|
|
779
|
+
- `defaultExpanded?: boolean`
|
|
780
|
+
|
|
781
|
+
### Collapse
|
|
782
|
+
Animated expand/collapse wrapper.
|
|
783
|
+
|
|
784
|
+
```typescript
|
|
785
|
+
import { Collapse } from '@cere/cere-design-system';
|
|
786
|
+
|
|
787
|
+
<Collapse in={show}>
|
|
788
|
+
<div>Collapsible content</div>
|
|
789
|
+
</Collapse>
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
**Props:**
|
|
793
|
+
- `in: boolean` - Show/hide state
|
|
794
|
+
- `timeout?: number | 'auto'` - Animation duration
|
|
795
|
+
- `unmountOnExit?: boolean`
|
|
796
|
+
|
|
797
|
+
### Divider
|
|
798
|
+
Visual separator line.
|
|
799
|
+
|
|
800
|
+
```typescript
|
|
801
|
+
import { Divider } from '@cere/cere-design-system';
|
|
802
|
+
|
|
803
|
+
<Divider />
|
|
804
|
+
<Divider orientation="vertical" />
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
**Props:**
|
|
808
|
+
- `orientation?: 'horizontal' | 'vertical'`
|
|
809
|
+
- `variant?: 'fullWidth' | 'inset' | 'middle'`
|
|
810
|
+
- `flexItem?: boolean`
|
|
811
|
+
|
|
812
|
+
### Logo
|
|
813
|
+
Cere Network logo component.
|
|
814
|
+
|
|
815
|
+
```typescript
|
|
816
|
+
import { Logo } from '@cere/cere-design-system';
|
|
817
|
+
|
|
818
|
+
<Logo size="medium" variant="full" />
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
**Props:**
|
|
822
|
+
- `size?: 'small' | 'medium' | 'large'` | number
|
|
823
|
+
- `variant?: 'full' | 'icon'`
|
|
824
|
+
|
|
825
|
+
---
|
|
826
|
+
|
|
827
|
+
## FEEDBACK
|
|
828
|
+
|
|
829
|
+
### Alert & Snackbar
|
|
830
|
+
Alert messages and toast notifications.
|
|
831
|
+
|
|
832
|
+
```typescript
|
|
833
|
+
import { Alert, Snackbar } from '@cere/cere-design-system';
|
|
834
|
+
|
|
835
|
+
<Alert severity="success" title="Success!">
|
|
836
|
+
Operation completed
|
|
837
|
+
</Alert>
|
|
838
|
+
|
|
839
|
+
<Snackbar
|
|
840
|
+
open={open}
|
|
841
|
+
message="Saved successfully"
|
|
842
|
+
severity="success"
|
|
843
|
+
onClose={() => setOpen(false)}
|
|
844
|
+
autoHideDuration={6000}
|
|
845
|
+
/>
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
**Alert Props:**
|
|
849
|
+
- `severity?: 'success' | 'error' | 'warning' | 'info'` (default: 'info')
|
|
850
|
+
- `title?: string` - Alert title
|
|
851
|
+
- `variant?: 'filled' | 'standard' | 'outlined'`
|
|
852
|
+
- `onClose?: () => void` - Close button handler
|
|
853
|
+
|
|
854
|
+
**Snackbar Props:**
|
|
855
|
+
- `open: boolean` - Open state
|
|
856
|
+
- `message?: string` - Message text
|
|
857
|
+
- `severity?: 'success' | 'error' | 'warning' | 'info'` (default: 'info')
|
|
858
|
+
- `title?: string` - Alert title
|
|
859
|
+
- `variant?: 'filled' | 'standard' | 'outlined'` (default: 'filled')
|
|
860
|
+
- `onClose?: () => void` - Close handler
|
|
861
|
+
- `autoHideDuration?: number` (default: 6000ms)
|
|
862
|
+
- `anchorOrigin?: { vertical, horizontal }` - Position
|
|
863
|
+
|
|
864
|
+
### Badge
|
|
865
|
+
Small badge indicator.
|
|
866
|
+
|
|
867
|
+
```typescript
|
|
868
|
+
import { Badge } from '@cere/cere-design-system';
|
|
869
|
+
|
|
870
|
+
<Badge badgeContent={4} color="primary">
|
|
871
|
+
<MailIcon />
|
|
872
|
+
</Badge>
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
**Props:**
|
|
876
|
+
- `badgeContent?: ReactNode` - Badge content
|
|
877
|
+
- `color?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'`
|
|
878
|
+
- `variant?: 'standard' | 'dot'`
|
|
879
|
+
- `max?: number` - Max number before showing "+"
|
|
880
|
+
- `invisible?: boolean`
|
|
881
|
+
|
|
882
|
+
### Chip
|
|
883
|
+
Compact element representing an input, attribute, or action.
|
|
884
|
+
|
|
885
|
+
```typescript
|
|
886
|
+
import { Chip } from '@cere/cere-design-system';
|
|
887
|
+
|
|
888
|
+
<Chip
|
|
889
|
+
label="Tag"
|
|
890
|
+
onDelete={handleDelete}
|
|
891
|
+
color="primary"
|
|
892
|
+
icon={<Icon />}
|
|
893
|
+
/>
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
**Props:**
|
|
897
|
+
- `label: string` - Chip text
|
|
898
|
+
- `variant?: 'filled' | 'outlined'`
|
|
899
|
+
- `color?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'`
|
|
900
|
+
- `size?: 'small' | 'medium'`
|
|
901
|
+
- `icon?: ReactNode` - Icon before label
|
|
902
|
+
- `avatar?: ReactNode` - Avatar before label
|
|
903
|
+
- `onDelete?: () => void` - Delete handler (shows X button)
|
|
904
|
+
- `onClick?: () => void` - Click handler
|
|
905
|
+
- `disabled?: boolean`
|
|
906
|
+
- `clickable?: boolean`
|
|
907
|
+
|
|
908
|
+
### Tooltip
|
|
909
|
+
Informative tooltip on hover.
|
|
910
|
+
|
|
911
|
+
```typescript
|
|
912
|
+
import { Tooltip } from '@cere/cere-design-system';
|
|
913
|
+
|
|
914
|
+
<Tooltip title="Helpful information" placement="top">
|
|
915
|
+
<IconButton><HelpIcon /></IconButton>
|
|
916
|
+
</Tooltip>
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
**Props:**
|
|
920
|
+
- `title: string | ReactNode` - Tooltip content
|
|
921
|
+
- `placement?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | etc.`
|
|
922
|
+
- `arrow?: boolean` - Show arrow pointer
|
|
923
|
+
- `open?: boolean` - Controlled open state
|
|
924
|
+
- `onOpen?: () => void`
|
|
925
|
+
- `onClose?: () => void`
|
|
926
|
+
|
|
927
|
+
### Progress
|
|
928
|
+
Linear progress bar.
|
|
929
|
+
|
|
930
|
+
```typescript
|
|
931
|
+
import { Progress } from '@cere/cere-design-system';
|
|
932
|
+
|
|
933
|
+
<Progress value={75} variant="determinate" />
|
|
934
|
+
<Progress variant="indeterminate" />
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
**Props:**
|
|
938
|
+
- `variant?: 'determinate' | 'indeterminate'`
|
|
939
|
+
- `value?: number` - Progress value (0-100) for determinate
|
|
940
|
+
- `color?: 'primary' | 'secondary'`
|
|
941
|
+
- `valueBuffer?: number` - Buffer value for buffer variant
|
|
942
|
+
|
|
943
|
+
### CircularProgress
|
|
944
|
+
Circular loading spinner.
|
|
945
|
+
|
|
946
|
+
```typescript
|
|
947
|
+
import { CircularProgress } from '@cere/cere-design-system';
|
|
948
|
+
|
|
949
|
+
<CircularProgress size={40} />
|
|
950
|
+
<CircularProgress variant="determinate" value={75} />
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
**Props:**
|
|
954
|
+
- `variant?: 'determinate' | 'indeterminate'` (default: 'indeterminate')
|
|
955
|
+
- `value?: number` - Progress value (0-100)
|
|
956
|
+
- `size?: number | string` - Spinner size
|
|
957
|
+
- `thickness?: number` - Stroke thickness
|
|
958
|
+
- `color?: 'primary' | 'secondary' | 'inherit'`
|
|
959
|
+
|
|
960
|
+
### EmptyState
|
|
961
|
+
Empty state placeholder.
|
|
962
|
+
|
|
963
|
+
```typescript
|
|
964
|
+
import { EmptyState } from '@cere/cere-design-system';
|
|
965
|
+
|
|
966
|
+
<EmptyState
|
|
967
|
+
title="No data"
|
|
968
|
+
description="There are no items to display"
|
|
969
|
+
icon={<InboxIcon />}
|
|
970
|
+
action={<Button>Add Item</Button>}
|
|
971
|
+
/>
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
**Props:**
|
|
975
|
+
- `title: string` - Empty state title
|
|
976
|
+
- `description?: string` - Description text
|
|
977
|
+
- `icon?: ReactNode` - Icon to display
|
|
978
|
+
- `action?: ReactNode` - Action button/component
|
|
979
|
+
|
|
980
|
+
### Loading
|
|
981
|
+
Loading state indicator.
|
|
982
|
+
|
|
983
|
+
```typescript
|
|
984
|
+
import { Loading } from '@cere/cere-design-system';
|
|
985
|
+
|
|
986
|
+
<Loading message="Loading data..." />
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
**Props:**
|
|
990
|
+
- `message?: string` - Loading message
|
|
991
|
+
- `size?: 'small' | 'medium' | 'large'`
|
|
992
|
+
|
|
993
|
+
### AppLoading
|
|
994
|
+
Full-screen app loading state.
|
|
995
|
+
|
|
996
|
+
```typescript
|
|
997
|
+
import { AppLoading } from '@cere/cere-design-system';
|
|
998
|
+
|
|
999
|
+
<AppLoading />
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
**Props:**
|
|
1003
|
+
- Minimal props - displays animated Cere logo
|
|
1004
|
+
|
|
1005
|
+
---
|
|
1006
|
+
|
|
1007
|
+
## UTILITIES
|
|
1008
|
+
|
|
1009
|
+
### Markdown
|
|
1010
|
+
Render markdown content with syntax highlighting.
|
|
1011
|
+
|
|
1012
|
+
```typescript
|
|
1013
|
+
import { Markdown } from '@cere/cere-design-system';
|
|
1014
|
+
|
|
1015
|
+
<Markdown content={markdownString} />
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
**Props:**
|
|
1019
|
+
- `content: string` - Markdown content to render
|
|
1020
|
+
- Uses `react-markdown` with `rehype-highlight` for code blocks
|
|
1021
|
+
- Supports GitHub-flavored markdown
|
|
1022
|
+
|
|
1023
|
+
### Truncate
|
|
1024
|
+
Truncate long text with ellipsis.
|
|
1025
|
+
|
|
1026
|
+
```typescript
|
|
1027
|
+
import { Truncate } from '@cere/cere-design-system';
|
|
1028
|
+
|
|
1029
|
+
<Truncate lines={2}>
|
|
1030
|
+
Very long text that will be truncated...
|
|
1031
|
+
</Truncate>
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
**Props:**
|
|
1035
|
+
- `lines?: number` - Number of lines to show (default: 1)
|
|
1036
|
+
- `children: string` - Text to truncate
|
|
1037
|
+
|
|
1038
|
+
### BytesSize
|
|
1039
|
+
Format bytes to human-readable size.
|
|
1040
|
+
|
|
1041
|
+
```typescript
|
|
1042
|
+
import { BytesSize } from '@cere/cere-design-system';
|
|
1043
|
+
|
|
1044
|
+
<BytesSize bytes={1024000} />
|
|
1045
|
+
// Displays: "1.02 MB"
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
**Props:**
|
|
1049
|
+
- `bytes: number` - Bytes to format
|
|
1050
|
+
|
|
1051
|
+
### QRCode
|
|
1052
|
+
Display QR code.
|
|
1053
|
+
|
|
1054
|
+
```typescript
|
|
1055
|
+
import { QRCode } from '@cere/cere-design-system';
|
|
1056
|
+
|
|
1057
|
+
<QRCode value="https://example.com" size={256} />
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
**Props:**
|
|
1061
|
+
- `value: string` - Data to encode
|
|
1062
|
+
- `size?: number` - QR code size in pixels (default: 128)
|
|
1063
|
+
- `level?: 'L' | 'M' | 'Q' | 'H'` - Error correction level
|
|
1064
|
+
- `bgColor?: string` - Background color
|
|
1065
|
+
- `fgColor?: string` - Foreground color
|
|
1066
|
+
|
|
1067
|
+
### OnboardingProvider
|
|
1068
|
+
Onboarding/tour provider.
|
|
1069
|
+
|
|
1070
|
+
```typescript
|
|
1071
|
+
import { OnboardingProvider, useOnboarding } from '@cere/cere-design-system';
|
|
1072
|
+
|
|
1073
|
+
<OnboardingProvider>
|
|
1074
|
+
<App />
|
|
1075
|
+
</OnboardingProvider>
|
|
1076
|
+
|
|
1077
|
+
// In component:
|
|
1078
|
+
const { startTour, currentStep } = useOnboarding();
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
---
|
|
1082
|
+
|
|
1083
|
+
## CHARTS
|
|
1084
|
+
|
|
1085
|
+
### ChartWidget
|
|
1086
|
+
Chart container with title and controls.
|
|
1087
|
+
|
|
1088
|
+
```typescript
|
|
1089
|
+
import { ChartWidget } from '@cere/cere-design-system';
|
|
1090
|
+
|
|
1091
|
+
<ChartWidget
|
|
1092
|
+
title="Sales Data"
|
|
1093
|
+
description="Monthly sales overview"
|
|
1094
|
+
action={<Button>Export</Button>}
|
|
1095
|
+
>
|
|
1096
|
+
<YourChart />
|
|
1097
|
+
</ChartWidget>
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
**Props:**
|
|
1101
|
+
- `title?: string` - Widget title
|
|
1102
|
+
- `description?: string` - Widget description
|
|
1103
|
+
- `action?: ReactNode` - Action button/component
|
|
1104
|
+
- `children: ReactNode` - Chart content
|
|
1105
|
+
|
|
1106
|
+
### MetricsChart
|
|
1107
|
+
Pre-built metrics chart with period selector.
|
|
1108
|
+
|
|
1109
|
+
```typescript
|
|
1110
|
+
import { MetricsChart, PeriodSelect } from '@cere/cere-design-system';
|
|
1111
|
+
import type { MetricsPeriod } from '@cere/cere-design-system';
|
|
1112
|
+
|
|
1113
|
+
<MetricsChart
|
|
1114
|
+
data={chartData}
|
|
1115
|
+
period="7d"
|
|
1116
|
+
onPeriodChange={(period) => setPeriod(period)}
|
|
1117
|
+
title="Metrics"
|
|
1118
|
+
/>
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
**Props:**
|
|
1122
|
+
- `data: any[]` - Chart data
|
|
1123
|
+
- `period?: MetricsPeriod` - Selected time period
|
|
1124
|
+
- `onPeriodChange?: (period) => void` - Period change handler
|
|
1125
|
+
- `title?: string` - Chart title
|
|
1126
|
+
- Uses MUI X-Charts internally
|
|
1127
|
+
|
|
1128
|
+
**MetricsPeriod:** `'24h' | '7d' | '30d' | '90d' | '1y'`
|
|
1129
|
+
|
|
1130
|
+
---
|
|
1131
|
+
|
|
1132
|
+
## THIRD-PARTY COMPONENTS
|
|
1133
|
+
|
|
1134
|
+
### FlowEditor
|
|
1135
|
+
Visual flow/graph editor (ReactFlow wrapper).
|
|
1136
|
+
|
|
1137
|
+
```typescript
|
|
1138
|
+
import { FlowEditor } from '@cere/cere-design-system';
|
|
1139
|
+
import type { Node, Edge, NodeTypes, ReactFlowInstance } from '@cere/cere-design-system';
|
|
1140
|
+
|
|
1141
|
+
const nodes: Node[] = [
|
|
1142
|
+
{ id: '1', position: { x: 0, y: 0 }, data: { label: 'Node 1' } }
|
|
1143
|
+
];
|
|
1144
|
+
const edges: Edge[] = [
|
|
1145
|
+
{ id: 'e1-2', source: '1', target: '2' }
|
|
1146
|
+
];
|
|
1147
|
+
|
|
1148
|
+
<FlowEditor
|
|
1149
|
+
nodes={nodes}
|
|
1150
|
+
edges={edges}
|
|
1151
|
+
onNodesChange={handleNodesChange}
|
|
1152
|
+
onEdgesChange={handleEdgesChange}
|
|
1153
|
+
height="600px"
|
|
1154
|
+
showBackground
|
|
1155
|
+
showControls
|
|
1156
|
+
showMinimap
|
|
1157
|
+
nodeTypes={customNodeTypes}
|
|
1158
|
+
/>
|
|
1159
|
+
```
|
|
1160
|
+
|
|
1161
|
+
**Props:**
|
|
1162
|
+
- `nodes: Node[]` - Flow nodes (required)
|
|
1163
|
+
- `edges: Edge[]` - Flow edges (required)
|
|
1164
|
+
- `onNodesChange?: OnNodesChange` - Nodes change handler
|
|
1165
|
+
- `onEdgesChange?: OnEdgesChange` - Edges change handler
|
|
1166
|
+
- `nodeTypes?: NodeTypes` - Custom node components
|
|
1167
|
+
- `edgeTypes?: EdgeTypes` - Custom edge components
|
|
1168
|
+
- `height?: string | number` (default: '600px')
|
|
1169
|
+
- `showBackground?: boolean` (default: true)
|
|
1170
|
+
- `backgroundVariant?: BackgroundVariant` (default: 'dots')
|
|
1171
|
+
- `showControls?: boolean` (default: true)
|
|
1172
|
+
- `showMinimap?: boolean` (default: false)
|
|
1173
|
+
- `containerProps?: BoxProps` - Container styling
|
|
1174
|
+
- `onInit?: (instance: ReactFlowInstance) => void` - Initialization callback
|
|
1175
|
+
- All ReactFlow props supported
|
|
1176
|
+
|
|
1177
|
+
**Re-exported from ReactFlow:**
|
|
1178
|
+
- `Background`, `Controls`, `MiniMap`, `Panel` components
|
|
1179
|
+
- `BackgroundVariant`, `ConnectionLineType` enums
|
|
1180
|
+
- `Node`, `Edge`, `NodeTypes`, `EdgeTypes`, `ReactFlowInstance` types
|
|
1181
|
+
- `OnNodesChange`, `OnEdgesChange` types
|
|
1182
|
+
|
|
1183
|
+
### CodeEditor
|
|
1184
|
+
Code editor with syntax highlighting (Monaco Editor wrapper).
|
|
1185
|
+
|
|
1186
|
+
```typescript
|
|
1187
|
+
import { CodeEditor } from '@cere/cere-design-system';
|
|
1188
|
+
import type { CodeEditorLanguage } from '@cere/cere-design-system';
|
|
1189
|
+
|
|
1190
|
+
<CodeEditor
|
|
1191
|
+
value={code}
|
|
1192
|
+
onChange={setCode}
|
|
1193
|
+
language="typescript"
|
|
1194
|
+
height="500px"
|
|
1195
|
+
onValidate={(markers) => console.log('Errors:', markers)}
|
|
1196
|
+
typeDefinitions={`
|
|
1197
|
+
declare interface CustomType {
|
|
1198
|
+
id: string;
|
|
1199
|
+
name: string;
|
|
1200
|
+
}
|
|
1201
|
+
`}
|
|
1202
|
+
/>
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
**Props:**
|
|
1206
|
+
- `value: string` - Editor content (required)
|
|
1207
|
+
- `onChange: (value: string) => void` - Change handler (required)
|
|
1208
|
+
- `language?: CodeEditorLanguage` (default: 'typescript')
|
|
1209
|
+
- Options: `'typescript' | 'javascript' | 'json' | 'html' | 'css' | 'python' | 'yaml' | 'markdown' | 'sql' | 'xml' | 'plaintext'`
|
|
1210
|
+
- `height?: string | number` (default: '400px')
|
|
1211
|
+
- `minHeight?: string | number` - Minimum height
|
|
1212
|
+
- `theme?: string` - Monaco theme ('light' | 'dark' | 'vs-dark' | 'hc-black')
|
|
1213
|
+
- `lineNumbers?: 'on' | 'off' | 'relative' | 'interval'` (default: 'on')
|
|
1214
|
+
- `options?: editor.IStandaloneEditorConstructionOptions` - Monaco editor options
|
|
1215
|
+
- `onMount?: (editor, monaco) => void` - Editor mounted callback
|
|
1216
|
+
- `onValidate?: (markers: editor.IMarker[]) => void` - Validation errors callback
|
|
1217
|
+
- `editorRef?: React.MutableRefObject<editor.IStandaloneCodeEditor | null>` - Editor instance ref
|
|
1218
|
+
- `monacoRef?: React.MutableRefObject<Monaco | null>` - Monaco instance ref
|
|
1219
|
+
- `onFullscreenChange?: (isFullscreen: boolean) => void` - Fullscreen state callback
|
|
1220
|
+
- `containerProps?: BoxProps` - Container styling
|
|
1221
|
+
- `typeDefinitions?: string | string[]` - Additional TypeScript type definitions
|
|
1222
|
+
|
|
1223
|
+
**Features:**
|
|
1224
|
+
- Fullscreen mode support
|
|
1225
|
+
- TypeScript validation and IntelliSense
|
|
1226
|
+
- Custom type definitions injection
|
|
1227
|
+
- Syntax highlighting for multiple languages
|
|
1228
|
+
- Error/warning markers display
|
|
1229
|
+
- Collapsible problems panel
|
|
1230
|
+
|
|
1231
|
+
---
|
|
1232
|
+
|
|
1233
|
+
## ICONS
|
|
1234
|
+
|
|
1235
|
+
The design system includes custom Cere-branded icons:
|
|
1236
|
+
|
|
1237
|
+
```typescript
|
|
1238
|
+
import {
|
|
1239
|
+
CereIcon,
|
|
1240
|
+
ActivityAppIcon,
|
|
1241
|
+
StorageAppIcon,
|
|
1242
|
+
DecentralizedServerIcon,
|
|
1243
|
+
CloudFlashIcon,
|
|
1244
|
+
BarTrackingIcon,
|
|
1245
|
+
GithubLogoIcon,
|
|
1246
|
+
DiscordIcon,
|
|
1247
|
+
ClockIcon,
|
|
1248
|
+
AvatarIcon,
|
|
1249
|
+
ShareIcon,
|
|
1250
|
+
DownloadIcon,
|
|
1251
|
+
UploadFileIcon,
|
|
1252
|
+
UploadFolderIcon,
|
|
1253
|
+
FolderIcon,
|
|
1254
|
+
FilledFolderIcon,
|
|
1255
|
+
ArrowLeft,
|
|
1256
|
+
ArrowRight
|
|
1257
|
+
} from '@cere/cere-design-system';
|
|
1258
|
+
|
|
1259
|
+
<CereIcon />
|
|
1260
|
+
<ActivityAppIcon />
|
|
1261
|
+
```
|
|
1262
|
+
|
|
1263
|
+
All icons are React components that accept standard SVG props (width, height, color, etc.).
|
|
1264
|
+
|
|
1265
|
+
---
|
|
1266
|
+
|
|
1267
|
+
## BEST PRACTICES
|
|
1268
|
+
|
|
1269
|
+
### Component Usage Guidelines
|
|
1270
|
+
|
|
1271
|
+
1. **Always wrap with ThemeProvider**: Ensure all components are wrapped with the Cere theme provider for consistent styling.
|
|
1272
|
+
|
|
1273
|
+
2. **Use TypeScript types**: Import and use the exported TypeScript types for better IDE support and type safety.
|
|
1274
|
+
```typescript
|
|
1275
|
+
import type { ButtonProps, TextFieldProps } from '@cere/cere-design-system';
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
3. **Responsive Design**: Use the responsive hooks (`useIsDesktop`, `useIsTablet`, `useIsMobile`) or Grid component for responsive layouts.
|
|
1279
|
+
|
|
1280
|
+
4. **Form Validation**: Use TextField's `error` and `helperText` props for inline validation feedback.
|
|
1281
|
+
|
|
1282
|
+
5. **Loading States**: Use LoadingButton for async actions and Loading/CircularProgress for data fetching.
|
|
1283
|
+
|
|
1284
|
+
6. **Accessibility**:
|
|
1285
|
+
- Always provide `aria-label` for IconButtons
|
|
1286
|
+
- Use semantic HTML and proper heading hierarchy
|
|
1287
|
+
- Ensure sufficient color contrast
|
|
1288
|
+
- Support keyboard navigation
|
|
1289
|
+
|
|
1290
|
+
7. **Consistent Spacing**: Use the theme's spacing system (`theme.spacing(n)`) or sx prop for consistent spacing.
|
|
1291
|
+
|
|
1292
|
+
8. **Icon Usage**: Prefer custom Cere icons when available, otherwise use Material-UI icons.
|
|
1293
|
+
|
|
1294
|
+
9. **Error Handling**: Use Alert/Snackbar for user-facing error messages.
|
|
1295
|
+
|
|
1296
|
+
10. **Code Editing**: For any code input, use CodeEditor with appropriate language and type definitions.
|
|
1297
|
+
|
|
1298
|
+
### Common Patterns
|
|
1299
|
+
|
|
1300
|
+
**Form with Validation:**
|
|
1301
|
+
```typescript
|
|
1302
|
+
<form onSubmit={handleSubmit}>
|
|
1303
|
+
<Stack spacing={2}>
|
|
1304
|
+
<TextField
|
|
1305
|
+
label="Email"
|
|
1306
|
+
value={email}
|
|
1307
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
1308
|
+
error={!!errors.email}
|
|
1309
|
+
helperText={errors.email}
|
|
1310
|
+
required
|
|
1311
|
+
/>
|
|
1312
|
+
<LoadingButton
|
|
1313
|
+
type="submit"
|
|
1314
|
+
variant="primary"
|
|
1315
|
+
loading={isSubmitting}
|
|
1316
|
+
>
|
|
1317
|
+
Submit
|
|
1318
|
+
</LoadingButton>
|
|
1319
|
+
</Stack>
|
|
1320
|
+
</form>
|
|
1321
|
+
```
|
|
1322
|
+
|
|
1323
|
+
**Data Table with Actions:**
|
|
1324
|
+
```typescript
|
|
1325
|
+
<Card>
|
|
1326
|
+
<CardHeader title="Users" />
|
|
1327
|
+
<Table
|
|
1328
|
+
columns={columns}
|
|
1329
|
+
data={users}
|
|
1330
|
+
onSort={handleSort}
|
|
1331
|
+
/>
|
|
1332
|
+
</Card>
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
**Dashboard Layout:**
|
|
1336
|
+
```typescript
|
|
1337
|
+
<Container maxWidth="lg">
|
|
1338
|
+
<Grid container spacing={3}>
|
|
1339
|
+
<Grid item xs={12} md={6}>
|
|
1340
|
+
<ChartWidget title="Metrics">
|
|
1341
|
+
<MetricsChart data={data} />
|
|
1342
|
+
</ChartWidget>
|
|
1343
|
+
</Grid>
|
|
1344
|
+
<Grid item xs={12} md={6}>
|
|
1345
|
+
<Card>
|
|
1346
|
+
<CardContent>...</CardContent>
|
|
1347
|
+
</Card>
|
|
1348
|
+
</Grid>
|
|
1349
|
+
</Grid>
|
|
1350
|
+
</Container>
|
|
1351
|
+
```
|