@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 +20 -10
- package/dist/index.cjs +68 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +68 -13
- package/dist/index.js.map +1 -1
- package/guides/design-system-guide/trading-game-ds-guide.md +3 -3
- package/package.json +1 -1
- package/src/styles.css +20 -2
package/dist/index.d.cts
CHANGED
|
@@ -62,7 +62,7 @@ interface AlertProps extends Omit<React$1.ComponentProps<"div">, "title">, Varia
|
|
|
62
62
|
declare function Alert({ variant, layout, title, description, icon, action, actions, onDismiss, dismissLabel, className, ...props }: AlertProps): react_jsx_runtime.JSX.Element | null;
|
|
63
63
|
|
|
64
64
|
declare const buttonVariants: (props?: ({
|
|
65
|
-
variant?: "primary" | "primary-inverse" | "secondary" | "secondary-inverse" | "tertiary" | null | undefined;
|
|
65
|
+
variant?: "primary" | "primary-inverse" | "primary-shimmer" | "primary-inverse-shimmer" | "secondary" | "secondary-inverse" | "tertiary" | null | undefined;
|
|
66
66
|
size?: "lg" | "md" | "sm" | "xs" | "icon" | "icon-lg" | "icon-md" | "icon-sm" | "icon-xs" | null | undefined;
|
|
67
67
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
68
68
|
declare function Button({ className, variant, size, asChild, loading, children, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -454,7 +454,17 @@ declare function InputOTPSeparator({ ...props }: React$1.ComponentProps<"div">):
|
|
|
454
454
|
|
|
455
455
|
declare function Separator({ className, orientation, decorative, ...props }: React$1.ComponentProps<typeof Separator$1.Root>): react_jsx_runtime.JSX.Element;
|
|
456
456
|
|
|
457
|
-
declare function ItemGroup({ className, ...props }: React$1.ComponentProps<"div">
|
|
457
|
+
declare function ItemGroup({ className, divider, ...props }: React$1.ComponentProps<"div"> & {
|
|
458
|
+
/**
|
|
459
|
+
* Auto-divide consecutive default-variant `Item`s with a bottom border
|
|
460
|
+
* (`border-border-subtle`). The last item's bottom border is suppressed,
|
|
461
|
+
* and non-default variants (`outline`, `muted`) are left untouched so
|
|
462
|
+
* they don't double up with their own borders. Defaults to `true`; pass
|
|
463
|
+
* `false` to opt out when the design wants flush items or uses
|
|
464
|
+
* `<ItemSeparator />` manually.
|
|
465
|
+
*/
|
|
466
|
+
divider?: boolean;
|
|
467
|
+
}): react_jsx_runtime.JSX.Element;
|
|
458
468
|
declare function ItemSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): react_jsx_runtime.JSX.Element;
|
|
459
469
|
declare const itemVariants: (props?: ({
|
|
460
470
|
variant?: "default" | "outline" | "muted" | null | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ interface AlertProps extends Omit<React$1.ComponentProps<"div">, "title">, Varia
|
|
|
62
62
|
declare function Alert({ variant, layout, title, description, icon, action, actions, onDismiss, dismissLabel, className, ...props }: AlertProps): react_jsx_runtime.JSX.Element | null;
|
|
63
63
|
|
|
64
64
|
declare const buttonVariants: (props?: ({
|
|
65
|
-
variant?: "primary" | "primary-inverse" | "secondary" | "secondary-inverse" | "tertiary" | null | undefined;
|
|
65
|
+
variant?: "primary" | "primary-inverse" | "primary-shimmer" | "primary-inverse-shimmer" | "secondary" | "secondary-inverse" | "tertiary" | null | undefined;
|
|
66
66
|
size?: "lg" | "md" | "sm" | "xs" | "icon" | "icon-lg" | "icon-md" | "icon-sm" | "icon-xs" | null | undefined;
|
|
67
67
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
68
68
|
declare function Button({ className, variant, size, asChild, loading, children, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -454,7 +454,17 @@ declare function InputOTPSeparator({ ...props }: React$1.ComponentProps<"div">):
|
|
|
454
454
|
|
|
455
455
|
declare function Separator({ className, orientation, decorative, ...props }: React$1.ComponentProps<typeof Separator$1.Root>): react_jsx_runtime.JSX.Element;
|
|
456
456
|
|
|
457
|
-
declare function ItemGroup({ className, ...props }: React$1.ComponentProps<"div">
|
|
457
|
+
declare function ItemGroup({ className, divider, ...props }: React$1.ComponentProps<"div"> & {
|
|
458
|
+
/**
|
|
459
|
+
* Auto-divide consecutive default-variant `Item`s with a bottom border
|
|
460
|
+
* (`border-border-subtle`). The last item's bottom border is suppressed,
|
|
461
|
+
* and non-default variants (`outline`, `muted`) are left untouched so
|
|
462
|
+
* they don't double up with their own borders. Defaults to `true`; pass
|
|
463
|
+
* `false` to opt out when the design wants flush items or uses
|
|
464
|
+
* `<ItemSeparator />` manually.
|
|
465
|
+
*/
|
|
466
|
+
divider?: boolean;
|
|
467
|
+
}): react_jsx_runtime.JSX.Element;
|
|
458
468
|
declare function ItemSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): react_jsx_runtime.JSX.Element;
|
|
459
469
|
declare const itemVariants: (props?: ({
|
|
460
470
|
variant?: "default" | "outline" | "muted" | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -173,6 +173,14 @@ var buttonVariants = cva(
|
|
|
173
173
|
primary: "bg-primary text-on-primary hover:bg-primary-hover",
|
|
174
174
|
// Primary Inverse — white bg + blue text; for use on dark/coloured surfaces
|
|
175
175
|
"primary-inverse": "bg-primary-inverse text-on-primary-inverse hover:bg-primary-inverse/80",
|
|
176
|
+
// Primary Shimmer — same surface as `primary` plus a sweeping
|
|
177
|
+
// white shimmer overlay (same animation as the TicketCard deposit
|
|
178
|
+
// stub). Use for headline CTAs that need to draw the eye.
|
|
179
|
+
"primary-shimmer": "relative overflow-hidden bg-primary text-on-primary hover:bg-primary-hover",
|
|
180
|
+
// Primary Inverse Shimmer — same surface as `primary-inverse` plus
|
|
181
|
+
// a sweeping brand-blue shimmer (white shimmer would be invisible
|
|
182
|
+
// on the white surface). For headline CTAs on dark/coloured pages.
|
|
183
|
+
"primary-inverse-shimmer": "relative overflow-hidden bg-primary-inverse text-on-primary-inverse hover:bg-primary-inverse/80",
|
|
176
184
|
secondary: "bg-transparent border-[1.5px] border-border-prominent text-on-prominent hover:bg-secondary-hover",
|
|
177
185
|
// Secondary Inverse — white border + white text; for use on dark/coloured surfaces
|
|
178
186
|
"secondary-inverse": "bg-transparent border-[1.5px] border-primary-inverse text-on-prominent-inverse hover:bg-primary-inverse/10",
|
|
@@ -207,6 +215,13 @@ var spinnerSizeMap = {
|
|
|
207
215
|
"icon-sm": "size-3.5",
|
|
208
216
|
"icon-xs": "size-3"
|
|
209
217
|
};
|
|
218
|
+
var shimmerGradients = {
|
|
219
|
+
// 110° tilts the bright band forward so the sweep reads as a diagonal
|
|
220
|
+
// shine. Three stops around 50% (soft → mid → soft) shape the highlight
|
|
221
|
+
// like a polished-metal gleam without going too bright at the peak.
|
|
222
|
+
"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%)",
|
|
223
|
+
"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%)"
|
|
224
|
+
};
|
|
210
225
|
function Button(_a) {
|
|
211
226
|
var _b = _a, {
|
|
212
227
|
className,
|
|
@@ -224,7 +239,7 @@ function Button(_a) {
|
|
|
224
239
|
"children"
|
|
225
240
|
]);
|
|
226
241
|
const Comp = asChild ? Slot.Root : "button";
|
|
227
|
-
return /* @__PURE__ */
|
|
242
|
+
return /* @__PURE__ */ jsxs3(
|
|
228
243
|
Comp,
|
|
229
244
|
__spreadProps(__spreadValues({
|
|
230
245
|
"data-slot": "button",
|
|
@@ -237,10 +252,20 @@ function Button(_a) {
|
|
|
237
252
|
),
|
|
238
253
|
"aria-busy": loading || void 0
|
|
239
254
|
}, props), {
|
|
240
|
-
children:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
255
|
+
children: [
|
|
256
|
+
variant && shimmerGradients[variant] && !loading && !props.disabled ? /* @__PURE__ */ jsx3(
|
|
257
|
+
"span",
|
|
258
|
+
{
|
|
259
|
+
"aria-hidden": true,
|
|
260
|
+
className: "pointer-events-none absolute inset-0 [animation:button-shimmer_4s_linear_infinite]",
|
|
261
|
+
style: { background: shimmerGradients[variant] }
|
|
262
|
+
}
|
|
263
|
+
) : null,
|
|
264
|
+
loading ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
265
|
+
/* @__PURE__ */ jsx3("span", { className: "invisible inline-flex items-center gap-[inherit]", "aria-hidden": true, children }),
|
|
266
|
+
/* @__PURE__ */ jsx3("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx3(Spinner, { className: spinnerSizeMap[size != null ? size : "lg"] }) })
|
|
267
|
+
] }) : children
|
|
268
|
+
]
|
|
244
269
|
})
|
|
245
270
|
);
|
|
246
271
|
}
|
|
@@ -456,7 +481,7 @@ function Alert(_a) {
|
|
|
456
481
|
}, props), {
|
|
457
482
|
children: [
|
|
458
483
|
iconColumn,
|
|
459
|
-
/* @__PURE__ */ jsx4("div", { className: "col-
|
|
484
|
+
/* @__PURE__ */ jsx4("div", { className: "col-start-2 row-start-1 min-w-0", children: body }),
|
|
460
485
|
/* @__PURE__ */ jsx4("div", { className: "col-start-3 row-start-1", children: closeButton }),
|
|
461
486
|
actions && actions.length > 0 ? /* @__PURE__ */ jsx4("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__ */ jsx4(React.Fragment, { children: wrapAction(node, buttonVariant) }, i)) }) : null
|
|
462
487
|
]
|
|
@@ -771,7 +796,7 @@ var badgeVariants = cva3(
|
|
|
771
796
|
"fill-success": "bg-semantic-win/10 border-transparent text-semantic-win",
|
|
772
797
|
"fill-fail": "bg-semantic-loss/10 border-transparent text-semantic-loss",
|
|
773
798
|
"fill-warning": "bg-semantic-warning/10 border-transparent text-semantic-warning",
|
|
774
|
-
"fill-credit": "bg-semantic-boost-surface
|
|
799
|
+
"fill-credit": "bg-semantic-boost-surface backdrop-blur-md text-on-primary",
|
|
775
800
|
// Demo / test-mode flag — opaque light-peach surface + red-orange text.
|
|
776
801
|
// Uses --semantic-demo-surface (a solid color-mix of demo @ 10% with white)
|
|
777
802
|
// so the badge looks identical on any background.
|
|
@@ -821,9 +846,9 @@ function Badge(_a) {
|
|
|
821
846
|
import * as React2 from "react";
|
|
822
847
|
import { Gift, X as X2 } from "lucide-react";
|
|
823
848
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
824
|
-
var SURFACE_CLASSES = "w-full rounded-
|
|
849
|
+
var SURFACE_CLASSES = "w-full rounded-sm border border-primary/[0.16] bg-primary/[0.08] px-4 py-3.5";
|
|
825
850
|
function IconBadge({ glyph }) {
|
|
826
|
-
return /* @__PURE__ */ jsx9("span", { className: "inline-flex size-10 shrink-0 items-center justify-center rounded-
|
|
851
|
+
return /* @__PURE__ */ jsx9("span", { className: "inline-flex size-10 shrink-0 items-center justify-center rounded-xs bg-primary text-on-primary", children: glyph });
|
|
827
852
|
}
|
|
828
853
|
function Banner(_a) {
|
|
829
854
|
var _b = _a, {
|
|
@@ -933,7 +958,11 @@ function Banner(_a) {
|
|
|
933
958
|
"data-layout": "inline",
|
|
934
959
|
"data-clickable": isClickable ? "true" : void 0,
|
|
935
960
|
className: cn(
|
|
936
|
-
"grid
|
|
961
|
+
"grid gap-x-4",
|
|
962
|
+
// Single-line banners vertically-centre the row (icon + title);
|
|
963
|
+
// multi-line banners top-align so the leading icon sits next to
|
|
964
|
+
// the title instead of floating mid-body.
|
|
965
|
+
hasDescription ? "items-start" : "items-center",
|
|
937
966
|
gridCols,
|
|
938
967
|
rowTemplate,
|
|
939
968
|
SURFACE_CLASSES,
|
|
@@ -958,8 +987,10 @@ function Banner(_a) {
|
|
|
958
987
|
"data-layout": "card",
|
|
959
988
|
"data-clickable": isClickable ? "true" : void 0,
|
|
960
989
|
className: cn(
|
|
961
|
-
|
|
990
|
+
// Card layout is always multi-row — top-align the icon with the title.
|
|
991
|
+
"relative grid grid-cols-[auto_1fr] grid-rows-[auto_auto] items-start gap-x-4 gap-y-3",
|
|
962
992
|
SURFACE_CLASSES,
|
|
993
|
+
"pr-12",
|
|
963
994
|
clickableClasses,
|
|
964
995
|
className
|
|
965
996
|
)
|
|
@@ -3960,13 +3991,37 @@ import { cva as cva9 } from "class-variance-authority";
|
|
|
3960
3991
|
import { Slot as Slot5 } from "radix-ui";
|
|
3961
3992
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3962
3993
|
function ItemGroup(_a) {
|
|
3963
|
-
var _b = _a, {
|
|
3994
|
+
var _b = _a, {
|
|
3995
|
+
className,
|
|
3996
|
+
divider = true
|
|
3997
|
+
} = _b, props = __objRest(_b, [
|
|
3998
|
+
"className",
|
|
3999
|
+
"divider"
|
|
4000
|
+
]);
|
|
3964
4001
|
return /* @__PURE__ */ jsx35(
|
|
3965
4002
|
"div",
|
|
3966
4003
|
__spreadValues({
|
|
3967
4004
|
role: "list",
|
|
3968
4005
|
"data-slot": "item-group",
|
|
3969
|
-
|
|
4006
|
+
"data-divider": divider ? "true" : void 0,
|
|
4007
|
+
className: cn(
|
|
4008
|
+
"group/item-group flex flex-col",
|
|
4009
|
+
// Divider mode: 4 px gap between items + a 1 px line drawn via
|
|
4010
|
+
// ::after on each non-last default item, sitting in that gap.
|
|
4011
|
+
// Item itself stays border-free — the line is a separate visual
|
|
4012
|
+
// element rather than an outline on the item.
|
|
4013
|
+
divider && [
|
|
4014
|
+
"gap-1",
|
|
4015
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:relative",
|
|
4016
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:content-['']",
|
|
4017
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:absolute",
|
|
4018
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:-bottom-0.5",
|
|
4019
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:inset-x-4",
|
|
4020
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:h-px",
|
|
4021
|
+
"[&>[data-slot=item][data-variant=default]:not(:last-child)]:after:bg-border-subtle"
|
|
4022
|
+
],
|
|
4023
|
+
className
|
|
4024
|
+
)
|
|
3970
4025
|
}, props)
|
|
3971
4026
|
);
|
|
3972
4027
|
}
|