@j3m-quantum/ui 2.1.0 → 2.1.5
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 +6 -1
- package/cursor-rules-for-consumers.md +184 -107
- package/dist/cli/index.js +311 -109
- package/dist/cli/postinstall.js +45 -18
- package/dist/index.cjs +6376 -4548
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +361 -8
- package/dist/index.d.ts +361 -8
- package/dist/index.js +6375 -4565
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,9 +73,14 @@ export default defineConfig({
|
|
|
73
73
|
@import "tailwindcss";
|
|
74
74
|
@import "tw-animate-css"; /* Required for animations */
|
|
75
75
|
@import "@j3m-quantum/ui/styles"; /* J3M theme and tokens */
|
|
76
|
+
|
|
77
|
+
/* REQUIRED: Tell Tailwind v4 to scan package for utility classes */
|
|
78
|
+
@source "../node_modules/@j3m-quantum/ui/dist/**/*.js";
|
|
76
79
|
```
|
|
77
80
|
|
|
78
|
-
**
|
|
81
|
+
**Critical notes:**
|
|
82
|
+
- **Order matters!** Import `tw-animate-css` before `@j3m-quantum/ui/styles`
|
|
83
|
+
- **The `@source` directive is required!** Without it, Tailwind v4 won't scan the package and components will be completely unstyled
|
|
79
84
|
|
|
80
85
|
### 4. Use Components
|
|
81
86
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Copy the rules below to `.cursor/rules` or `.cursorrules` in your project to help AI assistants use the J3M Design System correctly.
|
|
4
4
|
|
|
5
|
+
**Recommended:** Run `npx @j3m-quantum/ui init` to automatically set up these rules.
|
|
6
|
+
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
## Rules to Copy
|
|
@@ -15,16 +17,127 @@ Copy the rules below to `.cursor/rules` or `.cursorrules` in your project to hel
|
|
|
15
17
|
- Do NOT use shadcn CLI to add components - everything is already bundled
|
|
16
18
|
- Do NOT create local component copies - use the package exports
|
|
17
19
|
|
|
20
|
+
## CRITICAL: Pre-built Blocks - USE THESE FIRST!
|
|
21
|
+
|
|
22
|
+
Before implementing ANY sidebar, navigation, header, or dashboard layout, ALWAYS import these pre-built blocks:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
// Pre-built blocks - USE THESE, don't build from scratch!
|
|
26
|
+
import {
|
|
27
|
+
SiteHeader, // Header with breadcrumbs + search + sidebar trigger
|
|
28
|
+
NavMain, // Main navigation with icons + collapsible sub-items
|
|
29
|
+
NavSecondary, // Secondary nav (Support, Feedback links)
|
|
30
|
+
NavUser, // User profile with dropdown menu
|
|
31
|
+
NavProjects, // Project list navigation
|
|
32
|
+
SearchForm, // Search input for sidebar
|
|
33
|
+
} from '@j3m-quantum/ui'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## ⛔ NEVER Create These Manually
|
|
37
|
+
|
|
38
|
+
| Instead of building... | Use this block |
|
|
39
|
+
|------------------------|----------------|
|
|
40
|
+
| ❌ Custom sidebar navigation | ✅ `NavMain` |
|
|
41
|
+
| ❌ Custom user menu/profile | ✅ `NavUser` |
|
|
42
|
+
| ❌ Custom page header | ✅ `SiteHeader` |
|
|
43
|
+
| ❌ Custom project list | ✅ `NavProjects` |
|
|
44
|
+
| ❌ Custom secondary links | ✅ `NavSecondary` |
|
|
45
|
+
| ❌ Custom search in sidebar | ✅ `SearchForm` |
|
|
46
|
+
| ❌ Custom CSS tokens | ✅ Package provides all tokens |
|
|
47
|
+
|
|
48
|
+
## Block Props Reference
|
|
49
|
+
|
|
50
|
+
### NavMain
|
|
51
|
+
```tsx
|
|
52
|
+
import { NavMain, type NavItem } from '@j3m-quantum/ui'
|
|
53
|
+
import { Home, Settings, Users } from 'lucide-react'
|
|
54
|
+
|
|
55
|
+
const navItems: NavItem[] = [
|
|
56
|
+
{ title: "Home", url: "/", icon: Home, isActive: true },
|
|
57
|
+
{ title: "Settings", url: "/settings", icon: Settings, items: [
|
|
58
|
+
{ title: "General", url: "/settings/general" },
|
|
59
|
+
{ title: "Team", url: "/settings/team" },
|
|
60
|
+
]},
|
|
61
|
+
{ title: "Users", url: "/users", icon: Users },
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
<NavMain items={navItems} label="Navigation" />
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### NavUser
|
|
68
|
+
```tsx
|
|
69
|
+
import { NavUser } from '@j3m-quantum/ui'
|
|
70
|
+
|
|
71
|
+
<NavUser
|
|
72
|
+
user={{
|
|
73
|
+
name: "John Doe",
|
|
74
|
+
email: "john@example.com",
|
|
75
|
+
avatar: "/avatar.jpg" // or "" for initials fallback
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### SiteHeader
|
|
81
|
+
```tsx
|
|
82
|
+
import { SiteHeader, SidebarTrigger } from '@j3m-quantum/ui'
|
|
83
|
+
|
|
84
|
+
<SiteHeader
|
|
85
|
+
trigger={<SidebarTrigger />}
|
|
86
|
+
breadcrumbs={[
|
|
87
|
+
{ label: "Dashboard", href: "/" },
|
|
88
|
+
{ label: "Settings" } // No href = current page
|
|
89
|
+
]}
|
|
90
|
+
showSearch={true}
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### NavSecondary
|
|
95
|
+
```tsx
|
|
96
|
+
import { NavSecondary } from '@j3m-quantum/ui'
|
|
97
|
+
import { LifeBuoy, Send } from 'lucide-react'
|
|
98
|
+
|
|
99
|
+
<NavSecondary items={[
|
|
100
|
+
{ title: "Support", url: "/support", icon: LifeBuoy },
|
|
101
|
+
{ title: "Feedback", url: "/feedback", icon: Send },
|
|
102
|
+
]} />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Sidebar Features Checklist
|
|
106
|
+
|
|
107
|
+
| Feature | Usage |
|
|
108
|
+
|---------|-------|
|
|
109
|
+
| `collapsible="icon"` | Collapses sidebar to icons only |
|
|
110
|
+
| `collapsible="offcanvas"` | Slides sidebar off screen |
|
|
111
|
+
| `<SidebarRail />` | Edge rail for drag-to-toggle |
|
|
112
|
+
| `tooltip` prop on SidebarMenuButton | Shows tooltips when collapsed |
|
|
113
|
+
| `<SidebarMenuBadge>` | Notification counts on menu items |
|
|
114
|
+
| `<SidebarGroup>` + `<SidebarGroupLabel>` | Organize sections |
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
<Sidebar collapsible="icon">
|
|
118
|
+
<SidebarContent>
|
|
119
|
+
<SidebarGroup>
|
|
120
|
+
<SidebarGroupLabel>Platform</SidebarGroupLabel>
|
|
121
|
+
<NavMain items={navItems} />
|
|
122
|
+
</SidebarGroup>
|
|
123
|
+
</SidebarContent>
|
|
124
|
+
<SidebarRail />
|
|
125
|
+
</Sidebar>
|
|
126
|
+
```
|
|
127
|
+
|
|
18
128
|
## CSS Import Order (Critical)
|
|
19
|
-
The order in src/index.css must be:
|
|
20
129
|
```css
|
|
21
130
|
@import "tailwindcss";
|
|
22
131
|
@import "tw-animate-css"; /* Required for animations */
|
|
23
132
|
@import "@j3m-quantum/ui/styles"; /* J3M theme and tokens */
|
|
133
|
+
|
|
134
|
+
/* REQUIRED: Tell Tailwind v4 to scan package for utility classes */
|
|
135
|
+
@source "../node_modules/@j3m-quantum/ui/dist/**/*.js";
|
|
24
136
|
```
|
|
25
137
|
|
|
138
|
+
**The @source directive is CRITICAL!** Without it, Tailwind v4 won't generate CSS for the component utility classes and all components will be unstyled.
|
|
139
|
+
|
|
26
140
|
## Theme Modes (4 Modes)
|
|
27
|
-
The design system supports four theme modes:
|
|
28
141
|
|
|
29
142
|
| Mode | Classes | Description |
|
|
30
143
|
|------|---------|-------------|
|
|
@@ -33,85 +146,108 @@ The design system supports four theme modes:
|
|
|
33
146
|
| Light Glass | `theme-glass` | Frosted glass on image/gradient |
|
|
34
147
|
| Dark Glass | `dark theme-glass` | Dark frosted glass on image |
|
|
35
148
|
|
|
36
|
-
### Setting Up Theme
|
|
37
149
|
```tsx
|
|
38
|
-
// Root element with theme classes and background utility
|
|
39
150
|
<div className="j3m-app-bg"> {/* Light solid */}
|
|
40
151
|
<div className="dark j3m-app-bg"> {/* Dark solid */}
|
|
41
152
|
<div className="theme-glass j3m-app-bg"> {/* Light glass */}
|
|
42
153
|
<div className="dark theme-glass j3m-app-bg"> {/* Dark glass */}
|
|
43
154
|
```
|
|
44
155
|
|
|
45
|
-
### Background Images (Glass Mode)
|
|
46
|
-
Set a custom background image with CSS variable:
|
|
47
|
-
```css
|
|
48
|
-
:root {
|
|
49
|
-
--j3m-bg-image: url('/your-background.jpg');
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
156
|
## Glass Context (Important!)
|
|
54
157
|
In glass mode, cards containing interactive components need the `glass-context` class:
|
|
55
158
|
|
|
56
159
|
```tsx
|
|
57
|
-
// Correct - interactive components styled properly
|
|
58
160
|
<Card className="glass-context">
|
|
59
161
|
<CardContent>
|
|
60
162
|
<Input placeholder="Name" />
|
|
61
|
-
<Select>...</Select>
|
|
62
163
|
<Button>Submit</Button>
|
|
63
164
|
</CardContent>
|
|
64
165
|
</Card>
|
|
65
|
-
|
|
66
|
-
// Also works - variant="glass" includes glass-context
|
|
67
|
-
<Card variant="glass">
|
|
68
|
-
<CardContent>...</CardContent>
|
|
69
|
-
</Card>
|
|
70
166
|
```
|
|
71
167
|
|
|
72
|
-
Without `glass-context`, inputs/buttons inside cards may have incorrect colors in glass mode.
|
|
73
|
-
|
|
74
|
-
## Portal vs In-App Components
|
|
75
|
-
- **Portal components** (Dialog, Sheet, Drawer, Popover, Select dropdown, Command palette):
|
|
76
|
-
Automatically styled correctly for the current theme mode. No extra classes needed.
|
|
77
|
-
|
|
78
|
-
- **In-app components** (cards with forms, interactive content):
|
|
79
|
-
Add `glass-context` class to the parent Card when in glass mode.
|
|
80
|
-
|
|
81
|
-
## J3M Design Tokens
|
|
82
|
-
- Primary: #F58446 (orange) - use `bg-primary`, `text-primary`
|
|
83
|
-
- Destructive: #FB3748 (red) - use `bg-destructive`
|
|
84
|
-
- Background: adapts to theme mode - use `bg-background`
|
|
85
|
-
- Foreground: adapts to theme mode - use `text-foreground`
|
|
86
|
-
- Muted: subtle backgrounds - use `bg-muted`, `text-muted-foreground`
|
|
87
|
-
- Radius: Components use pill shape (rounded-full) for buttons/inputs
|
|
88
|
-
|
|
89
168
|
## DO
|
|
90
169
|
- Import all components from @j3m-quantum/ui
|
|
170
|
+
- Use pre-built blocks (NavMain, NavUser, SiteHeader) instead of building custom
|
|
91
171
|
- Use Tailwind semantic classes: bg-primary, text-muted-foreground, bg-accent
|
|
92
|
-
- Use CSS variables for custom styling: var(--primary), var(--background)
|
|
93
172
|
- Use `glass-context` class on Cards with interactive components in glass mode
|
|
94
|
-
- Check the component
|
|
95
|
-
- Use the j3m-app-bg class on root element for proper backgrounds
|
|
173
|
+
- Check the component/block list BEFORE building anything custom
|
|
96
174
|
|
|
97
175
|
## DON'T
|
|
176
|
+
- Don't create new component files for UI that exists in @j3m-quantum/ui
|
|
177
|
+
- Don't build custom sidebar/navigation - use NavMain, NavUser, etc.
|
|
98
178
|
- Don't use shadcn CLI - components are already bundled
|
|
99
|
-
- Don't
|
|
179
|
+
- Don't add custom CSS tokens - the package provides everything
|
|
100
180
|
- Don't use arbitrary color values like bg-[#F58446] - use bg-primary
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
181
|
+
|
|
182
|
+
## Complete Dashboard Example
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
import {
|
|
186
|
+
SidebarProvider, Sidebar, SidebarContent, SidebarFooter, SidebarInset, SidebarRail,
|
|
187
|
+
SiteHeader, SidebarTrigger, NavMain, NavUser, NavSecondary, type NavItem
|
|
188
|
+
} from '@j3m-quantum/ui'
|
|
189
|
+
import { Home, Settings, LifeBuoy, Send } from 'lucide-react'
|
|
190
|
+
|
|
191
|
+
const navItems: NavItem[] = [
|
|
192
|
+
{ title: "Home", url: "/", icon: Home, isActive: true },
|
|
193
|
+
{ title: "Settings", url: "/settings", icon: Settings },
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
function App() {
|
|
197
|
+
return (
|
|
198
|
+
<div className="j3m-app-bg min-h-screen">
|
|
199
|
+
<SidebarProvider>
|
|
200
|
+
<Sidebar collapsible="icon">
|
|
201
|
+
<SidebarContent>
|
|
202
|
+
<NavMain items={navItems} />
|
|
203
|
+
</SidebarContent>
|
|
204
|
+
<SidebarFooter>
|
|
205
|
+
<NavSecondary items={[
|
|
206
|
+
{ title: "Support", url: "#", icon: LifeBuoy },
|
|
207
|
+
{ title: "Feedback", url: "#", icon: Send },
|
|
208
|
+
]} />
|
|
209
|
+
<NavUser user={{ name: "John Doe", email: "john@example.com", avatar: "" }} />
|
|
210
|
+
</SidebarFooter>
|
|
211
|
+
<SidebarRail />
|
|
212
|
+
</Sidebar>
|
|
213
|
+
<SidebarInset>
|
|
214
|
+
<SiteHeader
|
|
215
|
+
trigger={<SidebarTrigger />}
|
|
216
|
+
breadcrumbs={[{ label: "Dashboard" }]}
|
|
217
|
+
/>
|
|
218
|
+
<main className="p-4">
|
|
219
|
+
{/* Your content here */}
|
|
220
|
+
</main>
|
|
221
|
+
</SidebarInset>
|
|
222
|
+
</SidebarProvider>
|
|
223
|
+
</div>
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Recommended Prompts for AI
|
|
229
|
+
|
|
230
|
+
**Good prompts:**
|
|
231
|
+
- "Create a dashboard using @j3m-quantum/ui blocks: NavMain, NavUser, SiteHeader"
|
|
232
|
+
- "Use only pre-built blocks from @j3m-quantum/ui, don't create custom components"
|
|
233
|
+
- "Import SiteHeader for the header and NavMain for navigation from @j3m-quantum/ui"
|
|
234
|
+
- "Check the j3m-quantum cursor rules before implementing"
|
|
235
|
+
|
|
236
|
+
**Bad prompts (avoid these):**
|
|
237
|
+
- "Create a sidebar" → AI might build from scratch
|
|
238
|
+
- "Add navigation" → Too vague, specify NavMain
|
|
239
|
+
- "Make a header" → Specify SiteHeader instead
|
|
104
240
|
|
|
105
241
|
## Available Components (60+)
|
|
106
242
|
|
|
107
243
|
### Inputs
|
|
108
|
-
Button, ButtonGroup, Input, InputGroup, Textarea, Checkbox, RadioGroup, Switch, Slider, Select, NativeSelect, Toggle, ToggleGroup, Form, Field, Label
|
|
244
|
+
Button, ButtonGroup, Input, InputGroup, Textarea, Checkbox, RadioGroup, Switch, Slider, Select, NativeSelect, Toggle, ToggleGroup, ThemeSwitch, Form, Field, Label
|
|
109
245
|
|
|
110
246
|
### Display
|
|
111
247
|
Card, Table, Badge, Avatar, UserAvatarsDropdown, Separator, Skeleton, Accordion, Tabs, Calendar, EventCalendar, Carousel, Chart, AspectRatio, Empty, Item, Kbd
|
|
112
248
|
|
|
113
249
|
### Feedback
|
|
114
|
-
Alert, AlertDialog, Progress, Tooltip, Sonner (Toast), Spinner
|
|
250
|
+
Alert, AlertDialog, Progress, CircularProgress, Tooltip, Sonner (Toast), Spinner
|
|
115
251
|
|
|
116
252
|
### Navigation
|
|
117
253
|
Breadcrumb, Pagination, Command, SearchTrigger, DropdownMenu, Menubar, NavigationMenu, ContextMenu
|
|
@@ -123,69 +259,10 @@ Dialog, Drawer, Sheet, Popover, HoverCard
|
|
|
123
259
|
ScrollArea, Collapsible, Resizable, Sidebar, SidebarProvider, SidebarInset, Section
|
|
124
260
|
|
|
125
261
|
### Blocks (Pre-built compositions)
|
|
126
|
-
SiteHeader, NavMain, NavProjects, NavSecondary, NavUser, SearchForm
|
|
127
|
-
|
|
128
|
-
### Utilities
|
|
129
|
-
ThemeSwitch, ToolbarCanvas, PlayerCanvas
|
|
130
|
-
|
|
131
|
-
## Common Patterns
|
|
132
|
-
|
|
133
|
-
### Form in Card (Glass Mode)
|
|
134
|
-
```tsx
|
|
135
|
-
<Card className="glass-context">
|
|
136
|
-
<CardHeader>
|
|
137
|
-
<CardTitle>Contact Form</CardTitle>
|
|
138
|
-
</CardHeader>
|
|
139
|
-
<CardContent className="space-y-4">
|
|
140
|
-
<Input placeholder="Name" />
|
|
141
|
-
<Input placeholder="Email" />
|
|
142
|
-
<Textarea placeholder="Message" />
|
|
143
|
-
<Button>Send</Button>
|
|
144
|
-
</CardContent>
|
|
145
|
-
</Card>
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Dashboard Layout
|
|
149
|
-
```tsx
|
|
150
|
-
<SidebarProvider>
|
|
151
|
-
<Sidebar>
|
|
152
|
-
<SidebarContent>
|
|
153
|
-
<NavMain items={navItems} />
|
|
154
|
-
</SidebarContent>
|
|
155
|
-
<SidebarFooter>
|
|
156
|
-
<NavUser user={userData} />
|
|
157
|
-
</SidebarFooter>
|
|
158
|
-
</Sidebar>
|
|
159
|
-
<SidebarInset>
|
|
160
|
-
<SiteHeader breadcrumbs={[{ label: "Dashboard" }]} />
|
|
161
|
-
<main className="p-4">
|
|
162
|
-
{/* Content */}
|
|
163
|
-
</main>
|
|
164
|
-
</SidebarInset>
|
|
165
|
-
</SidebarProvider>
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Dialog with Form
|
|
169
|
-
```tsx
|
|
170
|
-
<Dialog>
|
|
171
|
-
<DialogTrigger asChild>
|
|
172
|
-
<Button>Open Form</Button>
|
|
173
|
-
</DialogTrigger>
|
|
174
|
-
<DialogContent>
|
|
175
|
-
<DialogHeader>
|
|
176
|
-
<DialogTitle>Edit Profile</DialogTitle>
|
|
177
|
-
</DialogHeader>
|
|
178
|
-
{/* No glass-context needed - Dialog is a portal */}
|
|
179
|
-
<Input placeholder="Name" />
|
|
180
|
-
<Button>Save</Button>
|
|
181
|
-
</DialogContent>
|
|
182
|
-
</Dialog>
|
|
183
|
-
```
|
|
262
|
+
SiteHeader, NavMain, NavProjects, NavSecondary, NavUser, SearchForm, PlanningTable, CalibrationTable, SupplierWeeklyLoading, Gantt, Kanban
|
|
184
263
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
Contact the design system maintainer to request additions or modifications.
|
|
188
|
-
This ensures consistency across all J3M applications.
|
|
264
|
+
### Map
|
|
265
|
+
Map, MapTileLayer, MapMarker, MapPopup, MapTooltip, MapZoomControl
|
|
189
266
|
```
|
|
190
267
|
|
|
191
268
|
---
|