@trading-game/design-intelligence-layer 0.15.4 → 0.16.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
@@ -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, AlertTitle, AlertDescription` |
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" /> // Orange tint
236
- <Badge variant="fill-credit" /> // Amber-orange tint — credit/bonus labels
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,11 +253,93 @@ States: hover (`bg-secondary-hover`), focus (3px `ring-ring/50`), active (`opaci
251
253
 
252
254
  ## Alert variants
253
255
 
256
+ Dismissible **status** notification (info / warning / danger / success). For promotional / marketing surfaces, use **Banner** instead.
257
+
258
+ ```tsx
259
+ // Variant — controls the surface tint and icon accent
260
+ <Alert variant="info" /> // sky-blue tint
261
+ <Alert variant="warning" /> // yellow tint
262
+ <Alert variant="danger" /> // red tint
263
+ <Alert variant="success" /> // green tint
264
+
265
+ // Layout — controls the shape
266
+ <Alert layout="inline" /> // single row: icon · body · optional action · close X (default)
267
+ <Alert layout="card" /> // taller: icon · body · close X top-right, up to 2 buttons bottom-left
268
+
269
+ // Slots — all optional (at least one of title or description is required)
270
+ <Alert
271
+ variant="info"
272
+ layout="inline"
273
+ title="Verify your email"
274
+ description="We sent a confirmation link to example@email.com."
275
+ icon={<MyIcon />} // pass null to omit; omit to use the variant default
276
+ action="Resend" // inline only — string is wrapped in Button automatically
277
+ onDismiss={() => setOpen(false)} // when provided, close X is rendered
278
+ dismissLabel="Dismiss" // aria-label for the close X
279
+ />
280
+
281
+ <Alert
282
+ variant="info"
283
+ layout="card"
284
+ title="..."
285
+ description="..."
286
+ actions={["Learn more", "Open trading"]} // card only — array of up to 2 buttons
287
+ onDismiss={() => setOpen(false)}
288
+ />
289
+ ```
290
+
291
+ **Behaviour:**
292
+ - Dismissal is **controlled** — clicking the close X calls `onDismiss`; the parent owns visibility.
293
+ - All variants' buttons default to `Button variant="secondary"`. Pass a fully-styled `<Button>` to `action` / `actions` to override.
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 `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
+
254
301
  ```tsx
255
- <Alert variant="info" /> // blue — informational (default)
256
- <Alert variant="error" /> // red — error state
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
+ />
257
334
  ```
258
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`.
342
+
259
343
  ## Component behaviour notes
260
344
 
261
345
  ### AlertDialog — button fill