@trading-game/design-intelligence-layer 0.8.5 → 0.8.7

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.
@@ -2,11 +2,11 @@
2
2
 
3
3
  *High-level product design guidance for designers and AI agents*
4
4
 
5
- Version 1.0 · March 2026
5
+ Version 1.1 · April 2026 · *Updated to align with Product Vision & Strategy*
6
6
 
7
7
  ---
8
8
 
9
- trading.game makes trading feel faster, simpler, and more exciting — without losing the confidence and seriousness that financial products require. These principles define the design personality of the product and guide how AI agents apply components, layouts, motion, copy, and brand assets. This is not a style guide. It is a decision framework — giving AI enough direction to design with the right taste, energy, and priorities without over-constraining creativity.
9
+ trading.game makes trading feel intuitive, fun, and exciting — without losing the confidence and seriousness that financial products require. These principles define the design personality of the product and guide how AI agents apply components, layouts, motion, copy, and brand assets. These principles are rooted in the [trading.game Product Vision & Strategy](trading-game-product-vision.md) and should be read alongside it. This is not a style guide. It is a decision framework — giving AI enough direction to design with the right taste, energy, and priorities without over-constraining creativity.
10
10
 
11
11
  ---
12
12
 
@@ -28,11 +28,11 @@ Every screen should make trading feel central. Game mechanics, rewards, and visu
28
28
 
29
29
  ---
30
30
 
31
- ### 2. Simple by default
31
+ ### 2. Intuitive by default
32
32
 
33
- Complexity must be absorbed by the interface, not pushed onto the user. The product should feel easy to enter, easy to scan, and easy to act on.
33
+ Complexity must be absorbed by the interface, not pushed onto the user. The product should feel natural to navigate, quick to scan, and obvious to act on. Trading is never simple when real money is at stake — but the experience of trading can be intuitive.
34
34
 
35
- *Agent guidance:* Reduce visible choices, sequence decisions clearly, and reveal more only when needed. Make the next step obvious.
35
+ *Agent guidance:* Reduce visible choices, sequence decisions clearly, and reveal more only when needed. Make the next step obvious. Never hide complexity — make it make sense.
36
36
 
37
37
  ---
38
38
 
@@ -94,4 +94,5 @@ Run this before completing any screen or feature.
94
94
  - [ ] Energy comes from the experience, not decoration
95
95
  - [ ] Serious information is treated seriously
96
96
  - [ ] A first-time user would understand this without instructions
97
+ - [ ] The platform layer feels trustworthy enough to deposit real money
97
98
  - [ ] One pattern was reused before a new one was invented
@@ -0,0 +1,602 @@
1
+ # Trading Game Design System Guide
2
+
3
+ > **Package:** `@trading-game/design-intelligence-layer`
4
+ > **Audience:** AI agents and developers building UI for the Trading Game. This is the single source of truth for setting up and using the design system in any project.
5
+
6
+ ---
7
+
8
+ ## MANDATORY RULES — READ FIRST
9
+
10
+ ### Rule 1 — Component existence check
11
+
12
+ ```
13
+ BEFORE using any component:
14
+ 1. Check the Component Catalogue (Section 8). Does it exist?
15
+ YES → Import it from the npm package exactly as documented. Do NOT re-implement it.
16
+ NO → STOP. Tell the user:
17
+ "The [ComponentName] component does not exist in the Trading Game design system.
18
+ Options:
19
+ (a) Build a custom one using design system tokens only (no hardcoded colors or values)
20
+ (b) Use a different component that exists in the system
21
+ (c) Skip this component entirely"
22
+ Wait for the user to choose. Do NOT proceed without confirmation.
23
+ ```
24
+
25
+ ### Rule 2 — Token-only styling
26
+
27
+ ```
28
+ NEVER use:
29
+ ❌ Hardcoded hex: #2323FF, #FFFFFF, etc.
30
+ ❌ Raw Tailwind palette: bg-gray-100, text-zinc-500, text-slate-400, bg-black, bg-white
31
+ ❌ Raw opacity on non-tokens: bg-black/50 (use bg-overlay instead)
32
+ ❌ Arbitrary color values: bg-[#FF6600], text-[rgba(0,0,0,0.5)]
33
+ ❌ hsl(var(--token)) syntax — this is Tailwind v3. This project uses Tailwind v4.
34
+ ❌ Non-existent tokens: bg-hover, bg-badge-rank, text-primary-foreground, text-on-decorative
35
+ ❌ border-border — deprecated alias; use border-border-subtle or border-border-prominent
36
+
37
+ ALWAYS use semantic tokens:
38
+ ✅ bg-background, bg-card, bg-popover, bg-subtle, bg-overlay
39
+ ✅ text-on-prominent, text-on-subtle, text-on-muted
40
+ ✅ border-border-subtle, border-border-prominent, ring-ring
41
+ ✅ bg-primary, bg-primary-hover, bg-secondary-hover
42
+ ✅ text-semantic-win, text-semantic-loss, text-semantic-warning
43
+ ✅ Opacity on a token IS allowed: bg-primary/20, border-border-subtle/50, ring-primary/10
44
+ ```
45
+
46
+ ### Rule 3 — Layout utilities are exempt
47
+
48
+ ```
49
+ Tailwind layout/spacing utilities are freely usable for structural layout:
50
+ ✅ flex, grid, gap-4, p-6, m-2, w-full, h-screen, max-w-lg, col-span-2, etc.
51
+ ✅ z-50, overflow-hidden, transition-all, etc.
52
+
53
+ Token rules apply ONLY to:
54
+ - Color (background, text, border, ring, shadow color)
55
+ - Border radius (use the design system's radius scale — see Section 5)
56
+ - Typography (font family must use font-display or font-body, never raw font names)
57
+ ```
58
+
59
+ ### Rule 4 — Do NOT install or import these separately
60
+
61
+ ```
62
+ ❌ lucide-react — already bundled in the npm package
63
+ ❌ tailwindcss — the package ships its own Tailwind v4 config
64
+ ❌ @apply with hsl(var(--token)) — Tailwind v4 uses CSS variables directly
65
+ ❌ tailwind.config.js — configuration is handled by the package via CSS
66
+ ❌ Manual font-family in CSS — use font-display and font-body utility classes
67
+ ```
68
+
69
+ ### Rule 5 — Complexity-aware implementation
70
+
71
+ ```
72
+ Each component in the catalogue is tagged:
73
+ [simple] → Drop in, one import, works immediately
74
+ [composed] → Has required sub-components; use the full pattern shown
75
+ [complex] → Has significant state or setup; ask clarifying questions first
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 1 — Quick Start
81
+
82
+ ### Step 1 — Install the package
83
+
84
+ ```bash
85
+ npm install @trading-game/design-intelligence-layer@latest --safe-chain-skip-minimum-package-age
86
+ ```
87
+
88
+ ### Step 2 — Add CSS imports
89
+
90
+ In your main CSS file (e.g. `globals.css` or `index.css`):
91
+
92
+ ```css
93
+ @import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap");
94
+ @import "tailwindcss";
95
+ @import "@trading-game/design-intelligence-layer/styles";
96
+ @source "../node_modules/@trading-game/design-intelligence-layer/dist";
97
+ ```
98
+
99
+ > **Note:** Fonts are loaded via a direct Google Fonts `@import` URL. Do NOT use `next/font`.
100
+
101
+ ### Step 3 — Set base HTML class
102
+
103
+ The design system is light-first. No extra class is required on `<html>` for the default light theme. A `.dark` class is reserved for future dark theme support but not yet styled.
104
+
105
+ ### Step 4 — Import components
106
+
107
+ ```tsx
108
+ import { Button, Card, Badge } from "@trading-game/design-intelligence-layer"
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 2 — Design Tokens
114
+
115
+ > This is the single authoritative token reference. All tokens are defined as CSS variables in the package and mapped to Tailwind utility classes automatically.
116
+
117
+ ### 2.1 — Backgrounds
118
+
119
+ | CSS Variable | Tailwind Class | Usage |
120
+ | ---------------- | ---------------- | ------------------------- |
121
+ | `--background` | `bg-background` | Main page background |
122
+ | `--card` | `bg-card` | Cards, panels, modals |
123
+ | `--popover` | `bg-popover` | Popovers, elevated cards |
124
+ | `--subtle` | `bg-subtle` | Muted / secondary surfaces|
125
+ | `--overlay` | `bg-overlay` | Modal/dialog/drawer/sheet backdrop (semi-transparent) |
126
+
127
+ ### 2.2 — Primary (Brand Blue)
128
+
129
+ | CSS Variable | Tailwind Class | Usage |
130
+ | --------------------- | ------------------- | ------------------------- |
131
+ | `--primary` | `bg-primary` / `text-primary` | Primary CTA, brand color, interactive elements |
132
+ | `--primary-hover` | `bg-primary-hover` | Hover & pressed states on primary elements |
133
+
134
+ ### 2.3 — Semantic (Trading Status)
135
+
136
+ | CSS Variable | Tailwind Class | Usage |
137
+ | -------------------- | ----------------------- | ------------------------- |
138
+ | `--semantic-win` | `text-semantic-win` / `bg-semantic-win` | Win / Profit / Positive outcomes |
139
+ | `--semantic-loss` | `text-semantic-loss` / `bg-semantic-loss` | Loss / Negative outcomes |
140
+ | `--semantic-warning` | `text-semantic-warning` / `bg-semantic-warning` | Warning / Caution / Non-destructive alerts |
141
+ | `--semantic-info` | `text-semantic-info` / `bg-semantic-info` | Informational alerts |
142
+
143
+ > All semantic tokens support opacity variants (e.g. `bg-semantic-warning/10` for tinted backgrounds).
144
+
145
+ ### 2.4 — Text & Icon Colors
146
+
147
+ | CSS Variable | Tailwind Class | Usage |
148
+ | ------------------------------- | --------------------------------------- | ------------------------- |
149
+ | `--on-prominent` | `text-on-prominent` | Primary text (headings, body) |
150
+ | `--on-prominent-static-inverse` | `text-on-prominent-static-inverse` | Always-white text (e.g. on primary blue buttons) |
151
+ | `--on-subtle` | `text-on-subtle` | Secondary text (descriptions, labels) |
152
+ | `--on-muted` | `text-on-muted` | Tertiary text (subtle labels, placeholders) |
153
+
154
+ ### 2.5 — Borders & Inputs
155
+
156
+ | CSS Variable | Tailwind Class | Usage |
157
+ | ------------------- | ------------------------- | ------------------------- |
158
+ | `--border-subtle` | `border-border-subtle` | Default light border |
159
+ | `--border-prominent`| `border-border-prominent` | Strong / emphasized border|
160
+ | `--input` | `border-input` | Input resting state border|
161
+ | `--ring` | `ring-ring` / `border-ring` | Focus ring and focus border color |
162
+
163
+ ### 2.6 — Supporting Colors
164
+
165
+ | CSS Variable | Tailwind Class | Usage |
166
+ | ------------------------ | -------------------- | ------------------------- |
167
+ | `--secondary-hover` | `bg-secondary-hover` | Hover bg on neutral elements (light gray) |
168
+ | `--slider-range` | `bg-slider-range` | Slider range fill (primary at 40%) |
169
+ | `--alert-info-text` | `text-alert-info-text` | Alert info text color |
170
+ | `--alert-info-border` | `border-alert-info-border` | Alert info border |
171
+ | `--alert-error-text` | `text-alert-error-text` | Alert error text color |
172
+ | `--alert-error-border` | `border-alert-error-border` | Alert error border |
173
+
174
+ > **Accent (orange) and Violet:** `--primitive-orange-500` and `--primitive-violet-500` are available as CSS variables only (no Tailwind utility class). Use `var(--primitive-orange-500)` directly for rank badges and special highlights.
175
+
176
+ ### 2.7 — Opacity Patterns
177
+
178
+ | Usage | Tailwind Class |
179
+ | ------------------------------ | ---------------------- |
180
+ | Subtle hover tint | `bg-primary/[0.08]` |
181
+ | Medium highlight | `bg-primary/[0.16]` |
182
+ | Selected/active tint | `bg-primary/10` |
183
+ | Status badge tint backgrounds | `bg-semantic-win/10`, `bg-semantic-loss/10`, etc. |
184
+
185
+ ### 2.8 — Interactive States
186
+
187
+ > **`bg-hover` does not exist.** Use `bg-secondary-hover` or `bg-primary/[0.08]` for hover states.
188
+
189
+ **Universal pattern for interactive list/row/chip elements** (except Button and Tabs which have their own):
190
+
191
+ | State | Background | Text |
192
+ | -------- | -------------------- | ---------------------------------- |
193
+ | Default | transparent | `text-on-prominent` or `text-on-subtle` |
194
+ | Hover | `bg-secondary-hover` | `text-primary` |
195
+ | Selected | `bg-secondary-hover` | `text-primary font-semibold` |
196
+
197
+ > **NEVER** use `bg-accent` or `text-accent-foreground`. Do NOT add borders to selected states.
198
+
199
+ ### 2.9 — Transitions
200
+
201
+ **Duration tokens:**
202
+
203
+ | Tailwind Class | CSS Variable | Value | Usage |
204
+ | ----------------- | ------------------------------ | ------ | -------------------------------------- |
205
+ | `duration-instant`| `--primitive-duration-instant` | `50ms` | Focus rings, hover color tints |
206
+ | `duration-fast` | `--primitive-duration-fast` | `100ms`| Buttons, inputs, badges, checkboxes |
207
+ | `duration-base` | `--primitive-duration-base` | `200ms`| Dropdowns, popovers, accordions |
208
+ | `duration-slow` | `--primitive-duration-slow` | `300ms`| Dialogs, sheets, drawers closing |
209
+ | `duration-open` | `--primitive-duration-open` | `500ms`| Sheets, drawers entering |
210
+
211
+ **Easing tokens:**
212
+
213
+ | Tailwind Class | CSS Variable | Value | Usage |
214
+ | ---------------- | ----------------------------- | ------------------------------ | -------------------------------------- |
215
+ | `ease-standard` | `--primitive-ease-standard` | `cubic-bezier(0.2, 0, 0, 1)` | General UI — bidirectional state changes |
216
+ | `ease-enter` | `--primitive-ease-enter` | `cubic-bezier(0, 0, 0.2, 1)` | Overlays / surfaces entering |
217
+ | `ease-exit` | `--primitive-ease-exit` | `cubic-bezier(0.4, 0, 1, 1)` | Overlays / surfaces leaving |
218
+ | `ease-linear` | `--primitive-ease-linear` | `linear` | Sidebar width, progress bar |
219
+
220
+ **Usage pattern:**
221
+
222
+ ```tsx
223
+ <div className="transition-colors duration-fast ease-standard">...</div>
224
+ ```
225
+
226
+ ---
227
+
228
+ ## 3 — AI Agent Decision Rules
229
+
230
+ > Quick-lookup table: "If I need X, use Y, never Z."
231
+
232
+ | IF you need to... | THEN use | NEVER use |
233
+ | -------------------------------------- | --------------------------------- | -------------------------------------- |
234
+ | Pick a primary CTA button color | `bg-primary` | Green, or any other color for primary CTA |
235
+ | Show WIN / profit / positive | `text-semantic-win` | Primary blue for profit |
236
+ | Show LOSS / negative | `text-semantic-loss` | Any non-token red |
237
+ | Show WARNING / caution | `text-semantic-warning` | Raw orange hex or primary tint |
238
+ | Color a page background | `bg-background` | `bg-white` directly |
239
+ | Color a modal/dialog backdrop | `bg-overlay` | `bg-black/50` or raw black opacity |
240
+ | Color a card or panel | `bg-card` | Arbitrary gray |
241
+ | Color an elevated surface (popover) | `bg-popover` | `bg-card` for popovers |
242
+ | Write primary heading text | `text-on-prominent` | Pure white, raw hex colors |
243
+ | Write body / description text | `text-on-subtle` | `text-on-prominent` for descriptions |
244
+ | Write a subtle label | `text-on-muted` | `text-on-subtle` for the subtlest text |
245
+ | Add a default border | `border-border-subtle` | Solid black borders, `border-border` |
246
+ | Add a strong border | `border-border-prominent` | — |
247
+ | Style an input (resting) | `border-input` | Solid colored backgrounds |
248
+ | Style an input (focused) | `border-ring` + `ring-[3px] ring-ring/50` | Generic shadows on inputs |
249
+ | Pick a heading font | `font-display` | System fonts, raw font-family names |
250
+ | Pick a body font | `font-body` | Raw font-family names |
251
+ | Style button text | `font-display font-bold`, sentence case | `uppercase` on buttons |
252
+ | Write white text on a dark surface | `text-on-prominent-static-inverse`| `text-white` or raw white hex |
253
+
254
+ ---
255
+
256
+ ## 4 — Typography
257
+
258
+ ### 4.1 — Font Setup
259
+
260
+ All text uses **Plus Jakarta Sans** (loaded weights: 300–800). Three Tailwind aliases are available — they all resolve to the same font:
261
+
262
+ | Tailwind Class | Purpose |
263
+ | --------------- | ------------------------------- |
264
+ | `font-display` | Headings, wordmark, buttons |
265
+ | `font-body` | Body text, UI elements |
266
+ | `font-sans` | Default sans-serif fallback |
267
+
268
+ ### 4.2 — Pre-built Typography Classes
269
+
270
+ The npm package ships these ready-to-use CSS classes. All include `text-transform: uppercase`:
271
+
272
+ | Class | Size | Line Height | Weight | Letter Spacing |
273
+ | ------------- | ----- | ----------- | ------ | -------------- |
274
+ | `heading-h1` | 72px | 72px | 600 | 1.5px |
275
+ | `heading-h2` | 64px | 64px | 600 | 1.5px |
276
+ | `heading-h3` | 48px | 48px | 600 | 1.5px |
277
+ | `heading-h4` | 40px | 40px | 600 | 1.5px |
278
+ | `heading-xs` | 24px | 24px | 600 | 1.5px |
279
+ | `body-lg` | 18px | 28px | 600 | — |
280
+ | `body-md` | 16px | 24px | 600 | — |
281
+ | `body-sm` | 12px | 16px | 600 | — |
282
+ | `body-xs` | 8px | 12px | 600 | — |
283
+
284
+ **Responsive heading sizes** (headings scale down on mobile):
285
+
286
+ | Class | Desktop | Mobile |
287
+ | ------------ | ------- | ------ |
288
+ | `heading-h1` | 72px | 48px |
289
+ | `heading-h2` | 64px | 48px |
290
+ | `heading-h3` | 48px | 40px |
291
+ | `heading-h4` | 40px | 32px |
292
+ | `heading-xs` | 24px | 20px |
293
+
294
+ ### 4.3 — Custom Text Size Overrides
295
+
296
+ These sizes differ from standard Tailwind defaults — use the design system values:
297
+
298
+ | Class | Size | Line Height | How it differs from Tailwind |
299
+ | ----------- | ------ | ----------- | ---------------------------- |
300
+ | `text-xxs` | 8px | 12px | Custom (not in standard TW) |
301
+ | `text-2xl` | 24px | **24px** | Line height differs (TW: 32px) |
302
+ | `text-3xl` | **32px** | **32px** | Size differs (TW: 30px) |
303
+ | `text-4xl` | **40px** | **40px** | Size differs (TW: 36px) |
304
+ | `text-6xl` | **64px** | **64px** | Size differs (TW: 60px) |
305
+
306
+ > All other `text-*` sizes (`xs`, `sm`, `base`, `lg`, `xl`, `5xl`, `7xl`, `8xl`, `9xl`) match standard Tailwind.
307
+
308
+ ### 4.4 — Typography Usage Rules
309
+
310
+ | Context | Class | Weight |
311
+ | ------------------------ | -------------- | ------------------- |
312
+ | Page headings | `font-display` | `font-semibold` (600) |
313
+ | Button labels | `font-display` | `font-bold` (700), sentence case |
314
+ | Body text | `font-body` | `font-semibold` (600) |
315
+ | Tiny labels / decorative | `font-body` | `font-semibold` (600) at 8px |
316
+
317
+ ### 4.5 — Letter Spacing Tokens
318
+
319
+ | Token value | Usage |
320
+ | ----------- | ------------------------ |
321
+ | 1.5px | Buttons, headings |
322
+ | -0.4px | Paragraphs, tight text |
323
+ | -0.8px | Tight display text |
324
+
325
+ ---
326
+
327
+ ## 5 — Border Radius
328
+
329
+ The design system uses a custom radius scale (base = 10px). Use these named tokens instead of arbitrary values:
330
+
331
+ | Tailwind Class | Value |
332
+ | -------------- | ------ |
333
+ | `rounded-2xs` | 2px |
334
+ | `rounded-xs` | 4px |
335
+ | `rounded-sm` | 6px |
336
+ | `rounded-md` | 8px |
337
+ | `rounded-lg` | 10px |
338
+ | `rounded-xl` | 14px |
339
+ | `rounded-2xl` | 18px |
340
+ | `rounded-3xl` | 22px |
341
+ | `rounded-4xl` | 26px |
342
+ | `rounded-full` | 9999px |
343
+
344
+ > **Important:** Do NOT use `rounded-[4px]` or `rounded-[2px]` — use `rounded-xs` and `rounded-2xs` instead. Arbitrary radius values should only be used for sizes not in this scale (e.g. `rounded-[24px]`, `rounded-[32px]`).
345
+
346
+ ---
347
+
348
+ ## 6 — Button System
349
+
350
+ ### 6.1 — Variants
351
+
352
+ | Variant | Background | Text Color | Border | Hover |
353
+ | ----------- | ---------------------- | ---------------------------------- | ----------------------------------- | ----------------------- |
354
+ | `primary` | `bg-primary` | `text-on-prominent-static-inverse` | none | `bg-primary-hover` |
355
+ | `secondary` | transparent | `text-on-prominent` | `border-[1.5px] border-border-prominent` | `bg-secondary-hover` |
356
+ | `tertiary` | transparent | `text-primary` | none | `bg-primary/[0.08]` |
357
+
358
+ ### 6.2 — Sizes
359
+
360
+ | Size | Height | Padding X | Font Size | Icon Size | Radius |
361
+ | --------- | ------ | --------- | --------- | --------- | ------ |
362
+ | `lg` | 48px | 24px | 16px | 16px | 4px |
363
+ | `md` | 40px | 16px | 14px | 16px | 4px |
364
+ | `sm` | 32px | 12px | 12px | 14px | 4px |
365
+ | `xs` | 24px | 8px | 12px | 12px | 4px |
366
+
367
+ **Icon-only sizes:**
368
+
369
+ | Size | Dimensions | Icon Size |
370
+ | ---------- | ---------- | --------- |
371
+ | `icon-lg` | 48×48px | 16px |
372
+ | `icon-md` | 40×40px | 16px |
373
+ | `icon-sm` | 28×28px | 16px |
374
+ | `icon-xs` | 24×24px | 12px |
375
+
376
+ ### 6.3 — Button Typography & States
377
+
378
+ All buttons: `font-display font-bold`, sentence case (no `uppercase`, no `tracking-wide`).
379
+
380
+ | State | Behavior |
381
+ | -------- | ------------------------------------------------ |
382
+ | Default | Base styling per variant |
383
+ | Hover | Color shift per variant (see above) |
384
+ | Focus | 3px ring with `ring-ring/50` opacity |
385
+ | Pressed | `active:opacity-60` |
386
+ | Loading | `opacity-50`, `pointer-events-none`, `data-loading`, `aria-busy` |
387
+ | Disabled | `opacity-50`, `pointer-events-none` |
388
+
389
+ ---
390
+
391
+ ## 7 — Responsive Layout
392
+
393
+ ### 7.1 — Layout Grid
394
+
395
+ | Breakpoint | Viewport | Columns | Gutter | Margin |
396
+ | ---------- | ---------- | ------- | ------ | ------ |
397
+ | Default | 0–319px | 1 | 0 | 16px |
398
+ | Small | 320–599px | 4 | 16px | 16px |
399
+ | Medium | 600–1135px | 8 | 36px | 36px |
400
+ | Large | 1136px+ | 12 | 36px | 64px |
401
+
402
+ **Tailwind utilities:** `gap-layout-gutter`, `px-layout-margin-inline`.
403
+
404
+ **CSS variables for custom grids:** `var(--semantic-layout-grid-columns)`, `var(--spacing-layout-gutter)`, `var(--spacing-layout-margin-inline)`.
405
+
406
+ ### 7.2 — Responsive Spacing Tokens
407
+
408
+ | Token | Desktop | Mobile |
409
+ | -------------------- | ------- | ------ |
410
+ | container-padding-x | 24px | 16px |
411
+ | section-padding-y | 96px | 64px |
412
+ | section-title-gap-xl | 24px | 20px |
413
+ | section-title-gap-lg | 20px | 16px |
414
+ | section-title-gap-md | 20px | 16px |
415
+ | section-title-gap-sm | 16px | 16px |
416
+
417
+ ---
418
+
419
+ ## 8 — Available Components
420
+
421
+ > **All components below are exported from `@trading-game/design-intelligence-layer`.**
422
+ > - If a component is listed → import and use it. Do NOT re-implement.
423
+ > - If NOT listed → STOP and ask the user (see Rule 1).
424
+ > - For props, variants, sizes, and sub-components → inspect the package's TypeScript types after installation.
425
+
426
+ ### Import pattern
427
+
428
+ All components use the same import path:
429
+
430
+ ```tsx
431
+ import { Button, Card, Badge } from "@trading-game/design-intelligence-layer"
432
+ ```
433
+
434
+ ### Example — composed component with sub-components
435
+
436
+ ```tsx
437
+ import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } from "@trading-game/design-intelligence-layer"
438
+
439
+ <Dialog>
440
+ <DialogTrigger asChild><Button>Open</Button></DialogTrigger>
441
+ <DialogContent showCloseButton>
442
+ <DialogHeader>
443
+ <DialogTitle>Title</DialogTitle>
444
+ <DialogDescription>Description text.</DialogDescription>
445
+ </DialogHeader>
446
+ <div>Content here</div>
447
+ <DialogFooter>
448
+ <Button variant="primary" size="md">Confirm</Button>
449
+ </DialogFooter>
450
+ </DialogContent>
451
+ </Dialog>
452
+ ```
453
+
454
+ ### Component list
455
+
456
+ > **Complexity tags:** `[simple]` = drop in, one import | `[composed]` = has required sub-components | `[complex]` = has significant state/setup, ask the user first
457
+
458
+ | Component | Tag | Sub-components |
459
+ |-----------|-----|----------------|
460
+ | Accordion | [composed] | AccordionItem, AccordionTrigger, AccordionContent |
461
+ | Alert | [composed] | AlertTitle, AlertDescription |
462
+ | AlertDialog | [complex] | AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, AlertDialogMedia |
463
+ | AspectRatio | [simple] | — |
464
+ | Avatar | [composed] | AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup, AvatarGroupCount |
465
+ | Badge | [simple] | — |
466
+ | Breadcrumb | [composed] | BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis |
467
+ | Button | [simple] | — |
468
+ | Calendar | [complex] | — |
469
+ | Card | [composed] | CardHeader, CardTitle, CardDescription, CardContent, CardFooter, CardAction |
470
+ | Carousel | [complex] | CarouselContent, CarouselItem, CarouselPrevious, CarouselNext |
471
+ | Chart | [complex] | ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle |
472
+ | Checkbox | [simple] | — |
473
+ | Collapsible | [composed] | CollapsibleTrigger, CollapsibleContent |
474
+ | Combobox | [complex] | ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxEmpty, ComboboxGroup, ComboboxLabel |
475
+ | Command | [complex] | CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator, CommandShortcut |
476
+ | ContextMenu | [composed] | ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuLabel, ContextMenuCheckboxItem, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent |
477
+ | Dialog | [complex] | DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, DialogClose |
478
+ | DirectionProvider | [simple] | — |
479
+ | Drawer | [complex] | DrawerTrigger, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription, DrawerClose |
480
+ | DropdownMenu | [composed] | DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuShortcut |
481
+ | Empty | [composed] | EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent |
482
+ | Field | [complex] | FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSet, FieldContent, FieldTitle, FieldSeparator |
483
+ | Form | [complex] | FormField, FormItem, FormLabel, FormControl, FormDescription, FormMessage |
484
+ | HoverCard | [composed] | HoverCardTrigger, HoverCardContent |
485
+ | Input | [simple] | — |
486
+ | InputGroup | [composed] | InputGroupAddon, InputGroupInput, InputGroupButton, InputGroupText, InputGroupTextarea |
487
+ | InputOTP | [composed] | InputOTPGroup, InputOTPSlot, InputOTPSeparator |
488
+ | Item | [composed] | ItemGroup, ItemContent, ItemTitle, ItemDescription, ItemMedia, ItemActions, ItemHeader, ItemFooter, ItemSeparator |
489
+ | Kbd | [simple] | KbdGroup |
490
+ | Label | [simple] | — |
491
+ | Link | [simple] | — |
492
+ | Menubar | [complex] | MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, MenubarSeparator, MenubarLabel, MenubarCheckboxItem, MenubarRadioGroup, MenubarRadioItem, MenubarSub, MenubarSubTrigger, MenubarSubContent, MenubarShortcut |
493
+ | NavigationMenu | [complex] | NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, navigationMenuTriggerStyle |
494
+ | NativeSelect | [simple] | NativeSelectOption, NativeSelectOptGroup |
495
+ | Pagination | [composed] | PaginationContent, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext, PaginationEllipsis |
496
+ | Popover | [composed] | PopoverTrigger, PopoverContent, PopoverHeader, PopoverTitle, PopoverDescription |
497
+ | Progress | [simple] | — |
498
+ | RadioGroup | [composed] | RadioGroupItem |
499
+ | Resizable | [complex] | ResizablePanelGroup, ResizablePanel, ResizableHandle |
500
+ | ScrollArea | [simple] | ScrollBar |
501
+ | Select | [composed] | SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, SelectItem, SelectSeparator |
502
+ | Separator | [simple] | — |
503
+ | Sheet | [complex] | SheetTrigger, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, SheetClose |
504
+ | Sidebar | [complex] | SidebarProvider, SidebarTrigger, SidebarInset, SidebarHeader, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarRail, useSidebar |
505
+ | Skeleton | [simple] | — |
506
+ | Slider | [simple] | — |
507
+ | Sonner (Toaster) | [simple] | — (also import `toast` from `sonner`) |
508
+ | Spinner | [simple] | — |
509
+ | Switch | [simple] | — |
510
+ | Table | [composed] | TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption |
511
+ | Tabs | [composed] | TabsList (`variant`: default/line, `size`: sm/md/lg), TabsTrigger (`iconPosition`: inline/top), TabsContent. Root accepts `orientation`: horizontal/vertical. |
512
+ | Textarea | [simple] | — |
513
+ | TicketCard | [composed] | — |
514
+ | Toggle | [simple] | — |
515
+ | ToggleGroup | [composed] | ToggleGroupItem |
516
+ | Tooltip | [composed] | TooltipTrigger, TooltipContent, TooltipProvider |
517
+
518
+ ### Component styling notes
519
+
520
+ These are styling behaviors you can't discover from TypeScript types alone:
521
+
522
+ | Component | Note |
523
+ |-----------|------|
524
+ | Button | `font-display font-bold`, sentence case (no `uppercase`). Primary: `text-on-prominent-static-inverse`. Tertiary hover: `bg-primary/[0.08]` |
525
+ | Card | Flat by default (no shadow). Add elevation manually: `className="shadow-sm"` |
526
+ | Input | Resting: `border-input`. Focus: `border-ring` + `ring-[3px] ring-ring/50`. Radius: `rounded-sm` (6px) |
527
+ | Tooltip | Bubble: `bg-primary` + `text-on-prominent-static-inverse` (not `bg-popover`). Always wrap in `<TooltipProvider>` |
528
+ | Sidebar | Menu buttons use `rounded-sm`. Selection: `bg-secondary-hover` + `text-primary` + `font-semibold` |
529
+ | Breadcrumb | Active page: `text-primary font-medium`. Links: `text-on-subtle` |
530
+ | Tabs | **Variants:** `default` (pill, `bg-subtle`) and `line` (underline, transparent bg). **Sizes:** `sm` (h-8, text-xs), `md` (h-10, text-sm, default), `lg` (h-12, text-base). **Icon position:** `inline` (default) or `top` (stacks icon above label). **Orientation:** `horizontal` (default) or `vertical` (line variant renders left-edge indicator). Hover: `bg-secondary-hover` (default) / `text-primary` (line). Selected: `bg-background` + `text-primary font-semibold`. Line variant underline: `bg-primary`. |
531
+ | Select | Item hover: `bg-primary/[0.08]`. Selected: `text-primary font-medium` + checkmark |
532
+ | Progress | Track: `bg-primary/20`. Indicator: `bg-primary`. Radius: `rounded-2xs` |
533
+ | Spinner | Inherits parent text color. **Always pass `text-primary` for standalone use** |
534
+ | Switch | Checked track: `bg-slider-range`. Checked thumb: `bg-primary` |
535
+ | Slider | Thumb: square `rounded-[4px]`, `bg-primary`. Track range: `bg-slider-range` |
536
+ | Dialog/Sheet | Footer buttons should use `size="md"`. Overlay: `bg-overlay` |
537
+ | Menubar | Hover: `bg-primary/[0.08]`. Open state: `bg-primary/10` |
538
+ | Toggle | Pressed: `bg-primary/10` + `border-primary` + `text-primary` |
539
+ | Calendar | Selected: `bg-secondary-hover` + `text-primary font-bold`. Today: primary dot below date |
540
+
541
+ ---
542
+
543
+ ## 9 — Common Mistakes
544
+
545
+ | Mistake | Correct Approach |
546
+ | ------- | ---------------- |
547
+ | Using hardcoded hex (`#2323FF`) for primary | Use `bg-primary` or `text-primary` |
548
+ | Using `bg-white` or `bg-black` | Use `bg-background` or `bg-overlay` |
549
+ | Using `border-border` | Use `border-border-subtle` or `border-border-prominent` |
550
+ | Using `bg-hover` | Use `bg-primary/[0.08]` or `bg-secondary-hover` |
551
+ | Using `text-primary-foreground` | Use `text-on-prominent-static-inverse` |
552
+ | Using `text-on-decorative` | Use `text-on-muted` |
553
+ | Using `font-mono` expecting Plus Jakarta Sans | Use `font-display` or `font-body` |
554
+ | Using `font-bold` for headings | Use `font-semibold` (600) for headings |
555
+ | Using `uppercase` on buttons | Buttons use sentence case (no `uppercase`) |
556
+ | Using standard TW sizes for headings (e.g. `text-6xl` = 60px) | Use design system values (`text-6xl` = 64px in this system) |
557
+ | Forgetting responsive heading sizes | Headings scale down on mobile (see Section 4.2) |
558
+ | Using `rounded-[4px]` or `rounded-[2px]` | Use `rounded-xs` (4px) or `rounded-2xs` (2px) |
559
+ | Installing `lucide-react` separately | Already bundled — import icons directly |
560
+ | Adding `tailwind.config.js` | Tailwind v4 uses CSS config via the package |
561
+ | Using `bg-gray-*`, `text-zinc-*`, etc. | Use semantic tokens only |
562
+
563
+ ---
564
+
565
+ ## 10 — Accessibility Notes
566
+
567
+ 1. **Primary blue text on white** (~3.0:1) — reserve for large/bold UI labels only.
568
+ 2. **Secondary text `text-on-subtle` on white** (~4.5:1) — meets WCAG AA for normal text.
569
+ 3. **Tertiary text `text-on-muted` on white** (~7.0:1) — safe for all sizes.
570
+ 4. **Win green on white** (~5.0:1) — safe for normal text at AA.
571
+ 5. **Loss red on white** (~3.9:1) — use at 18px+ bold or pair with icons.
572
+ 6. Always pair semantic colors with **icons or labels** — never communicate meaning through color alone.
573
+
574
+ ---
575
+
576
+ ## Quick Reference — Code Snippets
577
+
578
+ **Primary CTA:**
579
+ ```tsx
580
+ <Button variant="primary" size="lg">Trade Now</Button>
581
+ ```
582
+
583
+ **Profit/Loss display:**
584
+ ```tsx
585
+ <span className="text-semantic-win font-body font-semibold">+$84.00</span>
586
+ <span className="text-semantic-loss font-body font-semibold">-$120.00</span>
587
+ ```
588
+
589
+ **Heading:**
590
+ ```tsx
591
+ <h1 className="heading-h1">Trading Game</h1>
592
+ ```
593
+
594
+ **Body text:**
595
+ ```tsx
596
+ <p className="body-md">Your portfolio summary for today.</p>
597
+ ```
598
+
599
+ **Input with focus styling:**
600
+ ```tsx
601
+ <Input type="email" placeholder="Enter your email" />
602
+ ```
@@ -199,7 +199,7 @@ When the user asks to **update**, **upgrade**, or **install the latest** `@tradi
199
199
  3. **Notify on replace** — If you **delete, replace, or substantially overwrite** local component code to match the package, **stop and tell the user clearly**, e.g.
200
200
  `Aligned [ComponentName] with @trading-game/design-intelligence-layer@[version]. Previous local behavior or classes: [short summary]. Re-apply needs via package variants/props, tokens, or a thin wrapper only if product requires it.`
201
201
  4. **Review `className` overrides** — Parent apps often pass `className` on DS components. Old overrides (radius, colors, shadows) can **hide** new defaults (e.g. pill buttons). After upgrade, scan for overrides on DS components and trim or adjust them when they conflict with the new design.
202
- 5. **Refresh Cursor rules** — The package ships `docs/rules/design-system-consuming-project.mdc`. Cursor does **not** read it from `node_modules` automatically. Tell the user to re-copy it (see README **AI Agent Setup → Cursor**) so agent instructions match the release.
202
+ 5. **Refresh Cursor rules** — The package ships `guides/rules/design-system-consuming-project.mdc`. Cursor does **not** read it from `node_modules` automatically. Tell the user to re-copy it (see README **AI Agent Setup → Cursor**) so agent instructions match the release.
203
203
  6. **Tailwind** — Confirm `@source` still points at `node_modules/@trading-game/design-intelligence-layer/dist` so Tailwind v4 emits classes from the updated bundle.
204
204
 
205
205
  ### Do not assume
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trading-game/design-intelligence-layer",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "Trading Game Design System — shadcn/ui components with Tailwind CSS v4",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -34,7 +34,7 @@
34
34
  "files": [
35
35
  "dist/",
36
36
  "src/styles.css",
37
- "docs/",
37
+ "guides/",
38
38
  "AGENTS.md"
39
39
  ],
40
40
  "publishConfig": {