@trading-game/design-intelligence-layer 0.16.0 → 0.16.2
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 +21 -0
- package/README.md +54 -8
- package/dist/index.cjs +944 -801
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -4
- package/dist/index.d.ts +49 -4
- package/dist/index.js +915 -774
- package/dist/index.js.map +1 -1
- package/guides/design-system-guide/trading-game-ds-guide.md +6 -4
- package/package.json +1 -1
- package/src/styles.css +11 -3
package/AGENTS.md
CHANGED
|
@@ -61,6 +61,27 @@ cp node_modules/@trading-game/design-intelligence-layer/guides/rules/design-syst
|
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
|
+
## Step 4 — New-component release checklist (MANDATORY)
|
|
65
|
+
|
|
66
|
+
Every time you add a new component (UI primitive or Block) to this package, **all** of the following must land in the same PR. Skipping any one of these has shipped broken releases before — npm consumers got a version where the component existed in the demo but couldn't be imported. Do not skip a step.
|
|
67
|
+
|
|
68
|
+
1. **Source file** — `components/ui/<name>.tsx` (or `components/blocks/<name>-block.tsx`)
|
|
69
|
+
2. **Public export** — add the matching `export * from "../components/<…>/<name>"` line to `src/index.ts`. **This is what gates whether npm consumers receive the component at all.** The demo at `app/page.tsx` imports via the `@/components/...` alias and will work without this — but the published package will not ship the component until this line exists.
|
|
70
|
+
3. **Auto-generated registry** — run `npm run generate:registry` so `app/component-registry.generated.ts` picks the new file up.
|
|
71
|
+
4. **Demo entry** — add a sidebar entry in the `componentNames` list in `app/page.tsx`, and a `case "<Name>":` block in the `SectionContent` switch that renders representative variants.
|
|
72
|
+
5. **README** — add a row in the "Available components" table and a per-component section explaining variants / slots / behaviour.
|
|
73
|
+
6. **Design system guide** (`guides/design-system-guide/trading-game-ds-guide.md`) — add a row in the §8 component list table and a styling-notes entry covering tokens used, edge cases, and `aria` posture.
|
|
74
|
+
7. **Build verification** — run `npm run build` and confirm the component name appears in `dist/index.js` and `dist/index.d.ts` before tagging a release:
|
|
75
|
+
```bash
|
|
76
|
+
npm run build
|
|
77
|
+
grep -c "<ComponentName>" dist/index.js dist/index.d.ts # both > 0
|
|
78
|
+
```
|
|
79
|
+
8. **Version + publish** — only after every step above is checked in, bump `package.json`, commit, push, tag `v<version>`, and let the workflow publish.
|
|
80
|
+
|
|
81
|
+
If any of these are missing at the time of release, the published package is broken — fix and re-release before moving on.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
64
85
|
## Reference
|
|
65
86
|
|
|
66
87
|
- Full token + component reference: `node_modules/@trading-game/design-intelligence-layer/README.md`
|
package/README.md
CHANGED
|
@@ -98,10 +98,11 @@ npm install react react-dom tailwindcss
|
|
|
98
98
|
| Component | Import |
|
|
99
99
|
|---|---|
|
|
100
100
|
| Accordion | `Accordion, AccordionItem, AccordionTrigger, AccordionContent` |
|
|
101
|
-
| Alert | `Alert` — dismissible
|
|
101
|
+
| Alert | `Alert` — dismissible status notification. Variants: `info`, `warning`, `danger`, `success`. Layouts: `inline`, `card`. Slots: `title`, `description`, `icon`, `action`, `actions`, `onDismiss`. |
|
|
102
102
|
| Alert Dialog | `AlertDialog, AlertDialogTrigger, AlertDialogContent, ...` |
|
|
103
103
|
| Avatar | `Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup` |
|
|
104
104
|
| Badge | `Badge, badgeVariants` |
|
|
105
|
+
| Banner | `Banner` — dismissible promotional surface. Single visual treatment (light-blue diagonal gradient). Layouts: `inline`, `card`. Slots: `title`, `description`, `icon`, `action`, `actions`, `onDismiss`, `onClick` (whole-banner clickable). |
|
|
105
106
|
| Breadcrumb | `Breadcrumb, BreadcrumbList, BreadcrumbItem, ...` |
|
|
106
107
|
| Button | `Button, buttonVariants` |
|
|
107
108
|
| Calendar | `Calendar, CalendarDayButton` |
|
|
@@ -232,8 +233,9 @@ States: hover (`bg-secondary-hover`), focus (3px `ring-ring/50`), active (`opaci
|
|
|
232
233
|
<Badge variant="fill" /> // Blue tint
|
|
233
234
|
<Badge variant="fill-success" /> // Green tint
|
|
234
235
|
<Badge variant="fill-fail" /> // Red tint
|
|
235
|
-
<Badge variant="fill-warning" /> //
|
|
236
|
-
<Badge variant="fill-credit" /> //
|
|
236
|
+
<Badge variant="fill-warning" /> // Yellow tint — status/warning
|
|
237
|
+
<Badge variant="fill-credit" /> // Light peach — credit/bonus labels
|
|
238
|
+
<Badge variant="fill-demo" /> // Red-orange tint — demo/test-mode flags
|
|
237
239
|
|
|
238
240
|
// Outline (black border, secondary-hover on hover)
|
|
239
241
|
<Badge variant="outline" />
|
|
@@ -251,12 +253,10 @@ States: hover (`bg-secondary-hover`), focus (3px `ring-ring/50`), active (`opaci
|
|
|
251
253
|
|
|
252
254
|
## Alert variants
|
|
253
255
|
|
|
254
|
-
Dismissible
|
|
256
|
+
Dismissible **status** notification (info / warning / danger / success). For promotional / marketing surfaces, use **Banner** instead.
|
|
255
257
|
|
|
256
258
|
```tsx
|
|
257
259
|
// Variant — controls the surface tint and icon accent
|
|
258
|
-
<Alert variant="default" /> // white surface + subtle border (neutral)
|
|
259
|
-
<Alert variant="brand" /> // solid brand-blue surface, white text
|
|
260
260
|
<Alert variant="info" /> // sky-blue tint
|
|
261
261
|
<Alert variant="warning" /> // yellow tint
|
|
262
262
|
<Alert variant="danger" /> // red tint
|
|
@@ -290,9 +290,55 @@ Dismissible, in-page notification surface. Six variants × two layouts × option
|
|
|
290
290
|
|
|
291
291
|
**Behaviour:**
|
|
292
292
|
- Dismissal is **controlled** — clicking the close X calls `onDismiss`; the parent owns visibility.
|
|
293
|
-
-
|
|
293
|
+
- All variants' buttons default to `Button variant="secondary"`. Pass a fully-styled `<Button>` to `action` / `actions` to override.
|
|
294
294
|
- Inline + single-line content (only title OR only description) renders at a fixed 48px height with everything vertically centered. Inline + multi-line and card layouts grow to fit.
|
|
295
|
-
- `role="alert"` + `aria-live="assertive"` for `danger` / `warning`; `role="status"` + `aria-live="polite"` for
|
|
295
|
+
- `role="alert"` + `aria-live="assertive"` for `danger` / `warning`; `role="status"` + `aria-live="polite"` for `info` / `success`.
|
|
296
|
+
|
|
297
|
+
## Banner
|
|
298
|
+
|
|
299
|
+
Dismissible **promotional / marketing** surface — for feature launches, offers, onboarding nudges, cross-promo. Single visual treatment (no severity variants); for status messages use **Alert** instead.
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
// Layout — controls the shape
|
|
303
|
+
<Banner layout="inline" /> // single row: icon · body · optional action · close X (default)
|
|
304
|
+
<Banner layout="card" /> // body on row 1, up to 2 action buttons on row 2 bottom-left
|
|
305
|
+
|
|
306
|
+
// Slots — all optional (at least one of title or description is required)
|
|
307
|
+
<Banner
|
|
308
|
+
layout="inline"
|
|
309
|
+
title={<>Spring release <b>is here.</b></>} // wrap emphasis in <b> for brand-blue accent
|
|
310
|
+
description="New features just landed — take a look at what's changed."
|
|
311
|
+
icon={<MyIcon />} // omit to use the default 40px brand-blue gift badge
|
|
312
|
+
action="Get started" // string wrapped in Button variant="primary"
|
|
313
|
+
onDismiss={() => setOpen(false)} // when provided, close X is rendered
|
|
314
|
+
dismissLabel="Dismiss" // aria-label for the close X
|
|
315
|
+
/>
|
|
316
|
+
|
|
317
|
+
<Banner
|
|
318
|
+
layout="card"
|
|
319
|
+
title="..."
|
|
320
|
+
description="..."
|
|
321
|
+
actions={["Learn more", "Get started"]} // first = Secondary, second = Primary
|
|
322
|
+
onDismiss={() => setOpen(false)}
|
|
323
|
+
/>
|
|
324
|
+
|
|
325
|
+
// Whole-banner clickable — the surface itself is the CTA.
|
|
326
|
+
// Mutually exclusive with action / actions (buttons dropped, dev warning).
|
|
327
|
+
<Banner
|
|
328
|
+
layout="inline"
|
|
329
|
+
title="Tap anywhere on this banner"
|
|
330
|
+
description="Whole surface is the click target."
|
|
331
|
+
onClick={() => navigate("/promo")}
|
|
332
|
+
onDismiss={() => setOpen(false)} // close X still works independently
|
|
333
|
+
/>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Visual:**
|
|
337
|
+
- Surface: 135° diagonal gradient `#EBEBFF → #FFFFFF` with `border-primary/20` light-blue edge.
|
|
338
|
+
- Default icon: 40px brand-blue circle with a white `Gift` glyph. Override via `icon` (pass any `ReactNode`) or `icon={null}` to omit.
|
|
339
|
+
- Default action button: `Button variant="primary"` (single inline action) or `[Secondary, Primary]` pair (card actions). Pass `<Button>` elements explicitly to override variant/size.
|
|
340
|
+
- Title supports `<b>` children styled with `text-primary` for in-line brand-blue accent.
|
|
341
|
+
- Close X (32px) hovers to `bg-secondary-hover`.
|
|
296
342
|
|
|
297
343
|
## Component behaviour notes
|
|
298
344
|
|