@orderly.network/ui-orders 2.8.5 → 2.8.6

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.js CHANGED
@@ -376,7 +376,7 @@ var init_bracketOrderPrice = __esm({
376
376
  }
377
377
  return hooks.utils.findTPSLFromOrder(props.order.child_orders[0]);
378
378
  }, [props.order]);
379
- const { pnl, roi } = calcBracketRoiAndPnL(order);
379
+ const { pnl } = calcBracketRoiAndPnL(order);
380
380
  if (!tp_trigger_price && !sl_trigger_price) {
381
381
  return "--";
382
382
  }
@@ -2136,6 +2136,12 @@ var init_tpslTriggerPrice = __esm({
2136
2136
  init_tpslOrderRowContext();
2137
2137
  OrderTriggerPrice = () => {
2138
2138
  const { sl_trigger_price, tp_trigger_price, order, position } = useTPSLOrderRowContext();
2139
+ const positionSide = position?.position_qty && position.position_qty > 0 ? types.OrderSide.BUY : types.OrderSide.SELL;
2140
+ const slPriceError = hooks.useTpslPriceChecker({
2141
+ slPrice: sl_trigger_price?.toString() ?? void 0,
2142
+ liqPrice: position?.est_liq_price ?? null,
2143
+ side: positionSide
2144
+ });
2139
2145
  return /* @__PURE__ */ jsxRuntime.jsx(
2140
2146
  TPSLTriggerPrice,
2141
2147
  {
@@ -2144,6 +2150,7 @@ var init_tpslTriggerPrice = __esm({
2144
2150
  direction: "column",
2145
2151
  order,
2146
2152
  position,
2153
+ slPriceError,
2147
2154
  tooltip: true
2148
2155
  }
2149
2156
  );
@@ -2233,15 +2240,24 @@ var init_tpslTriggerPrice = __esm({
2233
2240
  ui.Text.numeral,
2234
2241
  {
2235
2242
  className: ui.cn(
2236
- "oui-text-trade-loss oui-gap-0 oui-decoration-white/20 oui-border-b oui-border-dashed oui-border-base-contrast-12"
2243
+ "oui-text-trade-loss oui-gap-0 oui-decoration-white/20 oui-border-b oui-border-dashed oui-border-base-contrast-12",
2244
+ "oui-flex oui-items-center"
2237
2245
  ),
2246
+ as: "div",
2238
2247
  rule: "price",
2239
2248
  dp: symbolInfo[order.symbol]("quote_dp", 2),
2240
2249
  children: props.stopLossPrice,
2241
2250
  prefix: !props.takeProfitPrice || direction === "column" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "oui-text-base-contrast-54", children: [
2242
2251
  `${t("tpsl.sl")} -`,
2243
2252
  "\xA0"
2244
- ] }) : ""
2253
+ ] }) : "",
2254
+ suffix: /* @__PURE__ */ jsxRuntime.jsx(
2255
+ uiTpsl.CloseToLiqPriceIcon,
2256
+ {
2257
+ slPriceError: props.slPriceError,
2258
+ className: "oui-ml-1"
2259
+ }
2260
+ )
2245
2261
  },
2246
2262
  "sl"
2247
2263
  )
@@ -2253,7 +2269,13 @@ var init_tpslTriggerPrice = __esm({
2253
2269
  children.splice(1, 0, /* @__PURE__ */ jsxRuntime.jsx("span", { children: "/" }, "split"));
2254
2270
  }
2255
2271
  return children;
2256
- }, [props.takeProfitPrice, props.stopLossPrice, order?.symbol, t]);
2272
+ }, [
2273
+ props.takeProfitPrice,
2274
+ props.stopLossPrice,
2275
+ order?.symbol,
2276
+ t,
2277
+ props.slPriceError
2278
+ ]);
2257
2279
  const content = /* @__PURE__ */ jsxRuntime.jsx(
2258
2280
  "div",
2259
2281
  {
@@ -3420,8 +3442,14 @@ var init_items = __esm({
3420
3442
  );
3421
3443
  };
3422
3444
  SLTrigger = (props) => {
3423
- const { sl_trigger_price, slPnL } = useTPSLOrderRowContext();
3445
+ const { sl_trigger_price, slPnL, position: item } = useTPSLOrderRowContext();
3424
3446
  const { t } = i18n.useTranslation();
3447
+ const side2 = (item?.position_qty ?? 0) > 0 ? types.OrderSide.BUY : types.OrderSide.SELL;
3448
+ const slPriceError = hooks.useTpslPriceChecker({
3449
+ slPrice: sl_trigger_price?.toString() ?? void 0,
3450
+ liqPrice: item?.est_liq_price ?? null,
3451
+ side: side2
3452
+ });
3425
3453
  return /* @__PURE__ */ jsxRuntime.jsx(
3426
3454
  ui.Statistic,
3427
3455
  {
@@ -3454,10 +3482,15 @@ var init_items = __esm({
3454
3482
  ui.Text.numeral,
3455
3483
  {
3456
3484
  dp: props.quote_dp,
3485
+ as: "div",
3457
3486
  rm: utils.Decimal.ROUND_DOWN,
3458
3487
  color: "sell",
3459
3488
  padding: false,
3460
- className: sl_trigger_price ? "oui-border-b oui-border-dashed oui-border-base-contrast-12" : void 0,
3489
+ suffix: /* @__PURE__ */ jsxRuntime.jsx(uiTpsl.CloseToLiqPriceIcon, { slPriceError }),
3490
+ className: ui.cn(
3491
+ sl_trigger_price ? "oui-border-b oui-border-dashed oui-border-base-contrast-12" : void 0,
3492
+ "oui-flex oui-items-center"
3493
+ ),
3461
3494
  children: sl_trigger_price ?? "--"
3462
3495
  }
3463
3496
  )
@@ -4546,7 +4579,7 @@ var init_editSheet_ui = __esm({
4546
4579
  const { t } = i18n.useTranslation();
4547
4580
  const { getErrorMsg } = reactApp.useOrderEntryFormErrorMsg(errors);
4548
4581
  const disabled = !props.isChanged || Object.keys(errors).length > 0 || // when activated price is not empty, the activated price input should not be empty
4549
- item.activated_price && !formattedOrder.activated_price;
4582
+ !!item.activated_price && !formattedOrder.activated_price;
4550
4583
  const header = /* @__PURE__ */ jsxRuntime.jsx(EditSheetHeader, { item });
4551
4584
  const lastPrice = /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", justify: "between", children: [
4552
4585
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: t("common.lastPrice") }),