@rebasepro/cli 0.4.0 → 0.6.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 +20 -28
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/skills.d.ts +1 -0
- package/dist/index.cjs +1843 -1414
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +1620 -1257
- package/dist/index.es.js.map +1 -1
- package/dist/utils/package-manager.d.ts +2 -0
- package/package.json +15 -13
- package/skills/rebase-api/SKILL.md +662 -0
- package/skills/rebase-api/references/.gitkeep +3 -0
- package/skills/rebase-auth/SKILL.md +1143 -0
- package/skills/rebase-auth/references/.gitkeep +3 -0
- package/skills/rebase-backend-postgres/SKILL.md +633 -0
- package/skills/rebase-backend-postgres/references/.gitkeep +3 -0
- package/skills/rebase-basics/SKILL.md +749 -0
- package/skills/rebase-basics/references/.gitkeep +3 -0
- package/skills/rebase-collections/SKILL.md +1328 -0
- package/skills/rebase-collections/references/.gitkeep +3 -0
- package/skills/rebase-cron-jobs/SKILL.md +699 -0
- package/skills/rebase-cron-jobs/references/.gitkeep +1 -0
- package/skills/rebase-custom-functions/SKILL.md +233 -0
- package/skills/rebase-deployment/SKILL.md +583 -0
- package/skills/rebase-deployment/references/.gitkeep +3 -0
- package/skills/rebase-design-language/SKILL.md +664 -0
- package/skills/rebase-email/SKILL.md +701 -0
- package/skills/rebase-email/references/.gitkeep +1 -0
- package/skills/rebase-entity-history/SKILL.md +485 -0
- package/skills/rebase-entity-history/references/.gitkeep +1 -0
- package/skills/rebase-local-env-setup/SKILL.md +189 -0
- package/skills/rebase-local-env-setup/references/.gitkeep +3 -0
- package/skills/rebase-realtime/SKILL.md +755 -0
- package/skills/rebase-realtime/references/.gitkeep +3 -0
- package/skills/rebase-sdk/SKILL.md +594 -0
- package/skills/rebase-sdk/references/.gitkeep +0 -0
- package/skills/rebase-storage/SKILL.md +765 -0
- package/skills/rebase-storage/references/.gitkeep +3 -0
- package/skills/rebase-studio/SKILL.md +746 -0
- package/skills/rebase-studio/references/.gitkeep +3 -0
- package/skills/rebase-ui-components/SKILL.md +1411 -0
- package/skills/rebase-ui-components/references/.gitkeep +3 -0
- package/skills/rebase-webhooks/SKILL.md +623 -0
- package/skills/rebase-webhooks/references/.gitkeep +1 -0
- package/templates/template/AGENTS.md +2 -0
- package/templates/template/CLAUDE.md +2 -0
- package/templates/template/ai-instructions.md +6 -3
- package/templates/template/backend/drizzle.config.ts +8 -5
- package/templates/template/backend/package.json +1 -1
- package/templates/template/backend/src/env.ts +1 -1
- package/templates/template/backend/src/index.ts +9 -6
- package/templates/template/config/collections/posts.ts +1 -1
- package/templates/template/config/collections/presets/blank/index.ts +3 -0
- package/templates/template/config/collections/presets/ecommerce/categories.ts +38 -0
- package/templates/template/config/collections/presets/ecommerce/index.ts +6 -0
- package/templates/template/config/collections/presets/ecommerce/orders.ts +64 -0
- package/templates/template/config/collections/presets/ecommerce/products.ts +62 -0
- package/templates/template/config/collections/users.ts +7 -10
- package/templates/template/docker-compose.yml +1 -1
- package/templates/template/frontend/package.json +2 -2
- package/templates/template/frontend/src/App.tsx +1 -7
- package/templates/template/frontend/vite.config.ts +0 -1
- package/templates/template/package.json +7 -0
- package/dist/commands/cli.test.d.ts +0 -1
- package/dist/commands/dev.test.d.ts +0 -1
- package/dist/commands/init.test.d.ts +0 -1
- package/dist/utils/package-manager.test.d.ts +0 -1
- package/dist/utils/project.test.d.ts +0 -1
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rebase-design-language
|
|
3
|
+
description: |
|
|
4
|
+
Comprehensive Rebase UI Design Language specification. Use this skill whenever building, modifying, or reviewing any UI view, custom page, or home page in a Rebase project. This skill covers the exact design tokens, color system, typography scale, spacing conventions, layout patterns, component usage rules, and common anti-patterns to avoid. Agents MUST read this skill before creating or modifying any visual UI.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rebase Design Language
|
|
8
|
+
|
|
9
|
+
This document is the single source of truth for the visual design language used across all Rebase applications. Every custom view, home page, dashboard, or UI component **must** follow these rules exactly.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Foundational Principle
|
|
14
|
+
|
|
15
|
+
> **The UI must look like it belongs to the Rebase admin panel, not a standalone landing page.**
|
|
16
|
+
|
|
17
|
+
Rebase applications render inside the Rebase Shell — an admin panel with a sidebar, top bar, and content area. Custom views must feel like a native part of this panel. They must **not** look like a marketing website, a Dribbble concept, or a standalone SaaS dashboard.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2. Component Library (`@rebasepro/ui`)
|
|
22
|
+
|
|
23
|
+
**MANDATORY**: Use `@rebasepro/ui` components for ALL UI elements. Never use raw HTML elements when a kit equivalent exists.
|
|
24
|
+
|
|
25
|
+
### Core Imports
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import {
|
|
29
|
+
// Layout
|
|
30
|
+
Card, Paper, Container, CenteredView,
|
|
31
|
+
// Typography
|
|
32
|
+
Typography, Markdown,
|
|
33
|
+
// Buttons
|
|
34
|
+
Button, IconButton, LoadingButton,
|
|
35
|
+
// Form Inputs
|
|
36
|
+
TextField, DebouncedTextField, TextareaAutosize,
|
|
37
|
+
Select, SelectItem, MultiSelect, Autocomplete,
|
|
38
|
+
Checkbox, BooleanSwitch, RadioGroup, Slider,
|
|
39
|
+
DateTimeField, ColorPicker, FileUpload,
|
|
40
|
+
// Dialogs & Overlays
|
|
41
|
+
Dialog, DialogTitle, DialogContent, DialogActions,
|
|
42
|
+
Menu, Menubar, MenuItem, Popover, Sheet,
|
|
43
|
+
// Data Display
|
|
44
|
+
Table, TableHeader, TableBody, TableRow, TableCell,
|
|
45
|
+
Tabs, Chip, Badge, Label, InfoLabel,
|
|
46
|
+
// Feedback
|
|
47
|
+
Tooltip, Skeleton, CircularProgress, Separator,
|
|
48
|
+
Alert, Collapse, ExpandablePanel,
|
|
49
|
+
// Other
|
|
50
|
+
Avatar, SearchBar, ErrorBoundary,
|
|
51
|
+
// Utilities
|
|
52
|
+
cls, defaultBorderMixin, cardMixin, cardClickableMixin, paperMixin,
|
|
53
|
+
// Icons (all from @rebasepro/ui)
|
|
54
|
+
ArrowRightIcon, AddIcon, DeleteIcon
|
|
55
|
+
} from "@rebasepro/ui";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### The `cls()` Utility
|
|
59
|
+
|
|
60
|
+
Always use `cls()` from `@rebasepro/ui` for combining class names. Never use template literals for conditional classes.
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
// ✅ CORRECT
|
|
64
|
+
<div className={cls("p-4 rounded-lg", isActive && "bg-primary/10")} />
|
|
65
|
+
|
|
66
|
+
// ❌ WRONG
|
|
67
|
+
<div className={`p-4 rounded-lg ${isActive ? "bg-primary/10" : ""}`} />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 3. Color System
|
|
73
|
+
|
|
74
|
+
### Design Token Scale
|
|
75
|
+
|
|
76
|
+
Rebase uses a carefully defined set of CSS custom properties. **Never invent arbitrary color values.** Always reference these tokens.
|
|
77
|
+
|
|
78
|
+
#### Primary & Secondary
|
|
79
|
+
|
|
80
|
+
| Token | Value | Usage |
|
|
81
|
+
|------------------------|--------------|------------------------------------------|
|
|
82
|
+
| `--color-primary` | `#0070F4` | Primary actions, links, focus rings |
|
|
83
|
+
| `--color-primary-light`| oklch derived| Lighter tint of primary |
|
|
84
|
+
| `--color-primary-dark` | oklch derived| Darker shade of primary |
|
|
85
|
+
| `--color-secondary` | `#FF5B79` | Secondary accent |
|
|
86
|
+
| `--color-primary-bg` | primary/0.1 | Subtle primary backgrounds |
|
|
87
|
+
|
|
88
|
+
#### Surface Scale (Neutrals)
|
|
89
|
+
|
|
90
|
+
The surface scale goes from `50` (lightest) to `950` (darkest):
|
|
91
|
+
|
|
92
|
+
| Token | Value | Light mode usage | Dark mode usage |
|
|
93
|
+
|--------------------|-------------|------------------------|------------------------|
|
|
94
|
+
| `surface-50` | `#fafafa` | Page background | — |
|
|
95
|
+
| `surface-100` | `#f5f5f5` | Subtle backgrounds | — |
|
|
96
|
+
| `surface-200` | `#e5e5e5` | Borders, dividers | — |
|
|
97
|
+
| `surface-300` | `#d4d4d4` | Hover borders | — |
|
|
98
|
+
| `surface-400` | `#a3a3a3` | Muted text, placeholders | — |
|
|
99
|
+
| `surface-500` | `#737373` | Secondary icons | Secondary icons |
|
|
100
|
+
| `surface-600` | `#404040` | — | Muted text, labels |
|
|
101
|
+
| `surface-700` | `#262626` | — | Borders, dividers |
|
|
102
|
+
| `surface-800` | `#111111` | — | Page background |
|
|
103
|
+
| `surface-900` | `#0a0a0a` | — | Card backgrounds |
|
|
104
|
+
| `surface-950` | `#000000` | — | Deepest backgrounds |
|
|
105
|
+
|
|
106
|
+
#### Surface Accent Scale (Blue-tinted neutrals)
|
|
107
|
+
|
|
108
|
+
Used for subtle interactive backgrounds and input fields. Full 50–950 range:
|
|
109
|
+
|
|
110
|
+
| Token | Value | Usage |
|
|
111
|
+
|---------------------------|-------------|------------------------------------|
|
|
112
|
+
| `surface-accent-50` | `#f8fafc` | Lightest accent background |
|
|
113
|
+
| `surface-accent-100` | `#f1f5f9` | Hover backgrounds (light) |
|
|
114
|
+
| `surface-accent-200` | `#e2e8f0` | Field backgrounds (light) |
|
|
115
|
+
| `surface-accent-300` | `#cbd5e1` | Accent borders (light) |
|
|
116
|
+
| `surface-accent-400` | `#94a3b8` | Muted accent text |
|
|
117
|
+
| `surface-accent-500` | `#64748b` | Mid-tone accent |
|
|
118
|
+
| `surface-accent-600` | `#475569` | Accent labels (dark) |
|
|
119
|
+
| `surface-accent-700` | `#334155` | Field backgrounds (dark) |
|
|
120
|
+
| `surface-accent-800` | `#1e293b` | Hover backgrounds (dark) |
|
|
121
|
+
| `surface-accent-900` | `#172033` | Deep accent background (dark) |
|
|
122
|
+
| `surface-accent-950` | `#0f172a` | Deepest accent background (dark) |
|
|
123
|
+
|
|
124
|
+
#### Text Colors
|
|
125
|
+
|
|
126
|
+
| Token | Value | Usage |
|
|
127
|
+
|--------------------------|------------|------------------------------------------|
|
|
128
|
+
| `text-primary` | `#212121` | Default text (light mode) |
|
|
129
|
+
| `text-secondary` | `#757575` | Secondary/helper text (light mode) |
|
|
130
|
+
| `text-disabled` | `#9e9e9e` | Disabled text (light mode) |
|
|
131
|
+
| `text-primary-dark` | `#ffffff` | Default text (dark mode) |
|
|
132
|
+
| `text-secondary-dark` | `#a0a0a9` | Secondary/helper text (dark mode) |
|
|
133
|
+
| `text-disabled-dark` | `#757580` | Disabled text (dark mode) |
|
|
134
|
+
|
|
135
|
+
### Color Rules
|
|
136
|
+
|
|
137
|
+
1. **NEVER use arbitrary Tailwind colors** like `text-violet-600`, `bg-indigo-500`, `text-fuchsia-500`, `bg-rose-500` for structural UI elements. These are only acceptable inside semantic status indicators (e.g., pipeline stage colors).
|
|
138
|
+
2. **NEVER use gradient text** (`bg-gradient-to-r ... bg-clip-text text-transparent`) for titles or headings. Use `Typography` with its built-in color prop.
|
|
139
|
+
3. **NEVER use glassmorphism** (`backdrop-blur`, `backdrop-filter`, semi-transparent backgrounds) for cards or panels. Use the `Card`, `Paper` components or standard `bg-white dark:bg-surface-900` backgrounds.
|
|
140
|
+
4. **All borders must use `defaultBorderMixin`** — never hardcode border colors like `border-surface-200` or `border-gray-300`.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 4. Typography
|
|
145
|
+
|
|
146
|
+
### The `Typography` Component
|
|
147
|
+
|
|
148
|
+
**MANDATORY**: Use `Typography` for ALL visible text. Never use raw `<h1>`, `<p>`, `<span>`, `<label>` tags.
|
|
149
|
+
|
|
150
|
+
### Variant Scale
|
|
151
|
+
|
|
152
|
+
| Variant | CSS Class | Rendered Element | Specs |
|
|
153
|
+
|--------------|-----------------------|------------------|------------------------------------------|
|
|
154
|
+
| `h1` | `typography-h1` | `<h1>` | 6xl, font-light, tracking-tight |
|
|
155
|
+
| `h2` | `typography-h2` | `<h2>` | 5xl, font-light, tracking-tight |
|
|
156
|
+
| `h3` | `typography-h3` | `<h3>` | 4xl, font-normal, tracking-tight |
|
|
157
|
+
| `h4` | `typography-h4` | `<h4>` | 3xl, font-normal, tracking-tight |
|
|
158
|
+
| `h5` | `typography-h5` | `<h5>` | 2xl, font-normal |
|
|
159
|
+
| `h6` | `typography-h6` | `<h6>` | xl, font-normal |
|
|
160
|
+
| `subtitle1` | `typography-subtitle1`| `<h6>` | lg, font-medium |
|
|
161
|
+
| `subtitle2` | `typography-subtitle2`| `<h6>` | base, font-medium |
|
|
162
|
+
| `body1` | `typography-body1` | `<p>` | base |
|
|
163
|
+
| `body2` | `typography-body2` | `<p>` | sm |
|
|
164
|
+
| `caption` | `typography-caption` | `<p>` | xs |
|
|
165
|
+
| `label` | `typography-label` | `<label>` | sm, font-medium |
|
|
166
|
+
| `inherit` | `typography-inherit` | `<p>` | text-inherit (inherits parent sizing) |
|
|
167
|
+
| `button` | `typography-button` | `<span>` | sm, font-semibold |
|
|
168
|
+
|
|
169
|
+
### Color Prop
|
|
170
|
+
|
|
171
|
+
| Value | Class applied | Notes |
|
|
172
|
+
|--------------|--------------------------------------------------------|-------------------------------|
|
|
173
|
+
| `"primary"` | `text-text-primary dark:text-text-primary-dark` | Default — standard text |
|
|
174
|
+
| `"secondary"`| `text-text-secondary dark:text-text-secondary-dark` | Helper/description text |
|
|
175
|
+
| `"disabled"` | `text-text-disabled dark:text-text-disabled-dark` | Disabled state |
|
|
176
|
+
| `"error"` | `text-red-600 dark:text-red-500` | Error messages |
|
|
177
|
+
| `"inherit"` | `text-inherit` | Inherits color from parent |
|
|
178
|
+
| `"initial"` | `text-current` | Uses CSS `currentColor` |
|
|
179
|
+
|
|
180
|
+
### Typography Usage Examples
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
// Page title — use h4 or h5, never h1-h3 (those are too large for admin panels)
|
|
184
|
+
<Typography variant="h4">Dashboard</Typography>
|
|
185
|
+
|
|
186
|
+
// Section title
|
|
187
|
+
<Typography variant="h6">Pipeline Overview</Typography>
|
|
188
|
+
|
|
189
|
+
// Card title
|
|
190
|
+
<Typography variant="subtitle1" component="h2">Active Leads</Typography>
|
|
191
|
+
|
|
192
|
+
// Description / helper text
|
|
193
|
+
<Typography variant="body2" color="secondary">
|
|
194
|
+
Manage your pipeline here.
|
|
195
|
+
</Typography>
|
|
196
|
+
|
|
197
|
+
// Small label above a metric
|
|
198
|
+
<Typography variant="caption" color="secondary">Total Revenue</Typography>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Typography Anti-Patterns
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
// ❌ NEVER: Gradient text on headings
|
|
205
|
+
<Typography className="bg-gradient-to-r from-violet-600 to-cyan-500 bg-clip-text text-transparent">
|
|
206
|
+
|
|
207
|
+
// ❌ NEVER: Overriding font-weight excessively
|
|
208
|
+
<Typography className="font-extrabold">
|
|
209
|
+
|
|
210
|
+
// ❌ NEVER: Custom tracking/sizing overrides
|
|
211
|
+
<Typography className="tracking-widest text-[10px] uppercase">
|
|
212
|
+
|
|
213
|
+
// ✅ CORRECT: Let Typography variants handle all styling
|
|
214
|
+
<Typography variant="caption" color="secondary">Label Text</Typography>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 5. Layout Patterns
|
|
220
|
+
|
|
221
|
+
### Page-Level Layout
|
|
222
|
+
|
|
223
|
+
The reference layout used by `ContentHomePage` (the default Rebase home page):
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
<div className="py-2 overflow-auto h-full w-full bg-surface-50 dark:bg-surface-800">
|
|
227
|
+
<Container maxWidth="6xl">
|
|
228
|
+
{/* Content sections */}
|
|
229
|
+
</Container>
|
|
230
|
+
</div>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Key rules:
|
|
234
|
+
- **Wrap content in `<Container>`** with an appropriate `maxWidth` (`4xl`, `5xl`, `6xl`, `7xl`).
|
|
235
|
+
- **Page background**: `bg-surface-50 dark:bg-surface-800` (not `dark:bg-surface-950`).
|
|
236
|
+
- **Use `overflow-auto h-full w-full`** on the outermost wrapper so the page scrolls inside the admin shell.
|
|
237
|
+
|
|
238
|
+
### Card Grid Layout
|
|
239
|
+
|
|
240
|
+
For grids of cards (like navigation cards on the home page):
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
244
|
+
{/* Cards */}
|
|
245
|
+
</div>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
- Use consistent `gap-4` (not `gap-6` or `gap-8`).
|
|
249
|
+
- Use the responsive breakpoints: 1 column → 2 columns at `md` → 3 columns at `lg`.
|
|
250
|
+
|
|
251
|
+
### Section Spacing
|
|
252
|
+
|
|
253
|
+
- Between major sections: `my-10` (from `NavigationGroup`)
|
|
254
|
+
- Between subsections: `mb-4` or `mt-4`
|
|
255
|
+
- Inside cards: `p-4` (standard), `p-6` (for larger panels)
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 6. Card Patterns
|
|
260
|
+
|
|
261
|
+
### Using the `Card` Component
|
|
262
|
+
|
|
263
|
+
The `Card` component from `@rebasepro/ui` automatically applies `cardMixin` and, if an `onClick` is provided, `cardClickableMixin`.
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
// Style mixins applied by Card:
|
|
267
|
+
// cardMixin = "bg-white dark:bg-surface-900 rounded-md border border-surface-200/60 dark:border-surface-700/60 m-1 -p-1"
|
|
268
|
+
// cardClickableMixin = "hover:bg-surface-accent-100 dark:hover:bg-surface-800 hover:ring-1 hover:ring-primary/50 hover:shadow-sm cursor-pointer hover:bg-primary/10 dark:hover:bg-primary/10 transition-all duration-150"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
// ✅ CORRECT: Using Card component
|
|
273
|
+
<Card className="p-4">
|
|
274
|
+
<Typography variant="subtitle1">Title</Typography>
|
|
275
|
+
<Typography variant="body2" color="secondary">Description</Typography>
|
|
276
|
+
</Card>
|
|
277
|
+
|
|
278
|
+
// ✅ CORRECT: Clickable card
|
|
279
|
+
<Card onClick={() => navigate("/details")} className="p-4">
|
|
280
|
+
<Typography variant="subtitle1">Title</Typography>
|
|
281
|
+
</Card>
|
|
282
|
+
|
|
283
|
+
// ❌ WRONG: Hand-rolled card with custom styling
|
|
284
|
+
<div className="glass-card p-6 rounded-2xl shadow-sm backdrop-blur-md">
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Card Anti-Patterns
|
|
288
|
+
|
|
289
|
+
| ❌ Don't | ✅ Do |
|
|
290
|
+
|---------------------------------------------------|-----------------------------------------------|
|
|
291
|
+
| `rounded-2xl` | Let `Card` use `rounded-md` |
|
|
292
|
+
| `shadow-lg shadow-blue-500/20` | Let `cardClickableMixin` handle hover shadow |
|
|
293
|
+
| `hover:-translate-y-1` | Don't lift cards on hover |
|
|
294
|
+
| `hover:scale-110` on icons | Use subtle `transition-colors` at most |
|
|
295
|
+
| `bg-gradient-to-br from-blue-500 to-indigo-600` | Use `bg-primary/8 dark:bg-primary/10` |
|
|
296
|
+
| `glass-card`, `glass-panel`, backdrop-blur | Use `Card` or `Paper` component |
|
|
297
|
+
|
|
298
|
+
### NavigationCard Reference Pattern
|
|
299
|
+
|
|
300
|
+
This is the gold standard for how a card should look:
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
<Card className={cls(
|
|
304
|
+
"group h-full p-4 cursor-pointer transition-all duration-150 ease-in-out",
|
|
305
|
+
"border-surface-200 dark:border-surface-700/40",
|
|
306
|
+
"hover:shadow-md hover:shadow-black/[0.04]",
|
|
307
|
+
"hover:border-surface-300 dark:hover:border-primary/20"
|
|
308
|
+
)}>
|
|
309
|
+
<div className="flex flex-col h-full">
|
|
310
|
+
{/* Icon in subtle primary tint */}
|
|
311
|
+
<div className="flex items-center justify-center w-7 h-7 rounded-lg bg-primary/8 dark:bg-primary/10 text-primary/70 dark:text-primary/60">
|
|
312
|
+
{icon}
|
|
313
|
+
</div>
|
|
314
|
+
{/* Title */}
|
|
315
|
+
<Typography variant="subtitle1" component="h2">{name}</Typography>
|
|
316
|
+
{/* Description */}
|
|
317
|
+
<Typography variant="caption" color="secondary">
|
|
318
|
+
<Markdown source={description} size="small" />
|
|
319
|
+
</Typography>
|
|
320
|
+
</div>
|
|
321
|
+
</Card>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Key observations from NavigationCard:**
|
|
325
|
+
- Icons use `bg-primary/8 dark:bg-primary/10` — subtle, monochrome primary tint. **Not** vibrant gradients.
|
|
326
|
+
- Hover effects are minimal: slightly stronger border + tiny shadow. **Not** lifting, scaling, or glowing.
|
|
327
|
+
- The card transitions are `duration-150` — fast and subtle.
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## 7. Style Mixins (`@rebasepro/ui/styles`)
|
|
332
|
+
|
|
333
|
+
Always import and use these mixins rather than hardcoding equivalent classes:
|
|
334
|
+
|
|
335
|
+
### Layout & Card Mixins
|
|
336
|
+
|
|
337
|
+
| Mixin | Classes |
|
|
338
|
+
|------------------------------|------------------------------------------------------------------------------------------------------|
|
|
339
|
+
| `defaultBorderMixin` | `border-surface-200/60 dark:border-surface-700/60` |
|
|
340
|
+
| `paperMixin` | `bg-white rounded-md dark:bg-surface-800 border border-surface-200/60 dark:border-surface-700/60` |
|
|
341
|
+
| `cardMixin` | `bg-white dark:bg-surface-900 rounded-md border border-surface-200/60 dark:border-surface-700/60` |
|
|
342
|
+
| `cardClickableMixin` | hover:bg, hover:ring-1, hover:shadow-sm, cursor-pointer, transition-all |
|
|
343
|
+
| `cardSelectedMixin` | `bg-primary-bg/30 dark:bg-primary-bg/10 ring-1 ring-primary/75` |
|
|
344
|
+
|
|
345
|
+
### Field & Focus Mixins
|
|
346
|
+
|
|
347
|
+
| Mixin | Classes |
|
|
348
|
+
|----------------------------------|--------------------------------------------------------------------------------------------------|
|
|
349
|
+
| `fieldBackgroundMixin` | `bg-surface-accent-200/50 dark:bg-surface-900` |
|
|
350
|
+
| `fieldBackgroundInvisibleMixin` | `bg-surface-accent-200/0 dark:bg-surface-900/0` — fully transparent field background |
|
|
351
|
+
| `fieldBackgroundDisabledMixin` | `bg-surface-accent-200/50 dark:bg-surface-900/90` — slightly opaque disabled state |
|
|
352
|
+
| `fieldBackgroundHoverMixin` | `hover:bg-surface-accent-200/70 hover:dark:bg-surface-700/40` — hover highlight for fields |
|
|
353
|
+
| `focusedClasses` | `z-30 outline-none ring-2 ring-primary/75 ring-offset-0` — standard focus ring |
|
|
354
|
+
| `focusedDisabled` | `focus-visible:ring-0 focus-visible:ring-offset-0` — removes focus ring for disabled elements |
|
|
355
|
+
| `focusedInvisibleMixin` | `focus:bg-surface-accent-100/70 dark:focus:bg-surface-900/60` — subtle bg on focus for invisible fields |
|
|
356
|
+
|
|
357
|
+
### `cardSelectedMixin` Usage
|
|
358
|
+
|
|
359
|
+
Use `cardSelectedMixin` to visually mark a card as the active/selected item in a list or grid:
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import { Card, cls, cardSelectedMixin } from "@rebasepro/ui";
|
|
363
|
+
|
|
364
|
+
<Card className={cls("p-4", isSelected && cardSelectedMixin)}>
|
|
365
|
+
<Typography variant="subtitle1">{item.name}</Typography>
|
|
366
|
+
</Card>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
The mixin applies a subtle primary-tinted background and a `ring-1` primary border, matching the Rebase selection style used in entity tables and multi-select UIs.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## 8. Buttons
|
|
374
|
+
|
|
375
|
+
### Valid Button Variants
|
|
376
|
+
|
|
377
|
+
The `Button` component accepts these variants and colors:
|
|
378
|
+
|
|
379
|
+
```tsx
|
|
380
|
+
<Button variant="filled" color="primary">Primary Action</Button>
|
|
381
|
+
<Button variant="outlined" color="primary">Secondary Action</Button>
|
|
382
|
+
<Button variant="text" color="primary">Tertiary Action</Button>
|
|
383
|
+
<Button variant="filled" color="neutral">Neutral Button</Button>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
| Prop | Values |
|
|
387
|
+
|-----------|-----------------------------------------------|
|
|
388
|
+
| `variant` | `"filled"`, `"outlined"`, `"text"` |
|
|
389
|
+
| `color` | `"primary"`, `"secondary"`, `"text"`, `"error"`, `"neutral"` |
|
|
390
|
+
| `size` | `"small"`, `"medium"`, `"large"`, `"xl"`, `"2xl"` |
|
|
391
|
+
|
|
392
|
+
### Button Anti-Patterns
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
// ❌ NEVER: Casting variant to bypass types
|
|
396
|
+
<Button variant={"standard" as any}>
|
|
397
|
+
|
|
398
|
+
// ❌ NEVER: Custom gradient backgrounds
|
|
399
|
+
<Button className="bg-gradient-to-r from-violet-600 to-indigo-600 text-white">
|
|
400
|
+
|
|
401
|
+
// ❌ NEVER: Custom shadow styling
|
|
402
|
+
<Button className="shadow-lg shadow-violet-500/20 hover:shadow-xl">
|
|
403
|
+
|
|
404
|
+
// ✅ CORRECT: Use proper variant and color
|
|
405
|
+
<Button variant="filled" color="primary">Submit</Button>
|
|
406
|
+
<Button variant="outlined" color="primary">Cancel</Button>
|
|
407
|
+
<Button variant="text" color="primary" startIcon={<RefreshCwIcon />}>Refresh</Button>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## 9. Alerts & Status Messages
|
|
413
|
+
|
|
414
|
+
### Use the `Alert` Component
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
// ✅ CORRECT
|
|
418
|
+
<Alert color="success" size="small">Lead captured successfully!</Alert>
|
|
419
|
+
<Alert color="error">Could not load dashboard statistics.</Alert>
|
|
420
|
+
<Alert color="info">Data is refreshing...</Alert>
|
|
421
|
+
<Alert color="warning">Some metrics may be stale.</Alert>
|
|
422
|
+
|
|
423
|
+
// ❌ WRONG: Hand-rolled alert div
|
|
424
|
+
<div className="p-4 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-600">
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
| `color` prop | Usage |
|
|
428
|
+
|-------------|----------------------|
|
|
429
|
+
| `"error"` | Error messages |
|
|
430
|
+
| `"warning"` | Warnings |
|
|
431
|
+
| `"info"` | Informational |
|
|
432
|
+
| `"success"` | Success confirmations|
|
|
433
|
+
| `"base"` | Neutral notices |
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## 10. Section Headers
|
|
438
|
+
|
|
439
|
+
### How to Title a Section
|
|
440
|
+
|
|
441
|
+
Follow the `NavigationGroup` pattern — section headers are **small, uppercase, secondary-colored labels**, not large bold headings:
|
|
442
|
+
|
|
443
|
+
```tsx
|
|
444
|
+
// ✅ CORRECT: Section header pattern (from NavigationGroup)
|
|
445
|
+
<Typography
|
|
446
|
+
variant="caption"
|
|
447
|
+
component="h2"
|
|
448
|
+
color="secondary"
|
|
449
|
+
className="px-4 py-1 rounded font-semibold text-[11px] uppercase tracking-wider text-surface-400 dark:text-surface-400"
|
|
450
|
+
>
|
|
451
|
+
Pipeline Stages
|
|
452
|
+
</Typography>
|
|
453
|
+
|
|
454
|
+
// ❌ WRONG: Oversized bold section title
|
|
455
|
+
<Typography variant="h6" className="font-bold text-surface-950 dark:text-surface-50">
|
|
456
|
+
Pipeline Stage Distribution
|
|
457
|
+
</Typography>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
For panel-level titles (inside a Card or Paper), use `subtitle1`:
|
|
461
|
+
|
|
462
|
+
```tsx
|
|
463
|
+
<Card className="p-4">
|
|
464
|
+
<Typography variant="subtitle1" className="mb-2">Tasks</Typography>
|
|
465
|
+
{/* content */}
|
|
466
|
+
</Card>
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## 11. Metric / KPI Cards
|
|
472
|
+
|
|
473
|
+
When displaying numeric KPIs, follow the NavigationCard icon pattern:
|
|
474
|
+
|
|
475
|
+
```tsx
|
|
476
|
+
<Card className="p-4">
|
|
477
|
+
<div className="flex items-center gap-4">
|
|
478
|
+
{/* Icon: subtle primary-tinted background */}
|
|
479
|
+
<div className="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/8 dark:bg-primary/10 text-primary/70 dark:text-primary/60">
|
|
480
|
+
<UsersIcon className="h-5 w-5" />
|
|
481
|
+
</div>
|
|
482
|
+
<div>
|
|
483
|
+
<Typography variant="caption" color="secondary">Active Leads</Typography>
|
|
484
|
+
<Typography variant="h5">{count}</Typography>
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
</Card>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Metric Card Anti-Patterns
|
|
491
|
+
|
|
492
|
+
```tsx
|
|
493
|
+
// ❌ NEVER: Gradient icon backgrounds
|
|
494
|
+
<div className="p-4 bg-gradient-to-br from-blue-500 to-indigo-600 text-white rounded-2xl shadow-lg shadow-blue-500/20">
|
|
495
|
+
|
|
496
|
+
// ❌ NEVER: Oversized rounded corners
|
|
497
|
+
<div className="rounded-2xl">
|
|
498
|
+
|
|
499
|
+
// ❌ NEVER: Animated hover scaling on icon containers
|
|
500
|
+
<div className="group-hover:scale-110 transition-transform">
|
|
501
|
+
|
|
502
|
+
// ❌ NEVER: Gradient text on values
|
|
503
|
+
<Typography className="bg-gradient-to-r from-violet-600 to-fuchsia-500 bg-clip-text text-transparent">
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## 12. Icons
|
|
509
|
+
|
|
510
|
+
- Import icons from `lucide-react` for functional/semantic icons.
|
|
511
|
+
- Import icons from `@rebasepro/ui` for navigation icons (`ArrowRightIcon`, `AddIcon`, `DeleteIcon`, etc.)
|
|
512
|
+
- **Icon containers** use `bg-primary/8 dark:bg-primary/10` — a single, consistent primary tint. **Not** per-card colored gradients.
|
|
513
|
+
- Icon size: typically `h-5 w-5` or `h-4 w-4` inside icon containers.
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## 13. Panels & Sections (Non-Card Wrappers)
|
|
518
|
+
|
|
519
|
+
For larger content sections (like a table, form, or embedded panel), use `Paper` or apply `paperMixin`:
|
|
520
|
+
|
|
521
|
+
```tsx
|
|
522
|
+
// Using Paper component
|
|
523
|
+
<Paper className="p-4">
|
|
524
|
+
<CollectionPanel path="tasks" title={false} />
|
|
525
|
+
</Paper>
|
|
526
|
+
|
|
527
|
+
// Or with cls and paperMixin
|
|
528
|
+
<div className={cls(paperMixin, "p-4")}>
|
|
529
|
+
{/* content */}
|
|
530
|
+
</div>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Panel Anti-Patterns
|
|
534
|
+
|
|
535
|
+
```tsx
|
|
536
|
+
// ❌ WRONG: Custom panel styling
|
|
537
|
+
<div className="p-6 rounded-2xl border bg-white dark:bg-surface-900/50 backdrop-blur-md shadow-sm">
|
|
538
|
+
|
|
539
|
+
// ✅ CORRECT: Use Paper or paperMixin
|
|
540
|
+
<Paper className="p-4">
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## 14. Forms
|
|
546
|
+
|
|
547
|
+
Form inputs should use `@rebasepro/ui` components directly without excessive class overrides:
|
|
548
|
+
|
|
549
|
+
```tsx
|
|
550
|
+
// ✅ CORRECT
|
|
551
|
+
<TextField label="Client Name" value={name} onChange={e => setName(e.target.value)} />
|
|
552
|
+
<Select label="Package" value={pkg} onValueChange={setPkg}>
|
|
553
|
+
<SelectItem value="basic">Basic</SelectItem>
|
|
554
|
+
<SelectItem value="premium">Premium</SelectItem>
|
|
555
|
+
</Select>
|
|
556
|
+
|
|
557
|
+
// ❌ WRONG: Overriding input styling
|
|
558
|
+
<TextField className="rounded-lg border-surface-200 dark:border-surface-850 focus:border-violet-500 focus:ring-violet-500" />
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## 15. Responsive Layout Rules
|
|
564
|
+
|
|
565
|
+
1. **Container-aware, not viewport-aware**: Use `ResizeObserver` on the actual container, NOT media queries, for adaptive layout in split panels.
|
|
566
|
+
2. **Refs that observers depend on MUST render unconditionally.**
|
|
567
|
+
3. **One component, adaptive rendering**: Prefer a single component that adapts to its container width.
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## 16. Font Stack
|
|
572
|
+
|
|
573
|
+
```css
|
|
574
|
+
--font-sans: 'Rubik', 'Roboto', 'Helvetica', 'Arial', sans-serif;
|
|
575
|
+
--font-headers: 'Rubik', 'Roboto', 'Helvetica', 'Arial', sans-serif;
|
|
576
|
+
--font-mono: 'JetBrains Mono', 'Space Mono', 'Lucida Console', monospace;
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
Ensure `@fontsource/rubik` and `@fontsource/jetbrains-mono` are imported in the entry file.
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
## 17. Dark Mode
|
|
584
|
+
|
|
585
|
+
- Rebase uses `dark:` variant for dark mode classes.
|
|
586
|
+
- Custom variant: `@custom-variant dark (&:where(.dark, .dark *))`.
|
|
587
|
+
- **Always provide dark mode equivalents** for any custom styling.
|
|
588
|
+
- Standard dark mode backgrounds:
|
|
589
|
+
- Page: `dark:bg-surface-800`
|
|
590
|
+
- Cards: `dark:bg-surface-900`
|
|
591
|
+
- Borders: `dark:border-surface-700/60`
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## 18. CSS-Only Rules (index.css)
|
|
596
|
+
|
|
597
|
+
The project CSS file should:
|
|
598
|
+
|
|
599
|
+
1. Import Tailwind and the UI kit CSS:
|
|
600
|
+
```css
|
|
601
|
+
@import "tailwindcss";
|
|
602
|
+
@import "@rebasepro/ui/index.css" layer(base);
|
|
603
|
+
```
|
|
604
|
+
2. Source the UI kit JS for Tailwind scanning:
|
|
605
|
+
```css
|
|
606
|
+
@source "../node_modules/@rebasepro/*/dist/**/*.js";
|
|
607
|
+
```
|
|
608
|
+
3. Define the dark mode variant:
|
|
609
|
+
```css
|
|
610
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
611
|
+
```
|
|
612
|
+
4. **Do NOT add custom utility classes** that duplicate what the UI kit provides (e.g., `glass-card`, `glass-panel`, custom shimmer animations).
|
|
613
|
+
5. **Do NOT add custom color tokens** that conflict with the UI kit's token scale.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## 19. Complete Anti-Pattern Checklist
|
|
618
|
+
|
|
619
|
+
Before submitting UI code, verify you have NONE of these:
|
|
620
|
+
|
|
621
|
+
| # | Anti-Pattern | Fix |
|
|
622
|
+
|---|------------------------------------------------------|--------------------------------------------------------|
|
|
623
|
+
| 1 | Raw HTML (`<h1>`, `<p>`, `<span>`, `<label>`) | Use `Typography` with appropriate variant |
|
|
624
|
+
| 2 | Hardcoded border colors | Use `defaultBorderMixin` |
|
|
625
|
+
| 3 | `as any` type casts on component props | Use correct prop values from component types |
|
|
626
|
+
| 4 | Template literal class concatenation | Use `cls()` from `@rebasepro/ui` |
|
|
627
|
+
| 5 | Gradient text on headings | Remove gradient, use `Typography` color prop |
|
|
628
|
+
| 6 | Glassmorphism (`backdrop-blur`, translucent bg) | Use `Card`, `Paper`, or solid backgrounds |
|
|
629
|
+
| 7 | `rounded-2xl` on cards/panels | Use `Card`/`Paper` which use `rounded-md` |
|
|
630
|
+
| 8 | Colored gradient icon backgrounds | Use `bg-primary/8 dark:bg-primary/10` |
|
|
631
|
+
| 9 | `hover:-translate-y-1` or `hover:scale-110` | Use subtle `hover:shadow-md` at most |
|
|
632
|
+
| 10| Custom shadow colors (`shadow-blue-500/20`) | Use `hover:shadow-md hover:shadow-black/[0.04]` |
|
|
633
|
+
| 11| `animate-bounce`, `animate-pulse` on alerts | Use static `Alert` component |
|
|
634
|
+
| 12| Custom CSS classes like `glass-card`, `shimmer-shine` | Remove and use standard UI kit patterns |
|
|
635
|
+
| 13| `font-extrabold` overrides on Typography | Let the variant handle font weight |
|
|
636
|
+
| 14| `text-[10px]`, `tracking-widest` custom overrides | Use `Typography variant="caption"` |
|
|
637
|
+
| 15| Per-card colored themes (blue card, green card, etc.) | Use uniform `Card` + `bg-primary/8` icon tint |
|
|
638
|
+
| 16| `dark:bg-surface-950` for page background | Use `dark:bg-surface-800` |
|
|
639
|
+
| 17| Arbitrary Tailwind colors (`text-violet-600`, etc.) | Use design token colors |
|
|
640
|
+
|
|
641
|
+
> **IMPORTANT FOR AGENTS:** The internal `EntityCard` component (used for card-view in collection grids) uses `hover:-translate-y-0.5` and `hover:shadow-lg`, and the Studio home page uses per-section colored icons. These are **intentional exceptions** in Rebase's own codebase for specific contexts (rich media cards with thumbnails and the Studio admin landing page). **Do NOT copy these patterns** into custom views, home pages, or dashboard cards — they are reserved for these specific internal components.
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
## 20. Reference Components
|
|
646
|
+
|
|
647
|
+
When building new views, always reference these existing implementations:
|
|
648
|
+
|
|
649
|
+
| Component | Location | What it demonstrates |
|
|
650
|
+
|----------------------|-------------------------------------------------------------------|--------------------------------|
|
|
651
|
+
| `NavigationCard` | `packages/admin/src/components/HomePage/NavigationCard.tsx` | Card pattern, icon treatment |
|
|
652
|
+
| `SmallNavigationCard`| `packages/admin/src/components/HomePage/SmallNavigationCard.tsx` | Compact card with mixins |
|
|
653
|
+
| `ContentHomePage` | `packages/admin/src/components/HomePage/ContentHomePage.tsx` | Page layout, Container usage |
|
|
654
|
+
| `NavigationGroup` | `packages/admin/src/components/HomePage/NavigationGroup.tsx` | Section headers, grouping |
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
## 21. Summary: The Design Philosophy
|
|
659
|
+
|
|
660
|
+
1. **Minimal, not flashy.** The admin panel is a work tool. It should be clean, readable, and professional — not eye-catching.
|
|
661
|
+
2. **Consistent, not creative.** Every card, button, and section should look the same across the entire application. Use the UI kit.
|
|
662
|
+
3. **Subtle, not dramatic.** Hover effects are barely noticeable. Transitions are 150ms. Shadows are paper-thin.
|
|
663
|
+
4. **Monochrome accents.** The only accent color is `primary` (blue), applied at very low opacity (`/8`, `/10`). No rainbow gradients.
|
|
664
|
+
5. **Let components do the work.** `Card`, `Paper`, `Typography`, `Alert`, `Button` — these handle all the visual styling. You add content and layout.
|