@trading-game/design-intelligence-layer 0.15.3 → 0.16.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/README.md +41 -3
- package/dist/index.cjs +403 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -5
- package/dist/index.d.ts +37 -5
- package/dist/index.js +501 -318
- package/dist/index.js.map +1 -1
- package/guides/design-system-guide/trading-game-ds-guide.md +2 -1
- package/package.json +1 -1
- package/src/styles.css +7 -2
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ npm install react react-dom tailwindcss
|
|
|
98
98
|
| Component | Import |
|
|
99
99
|
|---|---|
|
|
100
100
|
| Accordion | `Accordion, AccordionItem, AccordionTrigger, AccordionContent` |
|
|
101
|
-
| Alert | `Alert
|
|
101
|
+
| Alert | `Alert` — dismissible in-page notification. Variants: `default`, `brand`, `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` |
|
|
@@ -251,11 +251,49 @@ States: hover (`bg-secondary-hover`), focus (3px `ring-ring/50`), active (`opaci
|
|
|
251
251
|
|
|
252
252
|
## Alert variants
|
|
253
253
|
|
|
254
|
+
Dismissible, in-page notification surface. Six variants × two layouts × optional title / description / icon / action / dismiss slots.
|
|
255
|
+
|
|
254
256
|
```tsx
|
|
255
|
-
|
|
256
|
-
<Alert variant="
|
|
257
|
+
// 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
|
+
<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
|
+
/>
|
|
257
289
|
```
|
|
258
290
|
|
|
291
|
+
**Behaviour:**
|
|
292
|
+
- Dismissal is **controlled** — clicking the close X calls `onDismiss`; the parent owns visibility.
|
|
293
|
+
- Brand variant's buttons use `Button variant="primary-inverse"`; every other variant's buttons use `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 the rest.
|
|
296
|
+
|
|
259
297
|
## Component behaviour notes
|
|
260
298
|
|
|
261
299
|
### AlertDialog — button fill
|