@trading-game/design-intelligence-layer 0.14.0 → 0.15.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/AGENTS.md +140 -1
- package/README.md +15 -6
- package/dist/index.cjs +506 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +186 -1
- package/dist/index.d.ts +186 -1
- package/dist/index.js +498 -0
- package/dist/index.js.map +1 -1
- package/guides/design-system-guide/trading-game-ds-guide.md +199 -33
- package/guides/rules/design-system-consuming-project.mdc +19 -11
- package/package.json +1 -1
- package/src/styles.css +22 -0
package/AGENTS.md
CHANGED
|
@@ -57,7 +57,7 @@ cp node_modules/@trading-game/design-intelligence-layer/guides/rules/design-syst
|
|
|
57
57
|
3. **Design principles and accessibility first** — every screen must reflect the 8 design principles and meet the accessibility standards (WCAG 2.1 AA). Run both checklists before shipping.
|
|
58
58
|
4. **No separate installs** — do not install `lucide-react`, `tailwindcss`, or other bundled dependencies separately.
|
|
59
59
|
5. **After a version bump** — re-copy the rules file into `.cursor/rules/`, check for stale local component copies, and align them with the package.
|
|
60
|
-
6. **Blocks are
|
|
60
|
+
6. **Blocks are first-class exports** — Blocks (Hero, Auth, FAQ, NavBar, HeaderNavigation, OpenPositions, Result) are exported from the package the same as primitives. Import them by name and pass data via props. See the `## Blocks` section below for the full catalog.
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
@@ -69,3 +69,142 @@ cp node_modules/@trading-game/design-intelligence-layer/guides/rules/design-syst
|
|
|
69
69
|
- Personas: `node_modules/@trading-game/design-intelligence-layer/guides/personas/trading-game-player-field-guide.md`
|
|
70
70
|
- Brand voice: `node_modules/@trading-game/design-intelligence-layer/guides/brand-voice/trading-game-brand-voice.md`
|
|
71
71
|
- Full agent rules: `node_modules/@trading-game/design-intelligence-layer/guides/rules/design-system-consuming-project.mdc`
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Blocks
|
|
76
|
+
|
|
77
|
+
The package ships eight opinionated, composed blocks alongside the UI primitives. Each block is a single `import` away and accepts data via props. Variants are modeled as a `variant` / `layout` / `mode` prop on one block, not as separate components.
|
|
78
|
+
|
|
79
|
+
### `HeroBlock`
|
|
80
|
+
|
|
81
|
+
Marketing hero section with centred or split-column layout.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { HeroBlock } from "@trading-game/design-intelligence-layer"
|
|
85
|
+
|
|
86
|
+
<HeroBlock
|
|
87
|
+
layout="centered" // "centered" | "split"
|
|
88
|
+
tagline={{ label: "What's new", suffix: "v2.0" }}
|
|
89
|
+
heading="Solve your customer's main problem"
|
|
90
|
+
body="One or two sentences expanding on the value prop."
|
|
91
|
+
primaryCta={{ label: "Get started", onClick: ... }}
|
|
92
|
+
secondaryCta={{ label: "Learn more", onClick: ... }} // split layout only
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### `AuthBlock`
|
|
97
|
+
|
|
98
|
+
Sign-in / sign-up form with OAuth providers, divider, email input, terms, and cross-link.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { AuthBlock } from "@trading-game/design-intelligence-layer"
|
|
102
|
+
|
|
103
|
+
<AuthBlock
|
|
104
|
+
mode="sign-in" // "sign-in" | "sign-up"
|
|
105
|
+
logoSrc="/path/to/brand-icon.svg"
|
|
106
|
+
providers={["google", "telegram", "x"]} // default: all three
|
|
107
|
+
onSubmit={({ email }) => { ... }}
|
|
108
|
+
crossLinkHref="/auth/signup"
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### `FAQBlock`
|
|
113
|
+
|
|
114
|
+
Eyebrow + heading + intro + accordion + optional "Need more help" card.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { FAQBlock } from "@trading-game/design-intelligence-layer"
|
|
118
|
+
|
|
119
|
+
<FAQBlock
|
|
120
|
+
layout="desktop" // "desktop" | "mobile"
|
|
121
|
+
items={[{ value: "q1", question: "...", answer: "..." }, ...]}
|
|
122
|
+
intro={<>Optional intro paragraph with a <Link>link</Link>.</>}
|
|
123
|
+
helpCard={{ title: "Need more help?", body: "...", ctaLabel: "Contact us" }}
|
|
124
|
+
/>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `NavBarBlock`
|
|
128
|
+
|
|
129
|
+
Responsive marketing nav with brand mark, link buttons, sign-in/up CTAs, and an internal mobile drawer.
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { NavBarBlock } from "@trading-game/design-intelligence-layer"
|
|
133
|
+
|
|
134
|
+
<NavBarBlock
|
|
135
|
+
brand={{ fullLogoSrc: "...", iconLogoSrc: "...", alt: "Brand" }}
|
|
136
|
+
links={[{ label: "Products" }, { label: "Docs" }, ...]}
|
|
137
|
+
signIn={{ onClick: ... }}
|
|
138
|
+
signUp={{ onClick: ... }}
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `HeaderNavigationBlock`
|
|
143
|
+
|
|
144
|
+
In-app trading header (back · badge · balance · history · action slot). History icon supports an overlaid count badge in `bg-primary`.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
import { HeaderNavigationBlock } from "@trading-game/design-intelligence-layer"
|
|
148
|
+
|
|
149
|
+
<HeaderNavigationBlock
|
|
150
|
+
onBack={() => router.back()}
|
|
151
|
+
badge={{ label: "Demo", variant: "fill-warning" }}
|
|
152
|
+
balance={{ amount: "1000.00", currency: "USDT" }}
|
|
153
|
+
history={{ count: 5, onClick: openHistorySheet }} // count 0 hides badge; >99 shows "99+"
|
|
154
|
+
actions={<SoundToggleButton />}
|
|
155
|
+
/>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `OpenPositionsBlock`
|
|
159
|
+
|
|
160
|
+
Responsive Sheet (desktop) / Drawer (mobile) containing a list of game positions. Positions are a discriminated union by `kind`: `"rise-fall" | "swipe" | "box-o" | "digits"`.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { OpenPositionsBlock, Position } from "@trading-game/design-intelligence-layer"
|
|
164
|
+
|
|
165
|
+
const positions: Position[] = [
|
|
166
|
+
{ kind: "rise-fall", direction: "Rise", market: "Vol 100", duration: "30 minutes",
|
|
167
|
+
stake: "1.00 USDT", pnl: "+0.96 USDT", win: true },
|
|
168
|
+
...
|
|
169
|
+
]
|
|
170
|
+
|
|
171
|
+
<OpenPositionsBlock
|
|
172
|
+
trigger={<Button variant="secondary">Active trades</Button>}
|
|
173
|
+
positions={positions}
|
|
174
|
+
sheetTitle="Positions"
|
|
175
|
+
onViewHistory={openHistoryPage}
|
|
176
|
+
/>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### `ResultBlock`
|
|
180
|
+
|
|
181
|
+
Universal win/loss result card with animated halo + thumb illustration + contract badge + duration badge + CTA. Thumb icons are bundled inside the package.
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { ResultBlock } from "@trading-game/design-intelligence-layer"
|
|
185
|
+
|
|
186
|
+
<ResultBlock
|
|
187
|
+
status="win" // "win" | "loss"
|
|
188
|
+
amount="10,000.00"
|
|
189
|
+
currency="USDT"
|
|
190
|
+
contractLabel="Rise"
|
|
191
|
+
duration="2 hours"
|
|
192
|
+
pickedDigit={7} // optional, for Digits contracts
|
|
193
|
+
ctaMode="next-round" // "next-round" | "go-again" | "conversion"
|
|
194
|
+
/>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### `ResultDialog`
|
|
198
|
+
|
|
199
|
+
Fixed-width system dialog (title + body + two CTAs). Used for messages like "out of balance".
|
|
200
|
+
|
|
201
|
+
```tsx
|
|
202
|
+
import { ResultDialog } from "@trading-game/design-intelligence-layer"
|
|
203
|
+
|
|
204
|
+
<ResultDialog
|
|
205
|
+
title="You're out of balance."
|
|
206
|
+
body="Deposit to keep playing or stay in demo mode."
|
|
207
|
+
primaryLabel="Deposit now"
|
|
208
|
+
secondaryLabel="Stay in demo"
|
|
209
|
+
/>
|
|
210
|
+
```
|
package/README.md
CHANGED
|
@@ -159,15 +159,24 @@ npm install react react-dom tailwindcss
|
|
|
159
159
|
|
|
160
160
|
## Blocks
|
|
161
161
|
|
|
162
|
-
Blocks are
|
|
162
|
+
Blocks are opinionated, composed UI patterns built from design system primitives — **exported from the package the same as primitives**. Import them by name and pass data via props. Variants (`layout` / `mode` / `status`) live on a single block, not separate components.
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { HeroBlock, ResultBlock, OpenPositionsBlock } from "@trading-game/design-intelligence-layer"
|
|
166
|
+
```
|
|
163
167
|
|
|
164
168
|
| Block | Variants | Description |
|
|
165
169
|
|---|---|---|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
170
|
+
| `HeroBlock` | `layout: "centered" \| "split"` | Marketing hero section. Centred = single-column, no image; split = two-column with image. Tagline pill, heading, body, primary + optional secondary CTA. |
|
|
171
|
+
| `AuthBlock` | `mode: "sign-in" \| "sign-up"` | Auth form — logo lockup, OAuth provider buttons (Google, Telegram, X), divider, email input, terms, primary CTA, footer cross-link. |
|
|
172
|
+
| `FAQBlock` | `layout: "desktop" \| "mobile"` | Eyebrow + heading + intro + accordion + optional "Need more help" card. Items passed as `{ value, question, answer }[]`. |
|
|
173
|
+
| `NavBarBlock` | — (internal mobile-menu state) | Responsive marketing nav — brand logos, link buttons, Sign in / Sign up CTAs, hamburger drawer on mobile. |
|
|
174
|
+
| `HeaderNavigationBlock` | — | In-app trading header. Back · badge · balance · optional history button with `history.count` numeric badge (`bg-primary`; ≥99 → `99+`) · actions slot. |
|
|
175
|
+
| `OpenPositionsBlock` | `Position` discriminated union (`rise-fall` / `swipe` / `box-o` / `digits`) | Responsive Sheet (desktop) / Drawer (mobile) listing open positions. Consumer-provided trigger; default empty state. |
|
|
176
|
+
| `ResultBlock` | `status: "win" \| "loss"`, `ctaMode: "next-round" \| "go-again" \| "conversion"` | Win/loss result card. Animated halo + thumb illustration (bundled inline) + contract badge + duration badge + CTA. |
|
|
177
|
+
| `ResultDialog` | — | Fixed-width system dialog (title + body + two CTAs). For messages like "out of balance" or "on a roll". |
|
|
178
|
+
|
|
179
|
+
See [`AGENTS.md`](./AGENTS.md#blocks) for full usage examples per block.
|
|
171
180
|
|
|
172
181
|
---
|
|
173
182
|
|