@orderly.network/ui-positions 3.0.4-alpha.4 → 3.1.0-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
@@ -27,7 +27,7 @@ var ConfirmHeader = (props) => {
27
27
  "button",
28
28
  {
29
29
  onClick: props.onClose,
30
- className: "oui-absolute oui-right-0 oui-top-0 oui-p-2 oui-text-base-contrast-54 hover:oui-text-base-contrast-80",
30
+ className: "oui-absolute oui-end-0 oui-top-0 oui-p-2 oui-text-base-contrast-54 hover:oui-text-base-contrast-80",
31
31
  children: /* @__PURE__ */ jsx(CloseIcon, { size: 18, color: "white" })
32
32
  }
33
33
  )
@@ -798,6 +798,7 @@ var useCombinePositionsScript = (props) => {
798
798
  const { pagination, setPage } = usePagination({ pageSize: 50 });
799
799
  const symbolsInfo = useSymbolsInfo();
800
800
  const { state } = useAccount();
801
+ const { t } = useTranslation();
801
802
  const [mainAccountPositions, , { isLoading }] = usePositionStream(symbol, {
802
803
  calcMode,
803
804
  includedPendingOrder
@@ -853,9 +854,10 @@ var useCombinePositionsScript = (props) => {
853
854
  const groupDataSource = useMemo(() => {
854
855
  return groupDataByAccount(filtered, {
855
856
  mainAccountId: state.mainAccountId,
857
+ mainAccountLabel: t("common.mainAccount"),
856
858
  subAccounts: state.subAccounts
857
859
  });
858
- }, [filtered, state.mainAccountId, state.subAccounts]);
860
+ }, [filtered, state.mainAccountId, state.subAccounts, t]);
859
861
  const loading = isLoading || isPositionLoading || isAccountInfoLoading;
860
862
  useEffect(() => {
861
863
  setPage(1);
@@ -876,7 +878,7 @@ var useCombinePositionsScript = (props) => {
876
878
  };
877
879
  };
878
880
  var groupDataByAccount = (data, options) => {
879
- const { mainAccountId = "", subAccounts = [] } = options;
881
+ const { mainAccountId = "", mainAccountLabel, subAccounts = [] } = options;
880
882
  const map = /* @__PURE__ */ new Map();
881
883
  for (const item of data) {
882
884
  const accountId = item.account_id || mainAccountId;
@@ -886,7 +888,7 @@ var groupDataByAccount = (data, options) => {
886
888
  } else {
887
889
  map.set(accountId, {
888
890
  account_id: accountId,
889
- description: accountId === mainAccountId ? i18n.t("common.mainAccount") : findSubAccount?.description || formatAddress(findSubAccount?.id || ""),
891
+ description: accountId === mainAccountId ? mainAccountLabel : findSubAccount?.description || formatAddress(findSubAccount?.id || ""),
890
892
  children: [item]
891
893
  });
892
894
  }
@@ -1470,7 +1472,7 @@ var ReversePositionWidget = (props) => {
1470
1472
  open: visible,
1471
1473
  onOpenChange,
1472
1474
  size: "sm",
1473
- title: i18n.t("positions.reverse.title"),
1475
+ title: t("positions.reverse.title"),
1474
1476
  classNames: {
1475
1477
  content: "oui-border oui-border-line-6"
1476
1478
  },
@@ -2067,8 +2069,8 @@ var Quantity = ({
2067
2069
  input: "oui-text-sm oui-font-semibold oui-text-base-contrast-98",
2068
2070
  // override default additional padding so value can sit closer to suffix
2069
2071
  additional: "oui-px-0",
2070
- prefix: "oui-pl-3 oui-pr-2 oui-text-sm oui-text-base-contrast-54",
2071
- suffix: "oui-pl-2 oui-pr-3 oui-text-sm oui-text-base-contrast-54"
2072
+ prefix: "oui-ps-3 oui-pe-2 oui-text-sm oui-text-base-contrast-54",
2073
+ suffix: "oui-ps-2 oui-pe-3 oui-text-sm oui-text-base-contrast-54"
2072
2074
  }
2073
2075
  }
2074
2076
  ),
@@ -3241,14 +3243,14 @@ var TriggerPriceItem = (props) => {
3241
3243
  ).toNumber();
3242
3244
  const type = orderType === AlgoOrderType.TAKE_PROFIT ? "TP" : "SL";
3243
3245
  return /* @__PURE__ */ jsxs(Flex, { children: [
3244
- /* @__PURE__ */ jsx(Text, { intensity: 54, className: "oui-mr-1", children: `${type} PnL:` }),
3246
+ /* @__PURE__ */ jsx(Text, { intensity: 54, className: "oui-me-1", children: `${type} PnL:` }),
3245
3247
  /* @__PURE__ */ jsx(
3246
3248
  Text.formatted,
3247
3249
  {
3248
3250
  rule: "price",
3249
3251
  className: pnl === 0 ? "oui-text-base-contrast-36" : pnl > 0 ? "oui-text-trade-profit oui-gap-0" : "oui-text-trade-loss oui-gap-0",
3250
3252
  prefix: /* @__PURE__ */ jsx(Text, { children: pnl === 0 ? "" : pnl > 0 ? "+" : "-" }),
3251
- suffix: /* @__PURE__ */ jsx(Text, { intensity: 36, className: "oui-ml-1", children: "USDC" }),
3253
+ suffix: /* @__PURE__ */ jsx(Text, { intensity: 36, className: "oui-ms-1", children: "USDC" }),
3252
3254
  children: `${Math.abs(pnl)}`
3253
3255
  }
3254
3256
  )
@@ -3505,7 +3507,7 @@ var useColumn = (config) => {
3505
3507
  {
3506
3508
  title: t("common.symbol"),
3507
3509
  dataIndex: "symbol",
3508
- fixed: "left",
3510
+ fixed: "start",
3509
3511
  width: 200,
3510
3512
  onSort: (r1, r2) => {
3511
3513
  return r1.symbol?.localeCompare(r2.symbol || "");
@@ -3553,7 +3555,7 @@ var useColumn = (config) => {
3553
3555
  return a.position_qty - b.position_qty;
3554
3556
  },
3555
3557
  width: 120,
3556
- className: "oui-pl-6",
3558
+ className: "oui-ps-6",
3557
3559
  // rule: "price",
3558
3560
  // numeralProps: {
3559
3561
  // coloring: true,
@@ -3780,14 +3782,14 @@ var useColumn = (config) => {
3780
3782
  // title: t("common.qty"),
3781
3783
  // dataIndex: "close_qty",
3782
3784
  // width: 100,
3783
- // fixed: "right",
3785
+ // fixed: "end",
3784
3786
  // render: renderQuantityInput,
3785
3787
  // },
3786
3788
  // {
3787
3789
  // title: t("common.price"),
3788
3790
  // dataIndex: "close_price",
3789
3791
  // width: 100,
3790
- // fixed: "right",
3792
+ // fixed: "end",
3791
3793
  // render: renderPriceInput,
3792
3794
  // // render: (value: string) => <PriceInput />,
3793
3795
  // },
@@ -3796,7 +3798,7 @@ var useColumn = (config) => {
3796
3798
  dataIndex: "close_position",
3797
3799
  align: "right",
3798
3800
  width: positionReverse ? 100 : 70,
3799
- fixed: "right",
3801
+ fixed: "end",
3800
3802
  render(_, record) {
3801
3803
  return /* @__PURE__ */ jsxs(Flex, { gapX: 2, justify: "end", children: [
3802
3804
  /* @__PURE__ */ jsx(ClosePositionWidget, {}),
@@ -3805,7 +3807,13 @@ var useColumn = (config) => {
3805
3807
  }
3806
3808
  }
3807
3809
  ],
3808
- [pnlNotionalDecimalPrecision, sharePnLConfig, t, positionReverse]
3810
+ [
3811
+ onSymbolChange,
3812
+ pnlNotionalDecimalPrecision,
3813
+ sharePnLConfig,
3814
+ t,
3815
+ positionReverse
3816
+ ]
3809
3817
  );
3810
3818
  return column;
3811
3819
  };
@@ -3848,9 +3856,9 @@ var SymbolToken = (props) => {
3848
3856
  var UnrealPnL = (props) => {
3849
3857
  const { item } = props;
3850
3858
  const { t } = useTranslation();
3851
- const unrealPnlLabel = /* @__PURE__ */ jsxs("div", { className: "oui-text-right", children: [
3859
+ const unrealPnlLabel = /* @__PURE__ */ jsxs("div", { className: "oui-text-end", children: [
3852
3860
  /* @__PURE__ */ jsx(Text, { intensity: 36, className: "oui-underline oui-decoration-dotted", children: t("common.unrealizedPnl") }),
3853
- /* @__PURE__ */ jsx(Text, { intensity: 20, className: "oui-ml-0.5", children: "(USDC)" })
3861
+ /* @__PURE__ */ jsx(Text, { intensity: 20, className: "oui-ms-0.5", children: "(USDC)" })
3854
3862
  ] });
3855
3863
  return /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
3856
3864
  /* @__PURE__ */ jsxs(Flex, { direction: "column", className: "oui-text-2xs", itemAlign: "end", children: [
@@ -3877,7 +3885,7 @@ var UnrealPnL = (props) => {
3877
3885
  prefix: "(",
3878
3886
  suffix: ")",
3879
3887
  className: cn(
3880
- "oui-ml-1",
3888
+ "oui-ms-1",
3881
3889
  item.unrealized_pnl_ROI > 0 ? "oui-text-success-darken" : "oui-text-danger-darken"
3882
3890
  ),
3883
3891
  children: item.unrealized_pnl_ROI
@@ -4284,7 +4292,7 @@ var PositionsRowProvider = (props) => {
4284
4292
  }
4285
4293
  return false;
4286
4294
  });
4287
- }, [submit]);
4295
+ }, [mutatePositions, quantity, submit, symbol, symbolInfo, t]);
4288
4296
  const memoizedValue = useMemo(() => {
4289
4297
  return {
4290
4298
  quantity,
@@ -4481,7 +4489,7 @@ var usePositionHistoryColumn = (props) => {
4481
4489
  {
4482
4490
  title: t("common.symbol"),
4483
4491
  dataIndex: "symbol",
4484
- fixed: "left",
4492
+ fixed: "start",
4485
4493
  width: 250,
4486
4494
  onSort: (r1, r2) => {
4487
4495
  return r1.symbol?.localeCompare(r2.symbol || "");
@@ -4597,7 +4605,7 @@ var usePositionHistoryColumn = (props) => {
4597
4605
  render: (_, record) => /* @__PURE__ */ jsx(Text.formatted, { rule: "date", formatString: "yyyy-MM-dd HH:mm:ss", children: record.last_update_time })
4598
4606
  }
4599
4607
  ],
4600
- [pnlNotionalDecimalPrecision, t]
4608
+ [onSymbolChange, pnlNotionalDecimalPrecision, props.sharePnLConfig, t]
4601
4609
  );
4602
4610
  return column;
4603
4611
  };
@@ -5029,7 +5037,7 @@ var useFilter = () => {
5029
5037
  return [sideFilter, statusFilter];
5030
5038
  }
5031
5039
  return [sideFilter, statusFilter, dateRangeFilter];
5032
- }, [side, status, dateRange]);
5040
+ }, [dateRange, isMobile, side, status, t]);
5033
5041
  return {
5034
5042
  filterItems,
5035
5043
  onFilter,
@@ -5961,7 +5969,7 @@ var Liquidation = (props) => {
5961
5969
  ] });
5962
5970
  };
5963
5971
  var TooltipHeaderCell = (props) => {
5964
- return /* @__PURE__ */ jsx("th", { className: "oui-h-10 oui-border-b oui-border-line oui-text-left oui-text-base-contrast-36", children: /* @__PURE__ */ jsx(
5972
+ return /* @__PURE__ */ jsx("th", { className: "oui-h-10 oui-border-b oui-border-line oui-text-start oui-text-base-contrast-36", children: /* @__PURE__ */ jsx(
5965
5973
  Tooltip,
5966
5974
  {
5967
5975
  content: props.tooltip,