@j3m-quantum/ui 1.3.0 → 1.3.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 +74 -20
- package/cursor-rules-for-consumers.md +171 -28
- package/dist/index.cjs +242 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +240 -121
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +235 -102
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ J3M Quantum UI - A React component library with J3M design tokens.
|
|
|
13
13
|
- **J3M Design Tokens** - Orange primary, neutral grays, pill-shaped buttons
|
|
14
14
|
- **Dark Mode** - Full dark theme support via `.dark` class
|
|
15
15
|
- **Glass Mode** - Frosted glass effects via `.theme-glass` class
|
|
16
|
-
- **
|
|
16
|
+
- **60+ Components** - Complete UI component library with J3M styling
|
|
17
17
|
- **All-in-One** - Everything bundled, just install and use
|
|
18
18
|
- **Smooth Animations** - Powered by tw-animate-css
|
|
19
19
|
|
|
@@ -67,17 +67,19 @@ import { Button, Card, Input, Dialog, DialogTrigger, DialogContent } from '@j3m-
|
|
|
67
67
|
|
|
68
68
|
function App() {
|
|
69
69
|
return (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
<div className="j3m-app-bg min-h-screen p-8">
|
|
71
|
+
<Card className="glass-context">
|
|
72
|
+
<Input placeholder="Enter email" />
|
|
73
|
+
<Dialog>
|
|
74
|
+
<DialogTrigger asChild>
|
|
75
|
+
<Button>Open Dialog</Button>
|
|
76
|
+
</DialogTrigger>
|
|
77
|
+
<DialogContent>
|
|
78
|
+
<p>This dialog has smooth animations!</p>
|
|
79
|
+
</DialogContent>
|
|
80
|
+
</Dialog>
|
|
81
|
+
</Card>
|
|
82
|
+
</div>
|
|
81
83
|
)
|
|
82
84
|
}
|
|
83
85
|
```
|
|
@@ -104,7 +106,7 @@ The design system supports four theme modes. Use the `.j3m-app-bg` utility class
|
|
|
104
106
|
|
|
105
107
|
### Glass Mode (Light)
|
|
106
108
|
|
|
107
|
-
Frosted glass on colorful gradient background:
|
|
109
|
+
Frosted glass on colorful gradient or image background:
|
|
108
110
|
|
|
109
111
|
```tsx
|
|
110
112
|
<div className="theme-glass j3m-app-bg">
|
|
@@ -122,16 +124,35 @@ Dark frosted glass on deep gradient - sophisticated industrial aesthetic:
|
|
|
122
124
|
</div>
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
###
|
|
127
|
+
### Custom Background Images
|
|
128
|
+
|
|
129
|
+
In glass mode, you can set a custom background image:
|
|
126
130
|
|
|
127
|
-
|
|
131
|
+
```css
|
|
132
|
+
:root {
|
|
133
|
+
--j3m-bg-image: url('/your-background.jpg');
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Glass Context
|
|
138
|
+
|
|
139
|
+
When using glass mode, cards containing interactive components (inputs, buttons, selects) need the `glass-context` class for proper styling:
|
|
128
140
|
|
|
129
141
|
```tsx
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
// Correct - inputs and buttons styled properly in glass mode
|
|
143
|
+
<Card className="glass-context">
|
|
144
|
+
<CardHeader>
|
|
145
|
+
<CardTitle>Contact Form</CardTitle>
|
|
146
|
+
</CardHeader>
|
|
147
|
+
<CardContent>
|
|
148
|
+
<Input placeholder="Name" />
|
|
149
|
+
<Button>Submit</Button>
|
|
150
|
+
</CardContent>
|
|
151
|
+
</Card>
|
|
133
152
|
```
|
|
134
153
|
|
|
154
|
+
**Note:** Portal components (Dialog, Sheet, Popover, Select dropdown) automatically adapt to the current theme mode - no `glass-context` needed.
|
|
155
|
+
|
|
135
156
|
## Design Tokens
|
|
136
157
|
|
|
137
158
|
### Color System: 12-Step Scale
|
|
@@ -221,15 +242,39 @@ All of these are bundled and ready to use:
|
|
|
221
242
|
```typescript
|
|
222
243
|
// Everything from one package!
|
|
223
244
|
import {
|
|
224
|
-
Button, Card, Dialog,
|
|
245
|
+
Button, Card, Dialog, Input,
|
|
225
246
|
SidebarProvider, Sidebar, SidebarContent,
|
|
226
|
-
NavMain, NavUser, SiteHeader
|
|
247
|
+
NavMain, NavUser, SiteHeader,
|
|
248
|
+
EventCalendar, ThemeSwitch
|
|
227
249
|
} from '@j3m-quantum/ui'
|
|
228
250
|
|
|
229
251
|
// Styles (CSS)
|
|
230
252
|
import '@j3m-quantum/ui/styles'
|
|
231
253
|
```
|
|
232
254
|
|
|
255
|
+
## Components
|
|
256
|
+
|
|
257
|
+
### Inputs
|
|
258
|
+
Button, ButtonGroup, Input, InputGroup, Textarea, Checkbox, RadioGroup, Switch, Slider, Select, NativeSelect, Toggle, ToggleGroup, Form, Field, Label, CopyButton
|
|
259
|
+
|
|
260
|
+
### Display
|
|
261
|
+
Card, Table, Badge, Avatar, UserAvatarsDropdown, Separator, Skeleton, Accordion, Tabs, Calendar, EventCalendar, Carousel, Chart, AspectRatio, Empty, Item, Kbd
|
|
262
|
+
|
|
263
|
+
### Feedback
|
|
264
|
+
Alert, AlertDialog, Progress, Tooltip, Sonner (Toast), Spinner
|
|
265
|
+
|
|
266
|
+
### Navigation
|
|
267
|
+
Breadcrumb, Pagination, Command, SearchTrigger, DropdownMenu, Menubar, NavigationMenu, ContextMenu
|
|
268
|
+
|
|
269
|
+
### Overlay
|
|
270
|
+
Dialog, Drawer, Sheet, Popover, HoverCard
|
|
271
|
+
|
|
272
|
+
### Layout
|
|
273
|
+
ScrollArea, Collapsible, Resizable, Sidebar, SidebarProvider, SidebarInset, Section
|
|
274
|
+
|
|
275
|
+
### Utilities
|
|
276
|
+
ThemeSwitch, ToolbarCanvas, PlayerCanvas
|
|
277
|
+
|
|
233
278
|
## Blocks
|
|
234
279
|
|
|
235
280
|
Pre-built, composable sidebar components for enterprise applications.
|
|
@@ -373,6 +418,15 @@ export default defineConfig({
|
|
|
373
418
|
})
|
|
374
419
|
```
|
|
375
420
|
|
|
421
|
+
### Components look wrong in glass mode
|
|
422
|
+
Make sure to add `glass-context` class to Cards containing interactive components:
|
|
423
|
+
```tsx
|
|
424
|
+
<Card className="glass-context">
|
|
425
|
+
<Input />
|
|
426
|
+
<Button>Submit</Button>
|
|
427
|
+
</Card>
|
|
428
|
+
```
|
|
429
|
+
|
|
376
430
|
## Cursor Rules (AI Assistant)
|
|
377
431
|
|
|
378
432
|
If your team uses Cursor or AI coding assistants, we provide ready-to-use rules to ensure consistent usage of the design system.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# J3M Quantum UI - Cursor Rules
|
|
2
2
|
|
|
3
|
-
Copy the rules below to `.cursor/rules` in your project to help AI assistants use the J3M Design System correctly.
|
|
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
5
|
---
|
|
6
6
|
|
|
@@ -13,6 +13,7 @@ Copy the rules below to `.cursor/rules` in your project to help AI assistants us
|
|
|
13
13
|
- This project uses @j3m-quantum/ui - a complete React component library with J3M styling
|
|
14
14
|
- Import components directly: `import { Button, Card, Input } from '@j3m-quantum/ui'`
|
|
15
15
|
- Do NOT use shadcn CLI to add components - everything is already bundled
|
|
16
|
+
- Do NOT create local component copies - use the package exports
|
|
16
17
|
|
|
17
18
|
## CSS Import Order (Critical)
|
|
18
19
|
The order in src/index.css must be:
|
|
@@ -22,44 +23,164 @@ The order in src/index.css must be:
|
|
|
22
23
|
@import "@j3m-quantum/ui/styles"; /* J3M theme and tokens */
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
## Theme Modes
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
## Theme Modes (4 Modes)
|
|
27
|
+
The design system supports four theme modes:
|
|
28
|
+
|
|
29
|
+
| Mode | Classes | Description |
|
|
30
|
+
|------|---------|-------------|
|
|
31
|
+
| Light Solid | (default) | Opaque surfaces, gray backgrounds |
|
|
32
|
+
| Dark Solid | `dark` | Dark opaque surfaces |
|
|
33
|
+
| Light Glass | `theme-glass` | Frosted glass on image/gradient |
|
|
34
|
+
| Dark Glass | `dark theme-glass` | Dark frosted glass on image |
|
|
35
|
+
|
|
36
|
+
### Setting Up Theme
|
|
37
|
+
```tsx
|
|
38
|
+
// Root element with theme classes and background utility
|
|
39
|
+
<div className="j3m-app-bg"> {/* Light solid */}
|
|
40
|
+
<div className="dark j3m-app-bg"> {/* Dark solid */}
|
|
41
|
+
<div className="theme-glass j3m-app-bg"> {/* Light glass */}
|
|
42
|
+
<div className="dark theme-glass j3m-app-bg"> {/* Dark glass */}
|
|
43
|
+
```
|
|
44
|
+
|
|
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
|
+
## Glass Context (Important!)
|
|
54
|
+
In glass mode, cards containing interactive components need the `glass-context` class:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
// Correct - interactive components styled properly
|
|
58
|
+
<Card className="glass-context">
|
|
59
|
+
<CardContent>
|
|
60
|
+
<Input placeholder="Name" />
|
|
61
|
+
<Select>...</Select>
|
|
62
|
+
<Button>Submit</Button>
|
|
63
|
+
</CardContent>
|
|
64
|
+
</Card>
|
|
65
|
+
|
|
66
|
+
// Also works - variant="glass" includes glass-context
|
|
67
|
+
<Card variant="glass">
|
|
68
|
+
<CardContent>...</CardContent>
|
|
69
|
+
</Card>
|
|
70
|
+
```
|
|
71
|
+
|
|
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.
|
|
29
80
|
|
|
30
81
|
## J3M Design Tokens
|
|
31
82
|
- Primary: #F58446 (orange) - use `bg-primary`, `text-primary`
|
|
32
83
|
- Destructive: #FB3748 (red) - use `bg-destructive`
|
|
33
|
-
- Background:
|
|
34
|
-
- Foreground:
|
|
35
|
-
- Muted:
|
|
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`
|
|
36
87
|
- Radius: Components use pill shape (rounded-full) for buttons/inputs
|
|
37
88
|
|
|
38
89
|
## DO
|
|
39
90
|
- Import all components from @j3m-quantum/ui
|
|
40
91
|
- Use Tailwind semantic classes: bg-primary, text-muted-foreground, bg-accent
|
|
41
92
|
- Use CSS variables for custom styling: var(--primary), var(--background)
|
|
93
|
+
- Use `glass-context` class on Cards with interactive components in glass mode
|
|
42
94
|
- Check the component catalogue before building custom components
|
|
95
|
+
- Use the j3m-app-bg class on root element for proper backgrounds
|
|
43
96
|
|
|
44
97
|
## DON'T
|
|
45
98
|
- Don't use shadcn CLI - components are already bundled
|
|
46
|
-
- Don't override CSS
|
|
99
|
+
- Don't override component CSS unless approved by design system maintainer
|
|
47
100
|
- Don't use arbitrary color values like bg-[#F58446] - use bg-primary
|
|
48
101
|
- Don't recreate existing components - use what's in @j3m-quantum/ui
|
|
49
102
|
- Don't modify component border-radius - pill shapes are intentional
|
|
103
|
+
- Don't style portal components manually - they auto-adapt to theme
|
|
104
|
+
|
|
105
|
+
## Available Components (60+)
|
|
106
|
+
|
|
107
|
+
### Inputs
|
|
108
|
+
Button, ButtonGroup, Input, InputGroup, Textarea, Checkbox, RadioGroup, Switch, Slider, Select, NativeSelect, Toggle, ToggleGroup, Form, Field, Label, CopyButton
|
|
109
|
+
|
|
110
|
+
### Display
|
|
111
|
+
Card, Table, Badge, Avatar, UserAvatarsDropdown, Separator, Skeleton, Accordion, Tabs, Calendar, EventCalendar, Carousel, Chart, AspectRatio, Empty, Item, Kbd
|
|
50
112
|
|
|
51
|
-
|
|
52
|
-
|
|
113
|
+
### Feedback
|
|
114
|
+
Alert, AlertDialog, Progress, Tooltip, Sonner (Toast), Spinner
|
|
53
115
|
|
|
54
|
-
|
|
116
|
+
### Navigation
|
|
117
|
+
Breadcrumb, Pagination, Command, SearchTrigger, DropdownMenu, Menubar, NavigationMenu, ContextMenu
|
|
55
118
|
|
|
56
|
-
|
|
119
|
+
### Overlay
|
|
120
|
+
Dialog, Drawer, Sheet, Popover, HoverCard
|
|
57
121
|
|
|
58
|
-
|
|
122
|
+
### Layout
|
|
123
|
+
ScrollArea, Collapsible, Resizable, Sidebar, SidebarProvider, SidebarInset, Section
|
|
59
124
|
|
|
60
|
-
|
|
125
|
+
### Blocks (Pre-built compositions)
|
|
126
|
+
SiteHeader, NavMain, NavProjects, NavSecondary, NavUser, SearchForm
|
|
61
127
|
|
|
62
|
-
|
|
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
|
+
```
|
|
63
184
|
|
|
64
185
|
## Requesting Changes
|
|
65
186
|
Need a new component or styling change? Don't build it locally.
|
|
@@ -105,23 +226,45 @@ export default defineConfig({
|
|
|
105
226
|
```
|
|
106
227
|
|
|
107
228
|
### 5. Add Cursor Rules
|
|
108
|
-
Create `.cursor/rules` in your project root and paste the rules from above.
|
|
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
|
+
}
|
|
241
|
+
```
|
|
109
242
|
|
|
110
|
-
###
|
|
243
|
+
### 7. Use Components
|
|
111
244
|
```tsx
|
|
112
|
-
import {
|
|
245
|
+
import {
|
|
246
|
+
Button,
|
|
247
|
+
Card, CardHeader, CardTitle, CardContent,
|
|
248
|
+
Input,
|
|
249
|
+
ThemeSwitch
|
|
250
|
+
} from '@j3m-quantum/ui'
|
|
113
251
|
|
|
114
252
|
function App() {
|
|
115
253
|
return (
|
|
116
|
-
<
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
</
|
|
120
|
-
<
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
254
|
+
<div className="j3m-app-bg min-h-screen p-8">
|
|
255
|
+
<div className="flex justify-end mb-4">
|
|
256
|
+
<ThemeSwitch />
|
|
257
|
+
</div>
|
|
258
|
+
<Card className="glass-context max-w-md">
|
|
259
|
+
<CardHeader>
|
|
260
|
+
<CardTitle>Welcome</CardTitle>
|
|
261
|
+
</CardHeader>
|
|
262
|
+
<CardContent className="space-y-4">
|
|
263
|
+
<Input placeholder="Enter your name" />
|
|
264
|
+
<Button>Submit</Button>
|
|
265
|
+
</CardContent>
|
|
266
|
+
</Card>
|
|
267
|
+
</div>
|
|
125
268
|
)
|
|
126
269
|
}
|
|
127
270
|
```
|