@trading-game/design-intelligence-layer 0.13.0 → 0.13.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/dist/index.cjs CHANGED
@@ -5371,7 +5371,7 @@ function SheetDescription(_a) {
5371
5371
  }
5372
5372
 
5373
5373
  // components/ui/sidebar.tsx
5374
- var React9 = __toESM(require("react"), 1);
5374
+ var React10 = __toESM(require("react"), 1);
5375
5375
  var import_class_variance_authority12 = require("class-variance-authority");
5376
5376
  var import_lucide_react20 = require("lucide-react");
5377
5377
  var import_radix_ui30 = require("radix-ui");
@@ -5407,8 +5407,10 @@ function Skeleton(_a) {
5407
5407
  }
5408
5408
 
5409
5409
  // components/ui/tooltip.tsx
5410
+ var React9 = __toESM(require("react"), 1);
5410
5411
  var import_radix_ui29 = require("radix-ui");
5411
5412
  var import_jsx_runtime49 = require("react/jsx-runtime");
5413
+ var TooltipModeContext = React9.createContext("tooltip");
5412
5414
  function TooltipProvider(_a) {
5413
5415
  var _b = _a, {
5414
5416
  delayDuration = 0
@@ -5424,36 +5426,71 @@ function TooltipProvider(_a) {
5424
5426
  );
5425
5427
  }
5426
5428
  function Tooltip2(_a) {
5427
- var props = __objRest(_a, []);
5428
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Root, __spreadValues({ "data-slot": "tooltip" }, props));
5429
+ var _b = _a, {
5430
+ children
5431
+ } = _b, props = __objRest(_b, [
5432
+ "children"
5433
+ ]);
5434
+ const isMobile = useIsMobile();
5435
+ const mode = isMobile ? "drawer" : "tooltip";
5436
+ if (mode === "drawer") {
5437
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TooltipModeContext.Provider, { value: "drawer", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Drawer, { children }) });
5438
+ }
5439
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TooltipModeContext.Provider, { value: "tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Root, __spreadProps(__spreadValues({ "data-slot": "tooltip" }, props), { children })) });
5429
5440
  }
5430
5441
  function TooltipTrigger(_a) {
5431
- var props = __objRest(_a, []);
5432
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Trigger, __spreadValues({ "data-slot": "tooltip-trigger" }, props));
5442
+ var _b = _a, {
5443
+ children
5444
+ } = _b, props = __objRest(_b, [
5445
+ "children"
5446
+ ]);
5447
+ const mode = React9.useContext(TooltipModeContext);
5448
+ if (mode === "drawer") {
5449
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DrawerTrigger, __spreadProps(__spreadValues({ "data-slot": "tooltip-trigger" }, props), { children }));
5450
+ }
5451
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Trigger, __spreadProps(__spreadValues({ "data-slot": "tooltip-trigger" }, props), { children }));
5433
5452
  }
5434
5453
  function TooltipContent(_a) {
5435
5454
  var _b = _a, {
5436
5455
  className,
5437
5456
  sideOffset = 6,
5457
+ variant = "default",
5458
+ title = "Title",
5459
+ closeLabel = "Label",
5438
5460
  children
5439
5461
  } = _b, props = __objRest(_b, [
5440
5462
  "className",
5441
5463
  "sideOffset",
5464
+ "variant",
5465
+ "title",
5466
+ "closeLabel",
5442
5467
  "children"
5443
5468
  ]);
5469
+ const mode = React9.useContext(TooltipModeContext);
5470
+ if (mode === "drawer") {
5471
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(DrawerContent, { "data-slot": "tooltip-content", "data-variant": variant, children: [
5472
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DrawerTitle, { className: "px-5 pt-2 text-left text-base font-bold text-on-prominent", children: title }),
5473
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("px-5 pt-2 pb-2 text-sm font-medium text-on-prominent", className), children }),
5474
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DrawerFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DrawerClose, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Button, { variant: "primary", size: "md", children: closeLabel }) }) })
5475
+ ] });
5476
+ }
5477
+ const surfaceClasses = variant === "inverse" ? "bg-prominent text-on-prominent shadow-sm" : "bg-primary text-on-primary";
5478
+ const arrowClasses = variant === "inverse" ? "fill-prominent" : "fill-primary";
5444
5479
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5445
5480
  import_radix_ui29.Tooltip.Content,
5446
5481
  __spreadProps(__spreadValues({
5447
5482
  "data-slot": "tooltip-content",
5483
+ "data-variant": variant,
5448
5484
  sideOffset,
5449
5485
  className: cn(
5450
- "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-primary border-0 px-3 py-1.5 text-xs font-medium text-balance text-on-primary fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
5486
+ "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border-0 px-3 py-1.5 text-sm font-medium text-balance fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
5487
+ surfaceClasses,
5451
5488
  className
5452
5489
  )
5453
5490
  }, props), {
5454
5491
  children: [
5455
5492
  children,
5456
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Arrow, { className: "fill-primary" })
5493
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_radix_ui29.Tooltip.Arrow, { className: arrowClasses })
5457
5494
  ]
5458
5495
  })
5459
5496
  ) });
@@ -5467,9 +5504,9 @@ var SIDEBAR_WIDTH = "16rem";
5467
5504
  var SIDEBAR_WIDTH_MOBILE = "18rem";
5468
5505
  var SIDEBAR_WIDTH_ICON = "3rem";
5469
5506
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
5470
- var SidebarContext = React9.createContext(null);
5507
+ var SidebarContext = React10.createContext(null);
5471
5508
  function useSidebar() {
5472
- const context = React9.useContext(SidebarContext);
5509
+ const context = React10.useContext(SidebarContext);
5473
5510
  if (!context) {
5474
5511
  throw new Error("useSidebar must be used within a SidebarProvider.");
5475
5512
  }
@@ -5492,10 +5529,10 @@ function SidebarProvider(_a) {
5492
5529
  "children"
5493
5530
  ]);
5494
5531
  const isMobile = useIsMobile();
5495
- const [openMobile, setOpenMobile] = React9.useState(false);
5496
- const [_open, _setOpen] = React9.useState(defaultOpen);
5532
+ const [openMobile, setOpenMobile] = React10.useState(false);
5533
+ const [_open, _setOpen] = React10.useState(defaultOpen);
5497
5534
  const open = openProp != null ? openProp : _open;
5498
- const setOpen = React9.useCallback(
5535
+ const setOpen = React10.useCallback(
5499
5536
  (value) => {
5500
5537
  const openState = typeof value === "function" ? value(open) : value;
5501
5538
  if (setOpenProp) {
@@ -5507,10 +5544,10 @@ function SidebarProvider(_a) {
5507
5544
  },
5508
5545
  [setOpenProp, open]
5509
5546
  );
5510
- const toggleSidebar = React9.useCallback(() => {
5547
+ const toggleSidebar = React10.useCallback(() => {
5511
5548
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
5512
5549
  }, [isMobile, setOpen, setOpenMobile]);
5513
- React9.useEffect(() => {
5550
+ React10.useEffect(() => {
5514
5551
  const handleKeyDown = (event) => {
5515
5552
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
5516
5553
  event.preventDefault();
@@ -5521,7 +5558,7 @@ function SidebarProvider(_a) {
5521
5558
  return () => window.removeEventListener("keydown", handleKeyDown);
5522
5559
  }, [toggleSidebar]);
5523
5560
  const state = open ? "expanded" : "collapsed";
5524
- const contextValue = React9.useMemo(
5561
+ const contextValue = React10.useMemo(
5525
5562
  () => ({
5526
5563
  state,
5527
5564
  open,
@@ -6099,7 +6136,7 @@ function SidebarMenuSubButton(_a) {
6099
6136
  }
6100
6137
 
6101
6138
  // components/ui/slider.tsx
6102
- var React10 = __toESM(require("react"), 1);
6139
+ var React11 = __toESM(require("react"), 1);
6103
6140
  var import_radix_ui31 = require("radix-ui");
6104
6141
  var import_jsx_runtime51 = require("react/jsx-runtime");
6105
6142
  function Slider(_a) {
@@ -6116,7 +6153,7 @@ function Slider(_a) {
6116
6153
  "min",
6117
6154
  "max"
6118
6155
  ]);
6119
- const _values = React10.useMemo(
6156
+ const _values = React11.useMemo(
6120
6157
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
6121
6158
  [value, defaultValue, min, max]
6122
6159
  );
@@ -6208,7 +6245,7 @@ var Toaster = (_a) => {
6208
6245
  };
6209
6246
 
6210
6247
  // components/ui/stepper.tsx
6211
- var React11 = __toESM(require("react"), 1);
6248
+ var React12 = __toESM(require("react"), 1);
6212
6249
  var import_lucide_react22 = require("lucide-react");
6213
6250
  var import_jsx_runtime53 = require("react/jsx-runtime");
6214
6251
  function clamp(value, min, max) {
@@ -6244,16 +6281,16 @@ function Stepper({
6244
6281
  }) {
6245
6282
  const { container, buttonSize, iconClass } = stepperSizeConfig[size];
6246
6283
  const isControlled = controlledValue !== void 0;
6247
- const [internalValue, setInternalValue] = React11.useState(
6284
+ const [internalValue, setInternalValue] = React12.useState(
6248
6285
  clamp(defaultValue, min, max)
6249
6286
  );
6250
6287
  const currentValue = isControlled ? controlledValue : internalValue;
6251
6288
  const decimalPlaces = getDecimalPlaces(step);
6252
- const [displayString, setDisplayString] = React11.useState(
6289
+ const [displayString, setDisplayString] = React12.useState(
6253
6290
  formatValue(currentValue, decimalPlaces)
6254
6291
  );
6255
- const [isFocused, setIsFocused] = React11.useState(false);
6256
- React11.useEffect(() => {
6292
+ const [isFocused, setIsFocused] = React12.useState(false);
6293
+ React12.useEffect(() => {
6257
6294
  if (!isFocused) {
6258
6295
  setDisplayString(formatValue(currentValue, decimalPlaces));
6259
6296
  }
@@ -6693,6 +6730,9 @@ function BoostTicketCard({
6693
6730
  stubDisabled = false,
6694
6731
  boostAmount = "0.00",
6695
6732
  boostCurrency = "USDT",
6733
+ boostInfo,
6734
+ boostInfoSide = "top",
6735
+ boostInfoAlign = "center",
6696
6736
  compact = false
6697
6737
  }) {
6698
6738
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: cn("flex w-full flex-col gap-2", className), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "relative flex w-full items-stretch justify-between rounded-sm bg-subtle", children: [
@@ -6715,7 +6755,18 @@ function BoostTicketCard({
6715
6755
  boostAmount,
6716
6756
  " ",
6717
6757
  boostCurrency,
6718
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react23.Info, { className: "!size-3.5", strokeWidth: 2, "aria-label": "More info about boost" })
6758
+ boostInfo && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Tooltip2, { children: [
6759
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
6760
+ "button",
6761
+ {
6762
+ type: "button",
6763
+ "aria-label": "More info about boost",
6764
+ className: "inline-flex shrink-0 items-center justify-center rounded-full text-on-semantic-boost outline-none transition-opacity hover:opacity-70 focus-visible:opacity-70 focus-visible:ring-2 focus-visible:ring-on-semantic-boost/40 cursor-pointer",
6765
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react23.Info, { className: "!size-3.5", strokeWidth: 2 })
6766
+ }
6767
+ ) }),
6768
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipContent, { side: boostInfoSide, align: boostInfoAlign, variant: "inverse", className: "max-w-xs whitespace-normal", children: boostInfo })
6769
+ ] }) })
6719
6770
  ] })
6720
6771
  ] })
6721
6772
  ] }),
@@ -6809,10 +6860,10 @@ function Toggle(_a) {
6809
6860
  }
6810
6861
 
6811
6862
  // components/ui/toggle-group.tsx
6812
- var React12 = __toESM(require("react"), 1);
6863
+ var React13 = __toESM(require("react"), 1);
6813
6864
  var import_radix_ui35 = require("radix-ui");
6814
6865
  var import_jsx_runtime59 = require("react/jsx-runtime");
6815
- var ToggleGroupContext = React12.createContext({
6866
+ var ToggleGroupContext = React13.createContext({
6816
6867
  size: "default",
6817
6868
  variant: "default",
6818
6869
  spacing: 0
@@ -6860,7 +6911,7 @@ function ToggleGroupItem(_a) {
6860
6911
  "variant",
6861
6912
  "size"
6862
6913
  ]);
6863
- const context = React12.useContext(ToggleGroupContext);
6914
+ const context = React13.useContext(ToggleGroupContext);
6864
6915
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6865
6916
  import_radix_ui35.ToggleGroup.Item,
6866
6917
  __spreadProps(__spreadValues({