@matteoaliano/forest-ui 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -0
- package/bin/sync.mjs +18 -34
- package/dist/{chunk-7B6NCKX3.mjs → chunk-EULMNCHH.mjs} +1039 -498
- package/dist/chunk-EULMNCHH.mjs.map +1 -0
- package/dist/{index-DiI9xbOM.d.mts → index-EkBIDmEu.d.mts} +109 -12
- package/dist/{index-DiI9xbOM.d.ts → index-EkBIDmEu.d.ts} +109 -12
- package/dist/index.d.mts +83 -20
- package/dist/index.d.ts +83 -20
- package/dist/index.js +1306 -571
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +233 -69
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1039 -497
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1 -1
- package/guidelines/FOREST_BE_GUIDELINES.md +90 -0
- package/guidelines/FOREST_FE_GUIDELINES.md +543 -0
- package/guidelines/FOREST_UI_GUIDELINES.md +372 -0
- package/package.json +16 -4
- package/dist/chunk-7B6NCKX3.mjs.map +0 -1
- package/guidelines/FOREST_AI_GUIDELINES.md +0 -344
- package/guidelines/FOREST_DEV_GUIDELINES.md +0 -47
- package/guidelines/themes/FOREST_THEME_ALKEMY_PLUS.md +0 -139
- package/guidelines/themes/FOREST_THEME_DEFAULT.md +0 -70
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
# Forest UI — AI Development Guidelines
|
|
2
|
-
|
|
3
|
-
> **forest-ui v0.2.10**
|
|
4
|
-
|
|
5
|
-
> **This file is auto-generated from the `forest-ui` package.**
|
|
6
|
-
> Run `npx forest-ui sync` to update it.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 1. Golden Rules
|
|
11
|
-
|
|
12
|
-
1. **NEVER import from `@mui/material` directly.** Always import from `forest-ui`.
|
|
13
|
-
2. **ALWAYS wrap your app root with `<ForestProvider>`** — it applies the theme and CSS baseline.
|
|
14
|
-
3. **NEVER use inline colors or spacing values.** Use the exported design tokens or MUI's `sx` prop with theme values.
|
|
15
|
-
4. **NEVER create custom component wrappers** for things Forest UI already provides.
|
|
16
|
-
5. **TypeScript is required.** All components export their prop types.
|
|
17
|
-
6. **ALWAYS use the Outlined variant of MUI icons.** Import from `@mui/icons-material/*Outlined` (e.g. `CloseOutlined`, `MailOutlined`). Never use the default (filled), Rounded, Sharp, or TwoTone variants.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 2. Installation & Setup
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm install @matteoaliano/forest-ui @mui/material @mui/x-data-grid @emotion/react @emotion/styled
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
// App root — REQUIRED
|
|
29
|
-
import { ForestProvider } from "@matteoaliano/forest-ui";
|
|
30
|
-
|
|
31
|
-
function App() {
|
|
32
|
-
return (
|
|
33
|
-
<ForestProvider>
|
|
34
|
-
{/* All app content here */}
|
|
35
|
-
</ForestProvider>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 3. Component Reference
|
|
43
|
-
|
|
44
|
-
### Import Pattern
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
// ✅ CORRECT — import from forest-ui
|
|
48
|
-
import { Button, TextField, Alert } from "@matteoaliano/forest-ui";
|
|
49
|
-
|
|
50
|
-
// ❌ WRONG — never import from @mui/material
|
|
51
|
-
import Button from "@mui/material/Button";
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Available Components
|
|
55
|
-
|
|
56
|
-
#### Inputs
|
|
57
|
-
| Component | Import | Key Props |
|
|
58
|
-
|-----------|--------|-----------|
|
|
59
|
-
| `Button` | `import { Button } from "@matteoaliano/forest-ui"` | `variant: "contained" \| "outlined" \| "text"`, `size`, `color`, `disabled` |
|
|
60
|
-
| `ButtonGroup` | `import { ButtonGroup } from "@matteoaliano/forest-ui"` | `variant`, `size`, `orientation` |
|
|
61
|
-
| `TextField` | `import { TextField } from "@matteoaliano/forest-ui"` | `variant`, `size`, `label`, `error`, `helperText`, `fullWidth` |
|
|
62
|
-
| `Select` | `import { Select, MenuItem } from "@matteoaliano/forest-ui"` | `label`, `value`, `onChange` |
|
|
63
|
-
| `Checkbox` | `import { Checkbox } from "@matteoaliano/forest-ui"` | `checked`, `onChange`, `disabled` |
|
|
64
|
-
| `RadioGroup` + `Radio` | `import { RadioGroup, Radio } from "@matteoaliano/forest-ui"` | `value`, `onChange`, `row` |
|
|
65
|
-
| `Switch` | `import { Switch } from "@matteoaliano/forest-ui"` | `checked`, `onChange`, `disabled` |
|
|
66
|
-
| `ToggleButton` + `ToggleButtonGroup` | `import { ToggleButton, ToggleButtonGroup } from "@matteoaliano/forest-ui"` | `value`, `exclusive`, `onChange` |
|
|
67
|
-
| `Fab` | `import { Fab } from "@matteoaliano/forest-ui"` | `variant: "circular" \| "extended"`, `size`, `color` |
|
|
68
|
-
| `Autocomplete` | `import { Autocomplete } from "@matteoaliano/forest-ui"` | `options`, `renderInput`, `freeSolo` |
|
|
69
|
-
|
|
70
|
-
#### Data Display
|
|
71
|
-
| Component | Import | Key Props |
|
|
72
|
-
|-----------|--------|-----------|
|
|
73
|
-
| `Badge` | `import { Badge } from "@matteoaliano/forest-ui"` | `badgeContent`, `color`, `variant: "standard" \| "dot"` |
|
|
74
|
-
| `Chip` | `import { Chip } from "@matteoaliano/forest-ui"` | `label`, `variant: "filled" \| "outlined"`, `onDelete`, `size` |
|
|
75
|
-
| `Divider` | `import { Divider } from "@matteoaliano/forest-ui"` | `orientation`, `variant`, `children` (for text dividers) |
|
|
76
|
-
| `Typography` | `import { Typography } from "@matteoaliano/forest-ui"` | `variant: "h1"-"h6" \| "subtitle1" \| "body1" \| "caption" \| "overline"` |
|
|
77
|
-
| `Tooltip` | `import { Tooltip } from "@matteoaliano/forest-ui"` | `title`, `placement`, `arrow` |
|
|
78
|
-
| `Table` family | `import { Table, TableHead, TableBody, TableRow, TableCell, TableContainer } from "@matteoaliano/forest-ui"` | Standard table composition |
|
|
79
|
-
| `DataGrid` | `import { DataGrid, type GridColDef } from "@matteoaliano/forest-ui"` | `rows`, `columns`, `paginationModel`, `sortModel`, `filterModel`. Requires `@mui/x-data-grid` peer dep |
|
|
80
|
-
| `List` family | `import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListItemAvatar, ListSubheader } from "@matteoaliano/forest-ui"` | Standard list composition |
|
|
81
|
-
|
|
82
|
-
#### Surfaces
|
|
83
|
-
| Component | Import | Key Props |
|
|
84
|
-
|-----------|--------|-----------|
|
|
85
|
-
| `Accordion` family | `import { Accordion, AccordionSummary, AccordionDetails, AccordionActions } from "@matteoaliano/forest-ui"` | `expanded`, `onChange`, `disabled` |
|
|
86
|
-
| `AppBar` + `Toolbar` | `import { AppBar, Toolbar } from "@matteoaliano/forest-ui"` | `position`, `color`, `elevation` |
|
|
87
|
-
| `Card` family | `import { Card, CardContent, CardHeader, CardActions, CardMedia } from "@matteoaliano/forest-ui"` | `variant`, `elevation` |
|
|
88
|
-
| `Paper` | `import { Paper } from "@matteoaliano/forest-ui"` | `variant`, `elevation`, `square` |
|
|
89
|
-
|
|
90
|
-
#### Feedback
|
|
91
|
-
| Component | Import | Key Props |
|
|
92
|
-
|-----------|--------|-----------|
|
|
93
|
-
| `Alert` + `AlertTitle` | `import { Alert, AlertTitle } from "@matteoaliano/forest-ui"` | `severity: "success" \| "info" \| "warning" \| "error"`, `variant` |
|
|
94
|
-
| `Dialog` family | `import { Dialog, DialogTitle, DialogContent, DialogActions, DialogContentText } from "@matteoaliano/forest-ui"` | `open`, `onClose` |
|
|
95
|
-
| `Backdrop` | `import { Backdrop } from "@matteoaliano/forest-ui"` | `open`, `onClick` |
|
|
96
|
-
| `LinearProgress` | `import { LinearProgress } from "@matteoaliano/forest-ui"` | `variant: "indeterminate" \| "determinate"`, `value` |
|
|
97
|
-
| `CircularProgress` | `import { CircularProgress } from "@matteoaliano/forest-ui"` | `variant: "indeterminate" \| "determinate"`, `value` |
|
|
98
|
-
| `Skeleton` | `import { Skeleton } from "@matteoaliano/forest-ui"` | `variant: "text" \| "circular" \| "rectangular" \| "rounded"`, `width`, `height` |
|
|
99
|
-
| `Snackbar` | `import { Snackbar } from "@matteoaliano/forest-ui"` | `open`, `autoHideDuration`, `onClose`, `message` |
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## 4. Theme & Design Tokens
|
|
104
|
-
|
|
105
|
-
### Accessing Tokens
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
// Method 1: Via the sx prop (preferred)
|
|
109
|
-
<Box sx={{ p: 2, borderRadius: 2, color: "text.primary" }} />
|
|
110
|
-
|
|
111
|
-
// Method 2: Import raw token values (rare, for edge cases)
|
|
112
|
-
import { colors, spacing, radius } from "@matteoaliano/forest-ui";
|
|
113
|
-
|
|
114
|
-
// Method 3: Import semantic tokens (text, bg, fg, border)
|
|
115
|
-
import { text, bg, fg, border } from "@matteoaliano/forest-ui";
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Color Palette
|
|
119
|
-
|
|
120
|
-
| Token | Value | Usage |
|
|
121
|
-
|-------|-------|-------|
|
|
122
|
-
| `primary.main` | `#7f56d9` (brand.600) | Primary actions, links, active states |
|
|
123
|
-
| `primary.light` | `#b692f6` (brand.400) | Hover states |
|
|
124
|
-
| `primary.dark` | `#6941c6` (brand.700) | Pressed states |
|
|
125
|
-
| `secondary.main` | `#475467` (gray.600) | Secondary actions |
|
|
126
|
-
| `error.main` | `#d92d20` (error.600) | Destructive actions, error states |
|
|
127
|
-
| `warning.main` | `#dc6803` (warning.600) | Warnings |
|
|
128
|
-
| `success.main` | `#079455` (success.600) | Success states |
|
|
129
|
-
| `info.main` | `#1570ef` (blue.600) | Informational |
|
|
130
|
-
| `text.primary` | `#101828` (gray.900) | Main text |
|
|
131
|
-
| `text.secondary` | `#344054` (gray.700) | Supporting text |
|
|
132
|
-
| `background.default` | `#ffffff` | Page background |
|
|
133
|
-
| `background.paper` | `#ffffff` | Card/surface background |
|
|
134
|
-
| `divider` | `#eaecf0` (gray.200) | Borders and dividers |
|
|
135
|
-
|
|
136
|
-
### Spacing Scale
|
|
137
|
-
|
|
138
|
-
Use the MUI spacing multiplier: `theme.spacing(1) = 4px`
|
|
139
|
-
|
|
140
|
-
| Token | px | Usage |
|
|
141
|
-
|-------|-----|-------|
|
|
142
|
-
| `spacing(1)` | 4px | Tight gaps |
|
|
143
|
-
| `spacing(2)` | 8px | Component internal padding |
|
|
144
|
-
| `spacing(3)` | 12px | Small gaps |
|
|
145
|
-
| `spacing(4)` | 16px | Standard section spacing |
|
|
146
|
-
| `spacing(6)` | 24px | Medium section spacing |
|
|
147
|
-
| `spacing(8)` | 32px | Large section spacing |
|
|
148
|
-
|
|
149
|
-
### Border Radius
|
|
150
|
-
|
|
151
|
-
| Token | Value | Usage |
|
|
152
|
-
|-------|-------|-------|
|
|
153
|
-
| `borderRadius: 1` | 4px | Small elements (chips, badges) |
|
|
154
|
-
| `borderRadius: 2` | 8px | Buttons, inputs |
|
|
155
|
-
| `borderRadius: 3` | 12px | Cards, dialogs |
|
|
156
|
-
|
|
157
|
-
### Semantic Tokens
|
|
158
|
-
|
|
159
|
-
Forest UI exports semantic color maps for precise control beyond the MUI palette:
|
|
160
|
-
|
|
161
|
-
| Export | Purpose | Example keys |
|
|
162
|
-
|--------|---------|-------------|
|
|
163
|
-
| `text` | Text colors | `primary`, `secondary`, `tertiary`, `disabled`, `brandPrimary`, `errorPrimary` |
|
|
164
|
-
| `bg` | Background colors | `primary`, `secondary`, `brandSolid`, `errorPrimary`, `overlay` |
|
|
165
|
-
| `fg` | Foreground/icon colors | `primary`, `secondary`, `brandPrimary`, `errorPrimary`, `disabled` |
|
|
166
|
-
| `border` | Border colors | `primary`, `secondary`, `brand`, `brandSolid`, `error` |
|
|
167
|
-
| `buttonColors` | Button variants | `primary`, `secondary`, `secondaryColor`, `tertiary`, `primaryError` |
|
|
168
|
-
| `chartColors` | Chart/data viz | `series1Fg`, `series2Fg`, `axisFg`, `tooltipBg` |
|
|
169
|
-
|
|
170
|
-
### Preset System
|
|
171
|
-
|
|
172
|
-
For advanced theming, Forest UI supports presets — named theme variants built from a full `DesignTokens` object:
|
|
173
|
-
|
|
174
|
-
```tsx
|
|
175
|
-
import { ForestProvider, buildTheme, registerPreset } from "@matteoaliano/forest-ui";
|
|
176
|
-
|
|
177
|
-
// Use a preset by name
|
|
178
|
-
<ForestProvider preset="forest" variant="light">
|
|
179
|
-
{children}
|
|
180
|
-
</ForestProvider>
|
|
181
|
-
|
|
182
|
-
// Or build a custom theme from tokens
|
|
183
|
-
const customTheme = buildTheme(myDesignTokens);
|
|
184
|
-
<ForestProvider theme={customTheme}>
|
|
185
|
-
{children}
|
|
186
|
-
</ForestProvider>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## 5. Code Patterns
|
|
192
|
-
|
|
193
|
-
### Form Layout
|
|
194
|
-
|
|
195
|
-
```tsx
|
|
196
|
-
import { TextField, Button, Select, MenuItem, Checkbox } from "@matteoaliano/forest-ui";
|
|
197
|
-
import Box from "@mui/material/Box"; // Box, Stack, Grid are OK from MUI
|
|
198
|
-
|
|
199
|
-
function ContactForm() {
|
|
200
|
-
return (
|
|
201
|
-
<Box sx={{ display: "flex", flexDirection: "column", gap: 3 }}>
|
|
202
|
-
<TextField label="Name" fullWidth />
|
|
203
|
-
<TextField label="Email" type="email" fullWidth />
|
|
204
|
-
<Select label="Subject" fullWidth>
|
|
205
|
-
<MenuItem value="support">Support</MenuItem>
|
|
206
|
-
<MenuItem value="sales">Sales</MenuItem>
|
|
207
|
-
</Select>
|
|
208
|
-
<Button variant="contained" type="submit">
|
|
209
|
-
Send
|
|
210
|
-
</Button>
|
|
211
|
-
</Box>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Data Table
|
|
217
|
-
|
|
218
|
-
```tsx
|
|
219
|
-
import {
|
|
220
|
-
Table, TableContainer, TableHead, TableBody, TableRow, TableCell,
|
|
221
|
-
} from "@matteoaliano/forest-ui";
|
|
222
|
-
|
|
223
|
-
function UsersTable({ users }) {
|
|
224
|
-
return (
|
|
225
|
-
<TableContainer>
|
|
226
|
-
<Table>
|
|
227
|
-
<TableHead>
|
|
228
|
-
<TableRow>
|
|
229
|
-
<TableCell>Name</TableCell>
|
|
230
|
-
<TableCell>Email</TableCell>
|
|
231
|
-
</TableRow>
|
|
232
|
-
</TableHead>
|
|
233
|
-
<TableBody>
|
|
234
|
-
{users.map((u) => (
|
|
235
|
-
<TableRow key={u.id}>
|
|
236
|
-
<TableCell>{u.name}</TableCell>
|
|
237
|
-
<TableCell>{u.email}</TableCell>
|
|
238
|
-
</TableRow>
|
|
239
|
-
))}
|
|
240
|
-
</TableBody>
|
|
241
|
-
</Table>
|
|
242
|
-
</TableContainer>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### DataGrid
|
|
248
|
-
|
|
249
|
-
```tsx
|
|
250
|
-
import { DataGrid, type GridColDef } from "@matteoaliano/forest-ui";
|
|
251
|
-
|
|
252
|
-
const columns: GridColDef[] = [
|
|
253
|
-
{ field: "id", headerName: "ID", width: 70 },
|
|
254
|
-
{ field: "name", headerName: "Name", flex: 1 },
|
|
255
|
-
{ field: "email", headerName: "Email", flex: 1 },
|
|
256
|
-
];
|
|
257
|
-
|
|
258
|
-
function UsersGrid({ rows }) {
|
|
259
|
-
return <DataGrid rows={rows} columns={columns} />;
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
### Feedback Pattern
|
|
264
|
-
|
|
265
|
-
```tsx
|
|
266
|
-
import { Alert, AlertTitle, Snackbar } from "@matteoaliano/forest-ui";
|
|
267
|
-
|
|
268
|
-
// Inline feedback
|
|
269
|
-
<Alert severity="error">
|
|
270
|
-
<AlertTitle>Error</AlertTitle>
|
|
271
|
-
Something went wrong.
|
|
272
|
-
</Alert>
|
|
273
|
-
|
|
274
|
-
// Toast notification
|
|
275
|
-
<Snackbar open={open} autoHideDuration={4000} onClose={handleClose}>
|
|
276
|
-
<Alert severity="success" variant="filled">Saved!</Alert>
|
|
277
|
-
</Snackbar>
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Confirmation Dialog
|
|
281
|
-
|
|
282
|
-
```tsx
|
|
283
|
-
import { Dialog, DialogTitle, DialogContent, DialogActions, DialogContentText, Button } from "@matteoaliano/forest-ui";
|
|
284
|
-
|
|
285
|
-
function ConfirmDialog({ open, onClose, onConfirm }) {
|
|
286
|
-
return (
|
|
287
|
-
<Dialog open={open} onClose={onClose}>
|
|
288
|
-
<DialogTitle>Confirm</DialogTitle>
|
|
289
|
-
<DialogContent>
|
|
290
|
-
<DialogContentText>Are you sure?</DialogContentText>
|
|
291
|
-
</DialogContent>
|
|
292
|
-
<DialogActions>
|
|
293
|
-
<Button variant="outlined" onClick={onClose}>Cancel</Button>
|
|
294
|
-
<Button onClick={onConfirm}>Confirm</Button>
|
|
295
|
-
</DialogActions>
|
|
296
|
-
</Dialog>
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## 6. Anti-Patterns
|
|
304
|
-
|
|
305
|
-
```tsx
|
|
306
|
-
// ❌ WRONG: importing from @mui/material
|
|
307
|
-
import Button from "@mui/material/Button";
|
|
308
|
-
|
|
309
|
-
// ❌ WRONG: hardcoded colors
|
|
310
|
-
<Box sx={{ backgroundColor: "#7f56d9" }} />
|
|
311
|
-
|
|
312
|
-
// ❌ WRONG: hardcoded spacing
|
|
313
|
-
<Box sx={{ padding: "16px" }} />
|
|
314
|
-
|
|
315
|
-
// ❌ WRONG: forgetting ForestProvider
|
|
316
|
-
ReactDOM.render(<App />, root); // theme won't apply
|
|
317
|
-
|
|
318
|
-
// ❌ WRONG: using filled (default) icons
|
|
319
|
-
import CloseIcon from "@mui/icons-material/Close";
|
|
320
|
-
|
|
321
|
-
// ✅ CORRECT: always use Outlined variant
|
|
322
|
-
import CloseIcon from "@mui/icons-material/CloseOutlined";
|
|
323
|
-
|
|
324
|
-
// ✅ CORRECT: use theme tokens
|
|
325
|
-
<Box sx={{ backgroundColor: "primary.main", p: 4 }} />
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
> **Note:** Layout primitives like `Box`, `Stack`, `Grid`, and `Container` should still be imported from `@mui/material` — Forest UI does not re-export these because they have no custom styling.
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
|
-
## 7. TypeScript Props
|
|
333
|
-
|
|
334
|
-
Every component exports its props type:
|
|
335
|
-
|
|
336
|
-
```tsx
|
|
337
|
-
import { Button, type ButtonProps } from "@matteoaliano/forest-ui";
|
|
338
|
-
|
|
339
|
-
interface MyButtonProps extends ButtonProps {
|
|
340
|
-
analyticsId: string;
|
|
341
|
-
}
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Forest UI — Development Best Practices
|
|
2
|
-
|
|
3
|
-
> **forest-ui v0.2.10**
|
|
4
|
-
|
|
5
|
-
> **This file is synced by the `forest-ui` package.**
|
|
6
|
-
> Run `npx forest-ui sync` to update it.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
When generating code or suggesting solutions for Next.js projects, always follow these principles and best practices:
|
|
11
|
-
|
|
12
|
-
Separation of Concerns
|
|
13
|
-
Maintain a clear separation between presentation logic, business logic, and data management. Organize code into meaningful modules and folders (e.g., pages, components, lib, api).
|
|
14
|
-
|
|
15
|
-
Single Responsibility Principle
|
|
16
|
-
Each component, hook, or function must have a single, well-defined purpose. Avoid components or modules that handle multiple responsibilities simultaneously.
|
|
17
|
-
|
|
18
|
-
Clean Code and Naming Conventions
|
|
19
|
-
Write readable code with descriptive names for variables, functions, and components. Use consistent conventions:
|
|
20
|
-
|
|
21
|
-
camelCase for functions and variables.
|
|
22
|
-
|
|
23
|
-
PascalCase for components.
|
|
24
|
-
|
|
25
|
-
kebab-case for files.
|
|
26
|
-
|
|
27
|
-
Component Reusability
|
|
28
|
-
Build generic and reusable components. Avoid duplicating logic or UI. If a pattern repeats, consider extracting it into a shared component.
|
|
29
|
-
|
|
30
|
-
Consistent Data Flow
|
|
31
|
-
Maintain a clear and predictable data flow (top-down). If necessary, use the Context API or global states carefully, documenting the flow.
|
|
32
|
-
|
|
33
|
-
Predictable States
|
|
34
|
-
Manage states clearly and consistently. Use useState, useReducer, or global state libraries (like Zustand or Redux) only when necessary, ensuring every change is traceable and understandable.
|
|
35
|
-
|
|
36
|
-
Final Output
|
|
37
|
-
The generated code must be:
|
|
38
|
-
|
|
39
|
-
Readable and easily maintainable.
|
|
40
|
-
|
|
41
|
-
Compliant with Next.js conventions.
|
|
42
|
-
|
|
43
|
-
Easily testable.
|
|
44
|
-
|
|
45
|
-
Integratable into an existing project without conflicts.
|
|
46
|
-
|
|
47
|
-
If asked to write code, always include brief but helpful comments explaining what important sections do.
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# Forest UI — Alkemy+ Theme Guidelines
|
|
2
|
-
|
|
3
|
-
> **forest-ui v0.2.10**
|
|
4
|
-
|
|
5
|
-
> **This file is synced by the `forest-ui` package.**
|
|
6
|
-
> Run `npx forest-ui sync` to update it.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Theme Overview
|
|
11
|
-
|
|
12
|
-
The **Alkemy+** preset (`preset="alkemy-plus"`) applies Alkemy+ brand identity on top of the shared Forest layout system. It uses **black as the primary action color** and **red (`#F04040`) as the secondary accent**, with warm-neutral grays. Spacing, radius, typography, and shadows are identical to the default Forest theme.
|
|
13
|
-
|
|
14
|
-
### Activation
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
<ForestProvider preset="alkemy-plus">
|
|
18
|
-
<App />
|
|
19
|
-
</ForestProvider>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or build a standalone MUI theme:
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
import { alkemyPlusPreset, buildTheme } from "@matteoaliano/forest-ui";
|
|
26
|
-
|
|
27
|
-
const theme = buildTheme(alkemyPlusPreset.variants.light.tokens);
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Color Strategy
|
|
33
|
-
|
|
34
|
-
### Primary = Black
|
|
35
|
-
|
|
36
|
-
The `colors.brand` scale is a **black/dark neutral ramp**. This means:
|
|
37
|
-
|
|
38
|
-
- **Primary buttons** (`variant="contained"`) → black background, white text
|
|
39
|
-
- **`palette.primary.main`** → `#1A1A1A`
|
|
40
|
-
- **`bg.brandSolid`** → `#1A1A1A` (dark fills, hero sections)
|
|
41
|
-
|
|
42
|
-
### Secondary = Red (`#F04040`)
|
|
43
|
-
|
|
44
|
-
Red is the **accent/highlight** color, used for interactive states and visual emphasis:
|
|
45
|
-
|
|
46
|
-
- **Focus rings** → red tint
|
|
47
|
-
- **Checkboxes, radios, switches** (checked state) → red
|
|
48
|
-
- **Selected list items, toggle buttons** → red tint background
|
|
49
|
-
- **Outlined accent buttons** (`secondaryColor`) → red text and border
|
|
50
|
-
- **Sliders** → red handle
|
|
51
|
-
- **Brand semantic tokens** (`fg.brandPrimary`, `bg.brandPrimary`, `border.brand`) → red
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Color Palette
|
|
56
|
-
|
|
57
|
-
### Brand Scale (Black — Primary)
|
|
58
|
-
|
|
59
|
-
| Token | HEX | Role |
|
|
60
|
-
|---|---|---|
|
|
61
|
-
| `brand.600` | `#1A1A1A` | Primary buttons, solid fills |
|
|
62
|
-
| `brand.700` | `#0D0D0D` | Hover state for primary actions |
|
|
63
|
-
| `brand.500` | `#404040` | Mid-tone dark |
|
|
64
|
-
| `brand.100` | `#EBEBEB` | Subtle brand backgrounds |
|
|
65
|
-
| `brand.50` | `#F5F5F5` | Lightest brand tint |
|
|
66
|
-
|
|
67
|
-
### Red Accent (Secondary)
|
|
68
|
-
|
|
69
|
-
| Token path | HEX | Role |
|
|
70
|
-
|---|---|---|
|
|
71
|
-
| `fg.brandPrimary` | `#DC2626` | Accent foreground (checkboxes, switches, icons) |
|
|
72
|
-
| `bg.brandPrimary` | `#FEF2F2` | Selected/active state background |
|
|
73
|
-
| `border.brand` | `#FCA5A5` | Accent borders (outlined accent buttons) |
|
|
74
|
-
| `border.brandSolid` | `#DC2626` | Strong accent border |
|
|
75
|
-
|
|
76
|
-
### Gray Scale (Warm Neutrals)
|
|
77
|
-
|
|
78
|
-
| Token | HEX | Role |
|
|
79
|
-
|---|---|---|
|
|
80
|
-
| `gray.50` | `#FAF9F8` | Page background |
|
|
81
|
-
| `gray.100` | `#F5F3F1` | Tertiary backgrounds |
|
|
82
|
-
| `gray.300` | `#D8D8DC` | Borders |
|
|
83
|
-
| `gray.400` | `#A0A0A6` | Muted foreground |
|
|
84
|
-
| `gray.700` | `#3F3F46` | Secondary text |
|
|
85
|
-
| `gray.900` | `#18181B` | Primary text |
|
|
86
|
-
|
|
87
|
-
### Accent / Gradient Colors
|
|
88
|
-
|
|
89
|
-
These colors from the Alkemy+ palette are available for gradients, illustrations, and data visualization but are **not** mapped to semantic tokens:
|
|
90
|
-
|
|
91
|
-
| Name | HEX | Suggested Use |
|
|
92
|
-
|---|---|---|
|
|
93
|
-
| Magenta | `#D83070` | Gradients, decorative accents |
|
|
94
|
-
| Violet | `#7040C8` | Gradients, chart series |
|
|
95
|
-
| Orange | `#F08828` | Gradients, chart series |
|
|
96
|
-
| Yellow | `#F0C800` | Gradients, highlights |
|
|
97
|
-
| Muted Pink | `#D89898` | Soft accents, illustration fills |
|
|
98
|
-
|
|
99
|
-
### Functional Colors
|
|
100
|
-
|
|
101
|
-
| Status | Source | Notes |
|
|
102
|
-
|---|---|---|
|
|
103
|
-
| **Error** | Forest defaults (red) | Standard UX — unchanged |
|
|
104
|
-
| **Warning** | Orange scale (`#F08828` base) | Alkemy+ orange/yellow tones |
|
|
105
|
-
| **Success** | Forest defaults (green) | Standard UX — unchanged |
|
|
106
|
-
| **Info (blue)** | Forest defaults (blue) | Standard UX — unchanged |
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Background Usage
|
|
111
|
-
|
|
112
|
-
Background tokens follow the same hierarchy as the default Forest theme. The only visual difference is the **warm undertone** in gray surfaces.
|
|
113
|
-
|
|
114
|
-
| Context | Token | Value |
|
|
115
|
-
|---|---|---|
|
|
116
|
-
| Page background | `bg.primary` | `#FAF9F8` (warm Gray 50) |
|
|
117
|
-
| Elevated surface | `bg.secondary` | `#FFFFFF` |
|
|
118
|
-
| Inset | `bg.tertiary` | `#F5F3F1` (warm Gray 100) |
|
|
119
|
-
| Brand solid | `bg.brandSolid` | `#1A1A1A` (brand 600 — black) |
|
|
120
|
-
| Brand section | `bg.brandSection` | `#050505` (brand 800 — near-black) |
|
|
121
|
-
| Accent tint | `bg.brandPrimary` | `#FEF2F2` (red 50 — subtle red) |
|
|
122
|
-
|
|
123
|
-
> [!IMPORTANT]
|
|
124
|
-
> Always use semantic tokens (`bg.primary`, `bg.brandSolid`, etc.) — never hard-code hex values. This ensures correct rendering across all theme presets.
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## Key Differences from Default Theme
|
|
129
|
-
|
|
130
|
-
| Aspect | Default (Forest) | Alkemy+ |
|
|
131
|
-
|---|---|---|
|
|
132
|
-
| Primary action | Purple (`#7F56D9`) | Black (`#1A1A1A`) |
|
|
133
|
-
| Accent / secondary | Purple (same as primary) | Red (`#F04040`) |
|
|
134
|
-
| Gray tone | Cool blue-gray | Warm neutral |
|
|
135
|
-
| Warning palette | Amber/gold | Orange (`#F08828` base) |
|
|
136
|
-
| Focus rings | Purple tint | Red tint |
|
|
137
|
-
| Layout & spacing | Shared | Shared |
|
|
138
|
-
| Typography | Poppins | Poppins |
|
|
139
|
-
| Shadows | Shared | Shared |
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Forest UI — Default Theme Guidelines
|
|
2
|
-
|
|
3
|
-
> **forest-ui v0.2.10**
|
|
4
|
-
|
|
5
|
-
> **This file is synced by the `forest-ui` package.**
|
|
6
|
-
> Run `npx forest-ui sync` to update it.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Background Usage
|
|
11
|
-
|
|
12
|
-
### Page & Layout Defaults
|
|
13
|
-
|
|
14
|
-
| Context | Token | Value | Usage |
|
|
15
|
-
|---|---|---|---|
|
|
16
|
-
| **Page background** | `bg.primary` | `#f9fafb` (Gray 50) | Default background for every page and top-level layout. All root containers (`<body>`, app shell, page wrappers) must use this token. |
|
|
17
|
-
| **Page background (alt)** | `bg.primaryAlt` | `#f9fafb` (Gray 50) | Alias available when a future theme overrides the primary page bg. Use interchangeably with `bg.primary` in layouts. |
|
|
18
|
-
|
|
19
|
-
> [!IMPORTANT]
|
|
20
|
-
> Every page **must** set its root background to `bg.primary`. Never hard-code `#f9fafb` or any other color — always reference the semantic token so themes can override it.
|
|
21
|
-
|
|
22
|
-
### Surface Hierarchy
|
|
23
|
-
|
|
24
|
-
Use progressively deeper background tokens to create visual depth between nested surfaces:
|
|
25
|
-
|
|
26
|
-
| Level | Token | Typical Use |
|
|
27
|
-
|---|---|---|
|
|
28
|
-
| 0 — Page | `bg.primary` | Page canvas, app shell |
|
|
29
|
-
| 1 — Elevated surface | `bg.secondary` / `bg.secondaryAlt` | Cards, papers, sidebar panels — white surfaces that sit on top of the gray page canvas |
|
|
30
|
-
| 1 — Section (subtle) | `bg.secondarySubtle` | Very light tinted sections (e.g., feature highlight rows) |
|
|
31
|
-
| 2 — Inset | `bg.tertiary` | Nested panels, code blocks, table header rows |
|
|
32
|
-
| 3 — Deepest inset | `bg.quaternary` | Skeleton loaders, deeply nested containers |
|
|
33
|
-
|
|
34
|
-
### Interactive & State Backgrounds
|
|
35
|
-
|
|
36
|
-
| Token | When to Use |
|
|
37
|
-
|---|---|
|
|
38
|
-
| `bg.primaryHover` | Hover state for items sitting on a `bg.primary` surface (e.g., table rows, list items) |
|
|
39
|
-
| `bg.secondaryHover` | Hover state for items on a `bg.secondary` surface |
|
|
40
|
-
| `bg.active` | Currently active/selected row or item |
|
|
41
|
-
| `bg.disabled` | Disabled inputs, cards, or interactive areas |
|
|
42
|
-
| `bg.disabledSubtle` | Lighter disabled state (e.g., toggle tracks, secondary disabled surfaces) |
|
|
43
|
-
|
|
44
|
-
### Brand Backgrounds
|
|
45
|
-
|
|
46
|
-
| Token | When to Use |
|
|
47
|
-
|---|---|
|
|
48
|
-
| `bg.brandPrimary` / `bg.brandPrimaryAlt` | Subtle brand-tinted surfaces (e.g., selected chip, promotion banner) |
|
|
49
|
-
| `bg.brandSecondary` | Slightly stronger brand tint (e.g., badge background, accent panel) |
|
|
50
|
-
| `bg.brandSolid` | Solid brand fill (e.g., primary CTA background) |
|
|
51
|
-
| `bg.brandSolidHover` | Hover state for `bg.brandSolid` elements |
|
|
52
|
-
| `bg.brandSection` / `bg.brandSectionSubtle` | Full-width brand sections (e.g., hero, footer band) |
|
|
53
|
-
|
|
54
|
-
### Feedback / Status Backgrounds
|
|
55
|
-
|
|
56
|
-
| Status | Primary | Secondary | Solid |
|
|
57
|
-
|---|---|---|---|
|
|
58
|
-
| Error | `bg.errorPrimary` | `bg.errorSecondary` | `bg.errorSolid` |
|
|
59
|
-
| Warning | `bg.warningPrimary` | `bg.warningSecondary` | `bg.warningSolid` |
|
|
60
|
-
| Success | `bg.successPrimary` | `bg.successSecondary` | `bg.successSolid` |
|
|
61
|
-
|
|
62
|
-
- **Primary** — subtle tinted banners and alert backgrounds
|
|
63
|
-
- **Secondary** — slightly stronger tint for emphasis
|
|
64
|
-
- **Solid** — filled badges, toasts, or status dots
|
|
65
|
-
|
|
66
|
-
### Overlay
|
|
67
|
-
|
|
68
|
-
| Token | When to Use |
|
|
69
|
-
|---|---|
|
|
70
|
-
| `bg.overlay` | Scrim behind modals and drawers (use with alpha transparency) |
|