@trading-game/design-intelligence-layer 0.17.0 → 0.17.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/README.md CHANGED
@@ -103,7 +103,7 @@ npm install react react-dom tailwindcss
103
103
  | Aspect Ratio | `AspectRatio` |
104
104
  | Avatar | `Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup` |
105
105
  | Badge | `Badge, badgeVariants` |
106
- | Banner | `Banner` — dismissible promotional surface on a tinted primary surface. Brand-blue circular `IconBadge` (40 px) with a swappable `glyph` (or pass `icon` to override the badge entirely). Layouts: `inline`, `card`. Slots: `title`, `description`, `icon`/`glyph`, `action`, `actions`, `onDismiss`, `onClick` (whole-banner clickable). |
106
+ | Banner | `Banner` — dismissible promotional surface on a tinted primary surface. Brand-blue square `IconBadge` (40 px, `rounded-xs`) with a swappable `glyph` (or pass `icon` to override the badge entirely). Layouts: `inline`, `card`. Slots: `title`, `description`, `icon`/`glyph`, `action`, `actions`, `onDismiss`, `onClick` (whole-banner clickable). |
107
107
  | Breadcrumb | `Breadcrumb, BreadcrumbList, BreadcrumbItem, ...` |
108
108
  | Button | `Button, buttonVariants` |
109
109
  | Calendar | `Calendar, CalendarDayButton` |
@@ -186,11 +186,13 @@ See [`AGENTS.md`](./AGENTS.md#blocks) for full usage examples per block.
186
186
  ## Button variants and sizes
187
187
 
188
188
  ```tsx
189
- <Button variant="primary" /> // Blue filled — main CTA (light surfaces)
190
- <Button variant="primary-inverse" /> // White filled + blue text — main CTA on dark/coloured surfaces
191
- <Button variant="secondary" /> // Black outline — secondary actions (light surfaces)
192
- <Button variant="secondary-inverse" /> // White outline + white text — secondary actions on dark/coloured surfaces
193
- <Button variant="tertiary" /> // Text only — minimal (light surfaces)
189
+ <Button variant="primary" /> // Blue filled — main CTA (light surfaces)
190
+ <Button variant="primary-inverse" /> // White filled + blue text — main CTA on dark/coloured surfaces
191
+ <Button variant="primary-shimmer" /> // Same as `primary` + sweeping diagonal shimmer (headline CTAs that need to draw the eye)
192
+ <Button variant="primary-inverse-shimmer" /> // Same as `primary-inverse` + brand-blue shimmer over the white surface
193
+ <Button variant="secondary" /> // Black outline — secondary actions (light surfaces)
194
+ <Button variant="secondary-inverse" /> // White outline + white text — secondary actions on dark/coloured surfaces
195
+ <Button variant="tertiary" /> // Text only — minimal (light surfaces)
194
196
 
195
197
  // Sizes
196
198
  <Button size="lg" /> // 48px height (default)
@@ -236,7 +238,7 @@ States: hover (`bg-secondary-hover`), focus (3px `ring-ring/50`), active (`opaci
236
238
  <Badge variant="fill-success" /> // Green tint
237
239
  <Badge variant="fill-fail" /> // Red tint
238
240
  <Badge variant="fill-warning" /> // Yellow tint — status/warning
239
- <Badge variant="fill-credit" /> // Deep peach (#FDCA8A) + bold deep-amber (#521900) text — Welcome credit / bonus labels
241
+ <Badge variant="fill-credit" /> // Frosted-glass surface (`--semantic-boost-surface` = `oklch(1 0 0 / 0.22)`) + white text + `backdrop-blur-md` — Welcome credit / bonus chip. Only readable on coloured surfaces (e.g. a brand-blue hero card); blends into white surfaces by design.
240
242
  <Badge variant="fill-demo" /> // Peach surface + red-orange text — demo/test-mode flags
241
243
 
242
244
  // Outline (black border, secondary-hover on hover)
@@ -337,8 +339,9 @@ Dismissible **promotional / marketing** surface — for feature launches, offers
337
339
  ```
338
340
 
339
341
  **Visual:**
340
- - Surface: tinted primary surface — `bg-primary/[0.08]` with `border-primary/[0.16]` edge, `rounded-md`.
341
- - Default icon: 40 px brand-blue **circle** (`rounded-full bg-primary`) with a white `Gift` glyph inside. Swap just the glyph via the `glyph` prop (e.g. `<Sparkles className="size-5" />`); replace the entire badge via the `icon` prop; or `icon={null}` to omit the column entirely.
342
+ - Surface: tinted primary surface — `bg-primary/[0.08]` with `border-primary/[0.16]` edge, `rounded-sm` (6 px — matches Card and Alert).
343
+ - Default icon: 40 px brand-blue **square** (`rounded-xs bg-primary`, 4 px corners) with a white `Gift` glyph inside. Swap just the glyph via the `glyph` prop (e.g. `<Sparkles className="size-5" />`); replace the entire badge via the `icon` prop; or `icon={null}` to omit the column entirely.
344
+ - **Multi-line layout** (description set, or `layout="card"`): the leading icon top-aligns with the title (grid uses `items-start`) so it sits beside the headline rather than floating mid-body. Single-line banners stay vertically centred (`items-center`).
342
345
  - Default action button: `Button variant="secondary"` size `sm` for every slot (inline `action` and both `actions[]` in card). Pass `<Button>` elements explicitly to override variant/size.
343
346
  - Title supports `<b>` children styled with `text-primary` for in-line brand-blue accent.
344
347
  - Close X (32 px): vertically-centred in the grid for single-line banners; pinned to the **top-right corner** (`absolute top-3 right-3`) when the banner is multi-line (`description` set) or `layout="card"` — so it reads as a true corner dismiss instead of floating mid-body. Hovers to `bg-secondary-hover`.
@@ -711,6 +714,10 @@ Design tokens are managed in Figma and exported as CSS variables. To update:
711
714
  ## Changelog
712
715
 
713
716
  ### Unreleased
717
+ - **Button — two new shimmer variants for headline CTAs:** `primary-shimmer` and `primary-inverse-shimmer`. Same surface tokens as their non-shimmer cousins, plus `relative overflow-hidden` to anchor an absolutely-positioned shimmer overlay. The overlay sweeps a diagonal (`110deg`) gradient driven by a new `button-shimmer` keyframe — two quick back-to-back sweeps every cycle, then a ~3 s pause off-screen, so it reads as an occasional glint rather than a continuous loader. Peak opacity is tuned per-surface (white at 32 % over brand blue; brand-blue at 22 % over white) and falls off into transparent edges. Suppressed automatically when the button is `loading` or `disabled`.
718
+ - **Button — `button-shimmer` keyframe:** new `@keyframes button-shimmer` in both `src/styles.css` and `app/globals.css`. Pattern: `0%, 10% → 30%, 100%` translateX, with an opacity fade at the seam between the two sweeps so the reset between flashes is invisible.
719
+ - **Badge — `fill-credit` is now a frosted glass chip:** `bg-semantic-boost-surface` was repurposed from the old peach (`#FDCA8A`) to `oklch(1 0 0 / 0.22)` — a translucent white surface that composes over whatever sits behind it. Paired with `backdrop-blur-md` and `text-on-primary` (white). Custom `!font-bold` / `!text-xs` overrides removed — the variant now only sets surface tokens, so font weight / size match every other badge (`font-semibold`, `text-xs` from the base). Border override removed too. The variant is intentionally invisible on white surfaces — designed to live on coloured surfaces (e.g. a brand-blue hero card / wallet card), matching the wallet mock's `.c-hero-wc`.
720
+ - **Item — auto-divider in `ItemGroup`:** new `divider` prop (default `true`) adds a 1 px `bg-border-subtle` divider between consecutive default-variant `Item`s. The line is drawn via `::after` (not a border on the item itself), sitting in a 4 px `gap-1` between items with `inset-x-4` so it aligns with the item content padding. The last item's `::after` is suppressed; non-default variants (`outline`, `muted`) are untouched. Pass `divider={false}` to opt out for flush items or manual `<ItemSeparator />` usage.
714
721
  - **Tooltip — black surface by default:** `variant="default"` switched from brand-blue to black (`bg-prominent-inverse` + `text-on-prominent-inverse`). The arrow follows. `variant="inverse"` (white) is unchanged. Default primitive now bakes in `max-w-xs whitespace-normal`, so consumers no longer pass these classes.
715
722
  - **Tooltip — keyboard-shortcut breathing room:** when the tooltip contains a `Kbd` (detected via `:has([data-slot=kbd])`), padding bumps to `px-3.5 py-2` and child elements get `space-y-1.5` so the title / kbd-row pair doesn't crowd.
716
723
  - **Switch — pill + white circle knob:** track switched from `rounded-[6px]` to `rounded-full`, thumb from `rounded-[3px]` to `rounded-full`. Thumb is always `bg-prominent` (white) in both states. Checked track: `bg-primary`. Unchecked track: `bg-input`. No API change.
@@ -722,7 +729,10 @@ Design tokens are managed in Figma and exported as CSS variables. To update:
722
729
  ### v0.16.7
723
730
  - **Credit badge readability pass:** `<Badge variant="fill-credit">` and the credit pill inside `CreditTicketCard` now sit on a deeper peach surface and use a bold deep-amber text for crisper read on the grey `bg-subtle` ticket card and on white / brand-blue surfaces alike. Token chain: `--primitive-amber-100` (#FEEBD9) → `--primitive-amber-300` (#FDCA8A) and `--primitive-amber-800` (#713813) → `--primitive-amber-900` (#521900). `--semantic-boost-surface` and `--on-semantic-boost` are repointed automatically. Variant class also bumps to `!font-bold`.
724
731
  - **CreditTicketCard — responsive compact layout:** Compact variant now keeps the credit badge inline next to the value when there's room and only wraps to a second line when balance + badge would overflow into the deposit stub (`flex-wrap` on the value/badge row, with `whitespace-nowrap` on the value so the number itself never splits). Non-compact keeps the existing inline behavior.
725
- - **Banner — brand `IconBadge` is now a circle:** The 40 px brand-blue icon badge (visible when the consumer passes a `glyph` prop) is now `rounded-full` instead of `rounded-xs`. No API change.
732
+ - **Banner — outer corner radius unified with Card / Alert:** outer surface `rounded-md` (8 px) → `rounded-sm` (6 px). Brand `IconBadge` reverted to `rounded-xs` (4 px square) after a brief detour through `rounded-full` — the square reads better against the surface.
733
+ - **Banner — multi-line icon top-alignment:** when a description is present (or `layout="card"`), the grid switches from `items-center` to `items-start` so the leading icon aligns with the title's top instead of sliding to the middle of the body block as it wraps.
734
+ - **Banner — class-order fix for `pr-12`:** in the card branch, `pr-12` was being merged before `SURFACE_CLASSES`'s `px-4`, so tailwind-merge kept the smaller right padding and long descriptions wrapped under the absolute-positioned close X. Re-ordering the `cn()` arguments puts `pr-12` after `SURFACE_CLASSES` so it wins (48 px right padding).
735
+ - **Alert — card layout body/close cell overlap fixed:** card body changed from `col-span-2 col-start-2` to `col-start-2 min-w-0`. Previously the body spanned cols 2-3 (same cell as the close X), so long descriptions slid under the close. Now the body lives in col 2 only and the close owns col 3.
726
736
  - **Tooltip — `max-w-xs` + `whitespace-normal` built into the primitive:** Desktop tooltips now cap at 320 px by default with natural-word wrapping; consumers no longer need to pass these classes. Mobile drawers (the responsive Tooltip mode) keep the full sheet width — the consumer `className` is no longer applied to the drawer's inner content wrapper, so passing `max-w-xs` on `TooltipContent` for desktop tuning no longer leaks into and shrinks the mobile drawer text.
727
737
  - **Naming note:** the v0.14.0 entry below claimed a `fill-credit` → `fill-boost` and `CreditTicketCard` → `BoostTicketCard` rename. **Those renames were not landed** — the current shipped names are still `fill-credit`, `CreditTicketCard`, and `--semantic-boost-surface` / `--on-semantic-boost` (the boost tokens stayed, the variant/component names didn't get renamed alongside them).
728
738
 
package/dist/index.cjs CHANGED
@@ -530,6 +530,14 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
530
530
  primary: "bg-primary text-on-primary hover:bg-primary-hover",
531
531
  // Primary Inverse — white bg + blue text; for use on dark/coloured surfaces
532
532
  "primary-inverse": "bg-primary-inverse text-on-primary-inverse hover:bg-primary-inverse/80",
533
+ // Primary Shimmer — same surface as `primary` plus a sweeping
534
+ // white shimmer overlay (same animation as the TicketCard deposit
535
+ // stub). Use for headline CTAs that need to draw the eye.
536
+ "primary-shimmer": "relative overflow-hidden bg-primary text-on-primary hover:bg-primary-hover",
537
+ // Primary Inverse Shimmer — same surface as `primary-inverse` plus
538
+ // a sweeping brand-blue shimmer (white shimmer would be invisible
539
+ // on the white surface). For headline CTAs on dark/coloured pages.
540
+ "primary-inverse-shimmer": "relative overflow-hidden bg-primary-inverse text-on-primary-inverse hover:bg-primary-inverse/80",
533
541
  secondary: "bg-transparent border-[1.5px] border-border-prominent text-on-prominent hover:bg-secondary-hover",
534
542
  // Secondary Inverse — white border + white text; for use on dark/coloured surfaces
535
543
  "secondary-inverse": "bg-transparent border-[1.5px] border-primary-inverse text-on-prominent-inverse hover:bg-primary-inverse/10",
@@ -564,6 +572,13 @@ var spinnerSizeMap = {
564
572
  "icon-sm": "size-3.5",
565
573
  "icon-xs": "size-3"
566
574
  };
575
+ var shimmerGradients = {
576
+ // 110° tilts the bright band forward so the sweep reads as a diagonal
577
+ // shine. Three stops around 50% (soft → mid → soft) shape the highlight
578
+ // like a polished-metal gleam without going too bright at the peak.
579
+ "primary-shimmer": "linear-gradient(110deg, transparent 20%, rgba(255,255,255,0.10) 40%, rgba(255,255,255,0.20) 50%, rgba(255,255,255,0.10) 60%, transparent 80%)",
580
+ "primary-inverse-shimmer": "linear-gradient(110deg, transparent 20%, rgba(35,35,255,0.07) 40%, rgba(35,35,255,0.14) 50%, rgba(35,35,255,0.07) 60%, transparent 80%)"
581
+ };
567
582
  function Button(_a) {
568
583
  var _b = _a, {
569
584
  className,
@@ -581,7 +596,7 @@ function Button(_a) {
581
596
  "children"
582
597
  ]);
583
598
  const Comp = asChild ? import_radix_ui2.Slot.Root : "button";
584
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
599
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
585
600
  Comp,
586
601
  __spreadProps(__spreadValues({
587
602
  "data-slot": "button",
@@ -594,10 +609,20 @@ function Button(_a) {
594
609
  ),
595
610
  "aria-busy": loading || void 0
596
611
  }, props), {
597
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
598
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "invisible inline-flex items-center gap-[inherit]", "aria-hidden": true, children }),
599
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { className: spinnerSizeMap[size != null ? size : "lg"] }) })
600
- ] }) : children
612
+ children: [
613
+ variant && shimmerGradients[variant] && !loading && !props.disabled ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
614
+ "span",
615
+ {
616
+ "aria-hidden": true,
617
+ className: "pointer-events-none absolute inset-0 [animation:button-shimmer_4s_linear_infinite]",
618
+ style: { background: shimmerGradients[variant] }
619
+ }
620
+ ) : null,
621
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
622
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "invisible inline-flex items-center gap-[inherit]", "aria-hidden": true, children }),
623
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { className: spinnerSizeMap[size != null ? size : "lg"] }) })
624
+ ] }) : children
625
+ ]
601
626
  })
602
627
  );
603
628
  }
@@ -813,7 +838,7 @@ function Alert(_a) {
813
838
  }, props), {
814
839
  children: [
815
840
  iconColumn,
816
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "col-span-2 col-start-2 row-start-1", children: body }),
841
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "col-start-2 row-start-1 min-w-0", children: body }),
817
842
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "col-start-3 row-start-1", children: closeButton }),
818
843
  actions && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "col-span-3 col-start-2 row-start-2 mt-2 flex flex-wrap items-center justify-start gap-2", children: actions.slice(0, 2).map((node, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(React.Fragment, { children: wrapAction(node, buttonVariant) }, i)) }) : null
819
844
  ]
@@ -1128,7 +1153,7 @@ var badgeVariants = (0, import_class_variance_authority3.cva)(
1128
1153
  "fill-success": "bg-semantic-win/10 border-transparent text-semantic-win",
1129
1154
  "fill-fail": "bg-semantic-loss/10 border-transparent text-semantic-loss",
1130
1155
  "fill-warning": "bg-semantic-warning/10 border-transparent text-semantic-warning",
1131
- "fill-credit": "bg-semantic-boost-surface border-transparent text-on-semantic-boost !text-xs !font-bold",
1156
+ "fill-credit": "bg-semantic-boost-surface backdrop-blur-md text-on-primary",
1132
1157
  // Demo / test-mode flag — opaque light-peach surface + red-orange text.
1133
1158
  // Uses --semantic-demo-surface (a solid color-mix of demo @ 10% with white)
1134
1159
  // so the badge looks identical on any background.
@@ -1178,9 +1203,9 @@ function Badge(_a) {
1178
1203
  var React2 = __toESM(require("react"), 1);
1179
1204
  var import_lucide_react3 = require("lucide-react");
1180
1205
  var import_jsx_runtime9 = require("react/jsx-runtime");
1181
- var SURFACE_CLASSES = "w-full rounded-md border border-primary/[0.16] bg-primary/[0.08] px-4 py-3.5";
1206
+ var SURFACE_CLASSES = "w-full rounded-sm border border-primary/[0.16] bg-primary/[0.08] px-4 py-3.5";
1182
1207
  function IconBadge({ glyph }) {
1183
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "inline-flex size-10 shrink-0 items-center justify-center rounded-full bg-primary text-on-primary", children: glyph });
1208
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "inline-flex size-10 shrink-0 items-center justify-center rounded-xs bg-primary text-on-primary", children: glyph });
1184
1209
  }
1185
1210
  function Banner(_a) {
1186
1211
  var _b = _a, {
@@ -1290,7 +1315,11 @@ function Banner(_a) {
1290
1315
  "data-layout": "inline",
1291
1316
  "data-clickable": isClickable ? "true" : void 0,
1292
1317
  className: cn(
1293
- "grid items-center gap-x-4",
1318
+ "grid gap-x-4",
1319
+ // Single-line banners vertically-centre the row (icon + title);
1320
+ // multi-line banners top-align so the leading icon sits next to
1321
+ // the title instead of floating mid-body.
1322
+ hasDescription ? "items-start" : "items-center",
1294
1323
  gridCols,
1295
1324
  rowTemplate,
1296
1325
  SURFACE_CLASSES,
@@ -1315,8 +1344,10 @@ function Banner(_a) {
1315
1344
  "data-layout": "card",
1316
1345
  "data-clickable": isClickable ? "true" : void 0,
1317
1346
  className: cn(
1318
- "relative grid grid-cols-[auto_1fr] grid-rows-[auto_auto] items-center gap-x-4 gap-y-3 pr-12",
1347
+ // Card layout is always multi-row — top-align the icon with the title.
1348
+ "relative grid grid-cols-[auto_1fr] grid-rows-[auto_auto] items-start gap-x-4 gap-y-3",
1319
1349
  SURFACE_CLASSES,
1350
+ "pr-12",
1320
1351
  clickableClasses,
1321
1352
  className
1322
1353
  )
@@ -4305,13 +4336,37 @@ var import_class_variance_authority9 = require("class-variance-authority");
4305
4336
  var import_radix_ui18 = require("radix-ui");
4306
4337
  var import_jsx_runtime35 = require("react/jsx-runtime");
4307
4338
  function ItemGroup(_a) {
4308
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
4339
+ var _b = _a, {
4340
+ className,
4341
+ divider = true
4342
+ } = _b, props = __objRest(_b, [
4343
+ "className",
4344
+ "divider"
4345
+ ]);
4309
4346
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4310
4347
  "div",
4311
4348
  __spreadValues({
4312
4349
  role: "list",
4313
4350
  "data-slot": "item-group",
4314
- className: cn("group/item-group flex flex-col", className)
4351
+ "data-divider": divider ? "true" : void 0,
4352
+ className: cn(
4353
+ "group/item-group flex flex-col",
4354
+ // Divider mode: 4 px gap between items + a 1 px line drawn via
4355
+ // ::after on each non-last default item, sitting in that gap.
4356
+ // Item itself stays border-free — the line is a separate visual
4357
+ // element rather than an outline on the item.
4358
+ divider && [
4359
+ "gap-1",
4360
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:relative",
4361
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:content-['']",
4362
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:absolute",
4363
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:-bottom-0.5",
4364
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:inset-x-4",
4365
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:h-px",
4366
+ "[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:bg-border-subtle"
4367
+ ],
4368
+ className
4369
+ )
4315
4370
  }, props)
4316
4371
  );
4317
4372
  }