@orderly.network/ui-scaffold 2.8.3 → 2.8.4-alpha.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/dist/index.mjs CHANGED
@@ -2445,8 +2445,8 @@ var LeftNavSheet = (props) => {
2445
2445
  const { state } = useAccount();
2446
2446
  const { t } = useTranslation();
2447
2447
  const { primaryMenus, secondaryMenus } = useMemo(() => {
2448
- const primary = (props.menus || []).filter((m) => !m.isSecondary);
2449
- const secondary = (props.menus || []).filter((m) => m.isSecondary);
2448
+ const primary = (props?.menus || []).filter((m) => !m.isSecondary);
2449
+ const secondary = (props?.menus || []).filter((m) => m.isSecondary);
2450
2450
  return { primaryMenus: primary, secondaryMenus: secondary };
2451
2451
  }, [props.menus]);
2452
2452
  const showSubAccount = useMemo(
@@ -4422,6 +4422,7 @@ var Scaffold = (props) => {
4422
4422
  };
4423
4423
 
4424
4424
  // src/components/main/mainNav.script.ts
4425
+ var NON_ROUTING_HREFS = ["/vaults"];
4425
4426
  var CampaignPositionEnum = /* @__PURE__ */ ((CampaignPositionEnum3) => {
4426
4427
  CampaignPositionEnum3["menuLeading"] = "menuLeading";
4427
4428
  CampaignPositionEnum3["menuTailing"] = "menuTailing";
@@ -4447,6 +4448,17 @@ var useMainNavScript = (props) => {
4447
4448
  setCurrent(item.map((item2) => item2.href));
4448
4449
  }
4449
4450
  const current2 = item[item.length - 1];
4451
+ const isExternalLink = typeof current2.href === "string" && (current2.href.startsWith("http://") || current2.href.startsWith("https://"));
4452
+ if (NON_ROUTING_HREFS.includes(current2.href)) {
4453
+ return;
4454
+ }
4455
+ if (current2.target) {
4456
+ window.open(current2.href, current2.target);
4457
+ return;
4458
+ } else if (isExternalLink) {
4459
+ window.location.href = current2.href;
4460
+ return;
4461
+ }
4450
4462
  const args = {
4451
4463
  href: current2.href,
4452
4464
  name: current2.name,
@@ -4682,22 +4694,6 @@ var CurrentLeverage = (props) => {
4682
4694
  }
4683
4695
  );
4684
4696
  };
4685
- var MaxLeverage = (props) => {
4686
- const { t } = useTranslation();
4687
- return /* @__PURE__ */ jsxs(
4688
- Flex,
4689
- {
4690
- direction: "column",
4691
- gap: 0,
4692
- className: "oui-text-2xs",
4693
- itemAlign: "start",
4694
- children: [
4695
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { intensity: 54, className: "oui-whitespace-nowrap", children: t("leverage.maxLeverage") }) }),
4696
- /* @__PURE__ */ jsx(Text, { color: "primary", as: "div", children: `${props.maxLeverage ?? "--"}x` })
4697
- ]
4698
- }
4699
- );
4700
- };
4701
4697
  var UnrealPnL = (props) => {
4702
4698
  const { visible, onToggleVisibility, visibleAvailable = true } = props;
4703
4699
  const { t } = useTranslation();
@@ -4854,27 +4850,6 @@ var AccountInfoPopover = (props) => {
4854
4850
  }
4855
4851
  )
4856
4852
  ] }, key);
4857
- case "maxLeverage":
4858
- return /* @__PURE__ */ jsxs(DropdownMenu, { onSetTop: onSetToTop("maxLeverage"), children: [
4859
- /* @__PURE__ */ jsxs(Flex, { className: "oui-text-base-contrast-54", gapX: 2, children: [
4860
- /* @__PURE__ */ jsx(
4861
- IdentityButton,
4862
- {
4863
- active: keys.includes("maxLeverage"),
4864
- onClick: () => props.onToggleItemByKey("maxLeverage")
4865
- }
4866
- ),
4867
- /* @__PURE__ */ jsx("span", { children: t("leverage.maxLeverage") })
4868
- ] }),
4869
- /* @__PURE__ */ jsx(
4870
- Text,
4871
- {
4872
- className: "group-hover:-oui-translate-x-5 oui-transition-transform",
4873
- color: "primary",
4874
- children: `${props.maxLeverage ?? "-"}x`
4875
- }
4876
- )
4877
- ] }, key);
4878
4853
  default:
4879
4854
  return null;
4880
4855
  }
@@ -5022,10 +4997,6 @@ var AccountSummary = (props) => {
5022
4997
  canToggleIndex++;
5023
4998
  return /* @__PURE__ */ jsx(CurrentLeverage, { currentLeverage: props.currentLeverage });
5024
4999
  }
5025
- case "maxLeverage": {
5026
- canToggleIndex++;
5027
- return /* @__PURE__ */ jsx(MaxLeverage, { maxLeverage: props.maxLeverage });
5028
- }
5029
5000
  case "totalValue":
5030
5001
  default:
5031
5002
  return /* @__PURE__ */ jsx(
@@ -5049,7 +5020,6 @@ var AccountSummary = (props) => {
5049
5020
  {
5050
5021
  totalValue: rest.totalValue,
5051
5022
  freeCollateral: props.freeCollateral,
5052
- maxLeverage: props.maxLeverage,
5053
5023
  currentLeverage: props.currentLeverage,
5054
5024
  unrealized_pnl_ROI: props.unrealized_pnl_ROI,
5055
5025
  unrealPnL: props.unrealPnL,
@@ -5152,7 +5122,7 @@ var AccountSummaryWidget = () => {
5152
5122
  );
5153
5123
  };
5154
5124
  var MessageCenter = (props) => {
5155
- const { maintenanceDialogInfo, messages, showAnnouncement } = props;
5125
+ const { maintenanceDialogInfo, messages, showAnnouncement, closeTips } = props;
5156
5126
  const { routerAdapter } = useScaffoldContext();
5157
5127
  const { t } = useTranslation();
5158
5128
  const messageSize = useMemo(() => messages.length, [messages]);
@@ -5185,7 +5155,12 @@ var MessageCenter = (props) => {
5185
5155
  Popover,
5186
5156
  {
5187
5157
  open: popoverOpen,
5188
- onOpenChange: setPopoverOpen,
5158
+ onOpenChange: (open2) => {
5159
+ setPopoverOpen(open2);
5160
+ if (open2) {
5161
+ closeTips();
5162
+ }
5163
+ },
5189
5164
  arrow: true,
5190
5165
  content: /* @__PURE__ */ jsx(
5191
5166
  AnnouncementCenterUI,
@@ -5224,7 +5199,8 @@ var MessageCenterWidget = () => {
5224
5199
  {
5225
5200
  messages: announcementState.tips,
5226
5201
  maintenanceDialogInfo: announcementState.maintenanceDialogInfo,
5227
- showAnnouncement: announcementState.showAnnouncement
5202
+ showAnnouncement: announcementState.showAnnouncement,
5203
+ closeTips: announcementState.closeTips
5228
5204
  }
5229
5205
  );
5230
5206
  };
@@ -5318,6 +5294,7 @@ var NavItem2 = (props) => {
5318
5294
  "data-actived": isActive,
5319
5295
  className: cn(
5320
5296
  "oui-group oui-relative oui-h-[32px] oui-rounded oui-px-3 oui-py-1 oui-text-sm oui-text-base-contrast-36 hover:oui-bg-base-7",
5297
+ item.className,
5321
5298
  classNames?.navItem
5322
5299
  ),
5323
5300
  onClick: onClickHandler,
@@ -5330,7 +5307,7 @@ var NavItem2 = (props) => {
5330
5307
  color: isActive ? "brand" : "inherit",
5331
5308
  angle: 45,
5332
5309
  className: "oui-whitespace-nowrap oui-break-normal",
5333
- children: item.name
5310
+ children: item.label ?? item.name
5334
5311
  }
5335
5312
  ),
5336
5313
  hasSubMenu && /* @__PURE__ */ jsx("span", { className: "oui-ml-1 group-data-[open=true]:oui-rotate-180", children: isActive ? /* @__PURE__ */ jsx(ActiveIcon, {}) : /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, color: "white" }) })
@@ -5442,7 +5419,7 @@ var SubMenus = (props) => {
5442
5419
  }
5443
5420
  },
5444
5421
  className: cn(
5445
- customSubMenuRender ? "oui-w-auto oui-p-0 oui-border-0 oui-rounded-lg" : "oui-w-[260px] oui-space-y-[2px] oui-border oui-border-line-6 oui-p-1",
5422
+ customSubMenuRender ? "oui-w-auto oui-p-0 oui-border-0 oui-rounded-lg" : "oui-w-[200px] oui-space-y-[2px] oui-border oui-border-line-6 oui-p-1",
5446
5423
  className
5447
5424
  ),
5448
5425
  children: customSubMenuRender ? customSubMenuRender() : items.map((item, index) => {
@@ -5502,24 +5479,21 @@ var SubMenu = (props) => {
5502
5479
  };
5503
5480
  var SubMenuTitle = (props) => {
5504
5481
  const { item, isActive } = props;
5505
- return /* @__PURE__ */ jsxs(Flex, { itemAlign: "center", width: "100%", position: "relative", children: [
5506
- /* @__PURE__ */ jsxs("div", { className: "oui-flex oui-flex-1", children: [
5507
- /* @__PURE__ */ jsx(
5508
- Text.gradient,
5509
- {
5510
- color: isActive ? "brand" : "inherit",
5511
- size: "xs",
5512
- as: "div",
5513
- intensity: 80,
5514
- weight: "semibold",
5515
- className: "oui-whitespace-nowrap oui-break-normal",
5516
- children: item.name
5517
- }
5518
- ),
5519
- typeof item.tag !== "undefined" && /* @__PURE__ */ jsx(Tag, { item })
5520
- ] }),
5521
- item.target === "_blank" && /* @__PURE__ */ jsx(OutlinkIcon, {})
5522
- ] });
5482
+ return /* @__PURE__ */ jsx(Flex, { itemAlign: "center", width: "100%", position: "relative", children: /* @__PURE__ */ jsxs("div", { className: "oui-flex oui-flex-1", children: [
5483
+ /* @__PURE__ */ jsx(
5484
+ Text.gradient,
5485
+ {
5486
+ color: isActive ? "brand" : "inherit",
5487
+ size: "xs",
5488
+ as: "div",
5489
+ intensity: 80,
5490
+ weight: "semibold",
5491
+ className: "oui-whitespace-nowrap oui-break-normal",
5492
+ children: item.name
5493
+ }
5494
+ ),
5495
+ typeof item.tag !== "undefined" && /* @__PURE__ */ jsx(Tag, { item })
5496
+ ] }) });
5523
5497
  };
5524
5498
  var Tag = (props) => {
5525
5499
  return /* @__PURE__ */ jsx(
@@ -5576,64 +5550,6 @@ var ItemIcon = (props) => {
5576
5550
  )
5577
5551
  ] });
5578
5552
  };
5579
- var OutlinkIcon = () => {
5580
- return /* @__PURE__ */ jsxs(Fragment, { children: [
5581
- /* @__PURE__ */ jsx(
5582
- "svg",
5583
- {
5584
- width: "20",
5585
- height: "20",
5586
- viewBox: "0 0 20 20",
5587
- fill: "none",
5588
- xmlns: "http://www.w3.org/2000/svg",
5589
- className: "oui-absolute oui-right-0 oui-top-0 group-hover:oui-invisible",
5590
- children: /* @__PURE__ */ jsx(
5591
- "path",
5592
- {
5593
- d: "M14.159 17.492a3.333 3.333 0 0 0 3.333-3.333V5.826a3.333 3.333 0 0 0-3.333-3.334H5.826a3.333 3.333 0 0 0-3.334 3.334v8.333a3.333 3.333 0 0 0 3.334 3.333zm-6.667-4.166a.85.85 0 0 1-.599-.235.86.86 0 0 1 0-1.198l3.333-3.333-1.9-1.901h5v5l-1.901-1.9L8.09 13.09a.84.84 0 0 1-.599.235",
5594
- fill: "#fff",
5595
- fillOpacity: ".2"
5596
- }
5597
- )
5598
- }
5599
- ),
5600
- /* @__PURE__ */ jsxs(
5601
- "svg",
5602
- {
5603
- width: "20",
5604
- height: "20",
5605
- viewBox: "0 0 20 20",
5606
- fill: "none",
5607
- xmlns: "http://www.w3.org/2000/svg",
5608
- className: "oui-invisible oui-absolute oui-right-0 oui-top-0 group-hover:oui-visible",
5609
- children: [
5610
- /* @__PURE__ */ jsx(
5611
- "path",
5612
- {
5613
- d: "M14.159 17.492a3.333 3.333 0 0 0 3.333-3.333V5.826a3.333 3.333 0 0 0-3.333-3.334H5.826a3.333 3.333 0 0 0-3.334 3.334v8.333a3.333 3.333 0 0 0 3.334 3.333zm-6.667-4.166a.85.85 0 0 1-.599-.235.86.86 0 0 1 0-1.198l3.333-3.333-1.9-1.901h5v5l-1.901-1.9L8.09 13.09a.84.84 0 0 1-.599.235",
5614
- fill: "url(#outlineIcon)"
5615
- }
5616
- ),
5617
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
5618
- "linearGradient",
5619
- {
5620
- id: "outlineIcon",
5621
- x1: "17.492",
5622
- y1: "9.992",
5623
- x2: "2.492",
5624
- y2: "9.992",
5625
- gradientUnits: "userSpaceOnUse",
5626
- children: [
5627
- /* @__PURE__ */ jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
5628
- /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
5629
- ]
5630
- }
5631
- ) })
5632
- ]
5633
- }
5634
- )
5635
- ] });
5636
- };
5637
5553
  var CampaignButton = (props) => {
5638
5554
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
5639
5555
  NavItem2,
@@ -5656,7 +5572,8 @@ var MainNavMenus = (props) => {
5656
5572
  {
5657
5573
  item,
5658
5574
  currentPath: props.current,
5659
- onClick: props.onItemClick
5575
+ onClick: props.onItemClick,
5576
+ classNames
5660
5577
  },
5661
5578
  index
5662
5579
  )) });
@@ -5768,7 +5685,7 @@ var MainNav = (props) => {
5768
5685
  px: 3,
5769
5686
  gapX: 3,
5770
5687
  className: cn(
5771
- "oui-main-nav oui-font-semibold",
5688
+ "oui-main-nav oui-font-semibold oui-border-0 lg:oui-border-b-white/[0.12] lg:oui-border-b",
5772
5689
  className,
5773
5690
  classNames?.root
5774
5691
  ),