@orderly.network/ui-order-entry 2.8.12 → 2.8.13-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.d.mts CHANGED
@@ -83,6 +83,8 @@ declare const useOrderEntryScript: (inputs: OrderEntryScriptInputs) => {
83
83
  resetMetaState: () => void;
84
84
  maxQty: number;
85
85
  estLiqPrice: number | null;
86
+ currentPosition: number;
87
+ estLiqPriceDistance: number | null;
86
88
  estLeverage: number | null;
87
89
  estSlippage: number | null;
88
90
  helper: {
package/dist/index.d.ts CHANGED
@@ -83,6 +83,8 @@ declare const useOrderEntryScript: (inputs: OrderEntryScriptInputs) => {
83
83
  resetMetaState: () => void;
84
84
  maxQty: number;
85
85
  estLiqPrice: number | null;
86
+ currentPosition: number;
87
+ estLiqPriceDistance: number | null;
86
88
  estLeverage: number | null;
87
89
  estSlippage: number | null;
88
90
  helper: {
package/dist/index.js CHANGED
@@ -60,14 +60,21 @@ var AdditionalInfo = (props) => {
60
60
  }
61
61
  ),
62
62
  /* @__PURE__ */ jsxRuntime.jsx(
63
- "label",
63
+ ui.Tooltip,
64
64
  {
65
- htmlFor: "toggle_order_post_only",
66
- className: ui.cn(
67
- "oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
68
- "oui-whitespace-nowrap oui-break-normal"
69
- ),
70
- children: t("orderEntry.orderType.postOnly")
65
+ content: t("orderEntry.orderType.postOnly.tooltip"),
66
+ className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
67
+ children: /* @__PURE__ */ jsxRuntime.jsx(
68
+ "label",
69
+ {
70
+ htmlFor: "toggle_order_post_only",
71
+ className: ui.cn(
72
+ "oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
73
+ "oui-cursor-pointer oui-whitespace-nowrap oui-break-normal oui-border-b oui-border-dashed oui-border-line-12"
74
+ ),
75
+ children: t("orderEntry.orderType.postOnly")
76
+ }
77
+ )
71
78
  }
72
79
  )
73
80
  ] }),
@@ -86,14 +93,21 @@ var AdditionalInfo = (props) => {
86
93
  }
87
94
  ),
88
95
  /* @__PURE__ */ jsxRuntime.jsx(
89
- "label",
96
+ ui.Tooltip,
90
97
  {
91
- htmlFor: "toggle_order_iov",
92
- className: ui.cn(
93
- "oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
94
- "oui-whitespace-nowrap oui-break-normal"
95
- ),
96
- children: t("orderEntry.orderType.ioc")
98
+ content: t("orderEntry.orderType.ioc.tooltip"),
99
+ className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
100
+ children: /* @__PURE__ */ jsxRuntime.jsx(
101
+ "label",
102
+ {
103
+ htmlFor: "toggle_order_iov",
104
+ className: ui.cn(
105
+ "oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
106
+ "oui-cursor-pointer oui-whitespace-nowrap oui-break-normal oui-border-b oui-border-dashed oui-border-line-12"
107
+ ),
108
+ children: t("orderEntry.orderType.ioc")
109
+ }
110
+ )
97
111
  }
98
112
  )
99
113
  ] }),
@@ -112,14 +126,21 @@ var AdditionalInfo = (props) => {
112
126
  }
113
127
  ),
114
128
  /* @__PURE__ */ jsxRuntime.jsx(
115
- "label",
129
+ ui.Tooltip,
116
130
  {
117
- htmlFor: "toggle_order_fok",
118
- className: ui.cn(
119
- "oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
120
- "oui-whitespace-nowrap oui-break-normal"
121
- ),
122
- children: t("orderEntry.orderType.fok")
131
+ content: t("orderEntry.orderType.fok.tooltip"),
132
+ className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
133
+ children: /* @__PURE__ */ jsxRuntime.jsx(
134
+ "label",
135
+ {
136
+ htmlFor: "toggle_order_fok",
137
+ className: ui.cn(
138
+ "oui-ml-1 oui-text-2xs peer-data-[disabled]:oui-text-base-contrast-20",
139
+ "oui-cursor-pointer oui-whitespace-nowrap oui-break-normal oui-border-b oui-border-dashed oui-border-line-12"
140
+ ),
141
+ children: t("orderEntry.orderType.fok")
142
+ }
143
+ )
123
144
  }
124
145
  )
125
146
  ] })
@@ -163,11 +184,18 @@ var AdditionalInfo = (props) => {
163
184
  }
164
185
  ),
165
186
  /* @__PURE__ */ jsxRuntime.jsx(
166
- "label",
187
+ ui.Tooltip,
167
188
  {
168
- htmlFor: "toggle_order_hidden",
169
- className: "oui-ml-1 oui-text-2xs",
170
- children: t("orderEntry.hidden")
189
+ content: t("orderEntry.hidden.tooltip"),
190
+ className: "oui-max-w-[280px] oui-text-2xs oui-text-base-contrast-80",
191
+ children: /* @__PURE__ */ jsxRuntime.jsx(
192
+ "label",
193
+ {
194
+ htmlFor: "toggle_order_hidden",
195
+ className: "oui-ml-1 oui-cursor-pointer oui-border-b oui-border-dashed oui-border-line-12 oui-text-2xs",
196
+ children: t("orderEntry.hidden")
197
+ }
198
+ )
171
199
  }
172
200
  )
173
201
  ] })
@@ -880,6 +908,11 @@ function AssetInfo(props) {
880
908
  const { canTrade, disableFeatures, orderType, symbol } = props;
881
909
  const { t } = i18n.useTranslation();
882
910
  const { isMobile } = ui.useScreen();
911
+ const displayEstLiqPrice = hooks.useGetEstLiqPrice({
912
+ estLiqPrice: props.estLiqPrice,
913
+ symbol,
914
+ side: props.side
915
+ });
883
916
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-space-y-[2px] xl:oui-space-y-1", children: [
884
917
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", children: [
885
918
  isMobile ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", children: t("orderEntry.estLiqPrice") }) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -916,7 +949,7 @@ function AssetInfo(props) {
916
949
  dp: props.dp,
917
950
  className: "oui-text-base-contrast-80",
918
951
  unitClassName: "oui-ml-1 oui-text-base-contrast-36",
919
- children: canTrade ? props.estLiqPrice ?? "--" : "--"
952
+ children: canTrade ? displayEstLiqPrice ?? "--" : "--"
920
953
  }
921
954
  )
922
955
  ] }),
@@ -4167,11 +4200,8 @@ var OrderEntry = (props) => {
4167
4200
  const soundAlertId = React3.useId();
4168
4201
  const { getErrorMsg } = reactApp.useOrderEntryFormErrorMsg(validated ? errors : null);
4169
4202
  const buttonLabel = React3.useMemo(() => {
4170
- if (isMobile && freeCollateral <= 0) {
4171
- return t("common.deposit");
4172
- }
4173
4203
  return side === types.OrderSide.BUY ? t("orderEntry.buyLong") : t("orderEntry.sellShort");
4174
- }, [side, t, isMobile, freeCollateral]);
4204
+ }, [side, t, isMobile]);
4175
4205
  React3.useEffect(() => {
4176
4206
  if (validated) {
4177
4207
  setErrorMsgVisible(true);
@@ -4443,17 +4473,9 @@ var OrderEntry = (props) => {
4443
4473
  id: "order-entry-submit-button",
4444
4474
  "data-type": types.OrderSide.BUY,
4445
4475
  className: ui.cn(
4446
- isMobile && freeCollateral <= 0 ? "oui-bg-primary-darken hover:oui-bg-primary-darken/80 active:oui-bg-primary-darken/80" : side === types.OrderSide.BUY ? "orderly-order-entry-submit-button-buy oui-bg-success-darken hover:oui-bg-success-darken/80 active:oui-bg-success-darken/80" : "orderly-order-entry-submit-button-sell oui-bg-danger-darken hover:oui-bg-danger-darken/80 active:oui-bg-danger-darken/80"
4476
+ side === types.OrderSide.BUY ? "orderly-order-entry-submit-button-buy oui-bg-success-darken hover:oui-bg-success-darken/80 active:oui-bg-success-darken/80" : "orderly-order-entry-submit-button-sell oui-bg-danger-darken hover:oui-bg-danger-darken/80 active:oui-bg-danger-darken/80"
4447
4477
  ),
4448
- onClick: () => {
4449
- if (isMobile && freeCollateral <= 0) {
4450
- ui.modal.show("DepositAndWithdrawWithSheetId", {
4451
- activeTab: "deposit"
4452
- });
4453
- } else {
4454
- validateSubmit();
4455
- }
4456
- },
4478
+ onClick: validateSubmit,
4457
4479
  loading: props.isMutating,
4458
4480
  disabled: !props.canTrade,
4459
4481
  children: buttonLabel
@@ -4465,6 +4487,7 @@ var OrderEntry = (props) => {
4465
4487
  canTrade: props.canTrade,
4466
4488
  quote: symbolInfo.quote,
4467
4489
  estLiqPrice: props.estLiqPrice,
4490
+ estLiqPriceDistance: props.estLiqPriceDistance,
4468
4491
  estLeverage: props.estLeverage,
4469
4492
  currentLeverage: props.currentLeverage,
4470
4493
  slippage,
@@ -4473,7 +4496,8 @@ var OrderEntry = (props) => {
4473
4496
  estSlippage: props.estSlippage,
4474
4497
  orderType: formattedOrder.order_type,
4475
4498
  disableFeatures,
4476
- symbol: props.symbol
4499
+ symbol: props.symbol,
4500
+ side
4477
4501
  }
4478
4502
  ),
4479
4503
  /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { className: "oui-w-full" }),
@@ -4960,7 +4984,9 @@ var useOrderEntryScript = (inputs) => {
4960
4984
  const slPriceError = hooks.useTpslPriceChecker({
4961
4985
  slPrice: formattedOrder.sl_trigger_price,
4962
4986
  liqPrice: state.estLiqPrice,
4963
- side: formattedOrder.side
4987
+ side: formattedOrder.side,
4988
+ currentPosition: state.currentPosition,
4989
+ orderQuantity: Number(formattedOrder.order_quantity)
4964
4990
  });
4965
4991
  React3.useEffect(() => {
4966
4992
  if (formattedOrder.reduce_only) {