@j3m-quantum/ui 1.12.1 → 2.1.1

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 CHANGED
@@ -32,6 +32,16 @@ npm install @j3m-quantum/ui tw-animate-css
32
32
 
33
33
  That's it! All dependencies (Radix UI, lucide-react, etc.) are bundled with the package.
34
34
 
35
+ ### Set Up AI Assistance (Recommended)
36
+
37
+ If you use Cursor or AI coding assistants, run this to ensure AI uses the correct components:
38
+
39
+ ```bash
40
+ npx @j3m-quantum/ui init
41
+ ```
42
+
43
+ This creates cursor rules so AI assistants know about all components and use them correctly instead of creating new files.
44
+
35
45
  ## Quick Start
36
46
 
37
47
  ### 1. Setup Vite + Tailwind
@@ -63,9 +73,14 @@ export default defineConfig({
63
73
  @import "tailwindcss";
64
74
  @import "tw-animate-css"; /* Required for animations */
65
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";
66
79
  ```
67
80
 
68
- **Order matters!** Import `tw-animate-css` before `@j3m-quantum/ui/styles` to ensure animations work correctly on Dialog, Sheet, Select, Popover, and other overlay components.
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
69
84
 
70
85
  ### 4. Use Components
71
86
 
@@ -527,16 +542,71 @@ Make sure to add `glass-context` class to Cards containing interactive component
527
542
  </Card>
528
543
  ```
529
544
 
530
- ## Cursor Rules (AI Assistant)
545
+ ## CLI Commands
546
+
547
+ The package includes a CLI to help with setup and discovery.
548
+
549
+ ### Initialize AI Assistance (Recommended)
550
+
551
+ Run this after installing to set up Cursor/AI assistant rules:
552
+
553
+ ```bash
554
+ npx @j3m-quantum/ui init
555
+ ```
556
+
557
+ This creates `.cursor/rules/j3m-quantum.md` with:
558
+ - Complete component list with import statements
559
+ - Figma layer name → component mappings
560
+ - Usage guidelines and patterns
561
+ - Instructions for AI to use package components (not create new ones)
562
+
563
+ ### List Available Components
564
+
565
+ ```bash
566
+ npx @j3m-quantum/ui list
567
+
568
+ # Filter by category
569
+ npx @j3m-quantum/ui list --category blocks
570
+ npx @j3m-quantum/ui list --category inputs
571
+ ```
572
+
573
+ ### Check Setup
574
+
575
+ Validate your project configuration:
576
+
577
+ ```bash
578
+ npx @j3m-quantum/ui doctor
579
+ ```
580
+
581
+ This checks:
582
+ - Package installation
583
+ - CSS import order
584
+ - Cursor rules configuration
585
+ - Required dependencies
586
+
587
+ ## AI Assistant Integration
588
+
589
+ If your team uses Cursor, Copilot, or other AI coding assistants:
590
+
591
+ 1. **Run `npx @j3m-quantum/ui init`** - This is the most important step
592
+ 2. The AI will now:
593
+ - Use components from `@j3m-quantum/ui` instead of creating new files
594
+ - Know all 60+ available components
595
+ - Map Figma layer names to correct components
596
+ - Follow J3M styling guidelines
597
+
598
+ ### Figma MCP Integration
531
599
 
532
- If your team uses Cursor or AI coding assistants, we provide ready-to-use rules to ensure consistent usage of the design system.
600
+ The cursor rules include a Figma layer component mapping table. When your Figma MCP suggests a design element, the AI will automatically use the correct package component:
533
601
 
534
- See [`cursor-rules-for-consumers.md`](./cursor-rules-for-consumers.md) for:
535
- - Rules to copy into your project's `.cursor/rules` file
536
- - Quick setup guide for new projects
537
- - Complete component list
602
+ | Figma Layer | Package Component |
603
+ |-------------|------------------|
604
+ | "Button", "CTA" | `Button` |
605
+ | "Card", "Panel" | `Card` |
606
+ | "Planning Grid" | `PlanningTable` |
607
+ | "Dialog", "Modal" | `Dialog` |
538
608
 
539
- This helps AI assistants understand how to use @j3m-quantum/ui correctly and avoid common mistakes.
609
+ See [`cursor-rules-for-consumers.md`](./cursor-rules-for-consumers.md) for the complete mapping.
540
610
 
541
611
  ## Version Strategy
542
612
 
@@ -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 catalogue before building custom components
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 override component CSS unless approved by design system maintainer
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
- - Don't recreate existing components - use what's in @j3m-quantum/ui
102
- - Don't modify component border-radius - pill shapes are intentional
103
- - Don't style portal components manually - they auto-adapt to theme
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, CopyButton
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
262
+ SiteHeader, NavMain, NavProjects, NavSecondary, NavUser, SearchForm, PlanningTable, CalibrationTable, SupplierWeeklyLoading, Gantt, Kanban
132
263
 
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
- ```
184
-
185
- ## Requesting Changes
186
- Need a new component or styling change? Don't build it locally.
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
  ---
@@ -205,7 +282,14 @@ npm add -D tailwindcss @tailwindcss/vite
205
282
  npm install @j3m-quantum/ui tw-animate-css
206
283
  ```
207
284
 
208
- ### 3. Configure Vite
285
+ ### 3. Set Up AI Assistance (Important!)
286
+ ```bash
287
+ npx @j3m-quantum/ui init
288
+ ```
289
+
290
+ This automatically creates the cursor rules so AI assistants use the correct components.
291
+
292
+ ### 4. Configure Vite
209
293
  ```typescript
210
294
  // vite.config.ts
211
295
  import { defineConfig } from 'vite'
@@ -217,7 +301,7 @@ export default defineConfig({
217
301
  })
218
302
  ```
219
303
 
220
- ### 4. Setup CSS
304
+ ### 5. Setup CSS
221
305
  ```css
222
306
  /* src/index.css */
223
307
  @import "tailwindcss";
@@ -225,19 +309,9 @@ export default defineConfig({
225
309
  @import "@j3m-quantum/ui/styles";
226
310
  ```
227
311
 
228
- ### 5. Add Cursor Rules
229
- Create `.cursor/rules` or `.cursorrules` in your project root and paste the rules from above.
230
-
231
- ### 6. Setup App Root
232
- ```tsx
233
- // src/App.tsx
234
- function App() {
235
- return (
236
- <div className="j3m-app-bg min-h-screen">
237
- {/* Your app content */}
238
- </div>
239
- )
240
- }
312
+ ### 6. Verify Setup
313
+ ```bash
314
+ npx @j3m-quantum/ui doctor
241
315
  ```
242
316
 
243
317
  ### 7. Use Components
@@ -271,6 +345,16 @@ function App() {
271
345
 
272
346
  ---
273
347
 
348
+ ## CLI Commands
349
+
350
+ ```bash
351
+ npx @j3m-quantum/ui init # Set up cursor rules for AI assistance
352
+ npx @j3m-quantum/ui list # List all available components
353
+ npx @j3m-quantum/ui doctor # Check if setup is correct
354
+ ```
355
+
356
+ ---
357
+
274
358
  ## Updating the Package
275
359
 
276
360
  To get the latest components and styling:
@@ -280,3 +364,5 @@ npm update @j3m-quantum/ui
280
364
  # or
281
365
  npm install @j3m-quantum/ui@latest
282
366
  ```
367
+
368
+ After updating, you may want to re-run `npx @j3m-quantum/ui init` to get the latest cursor rules.