@kodiak-finance/orderly-ui-order-entry 2.8.21-rc.1 → 2.8.21

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
@@ -752,6 +752,7 @@ var SlippageEditor = React3.forwardRef((props, ref) => {
752
752
  orderlyUi.Input,
753
753
  {
754
754
  suffix: "%",
755
+ inputMode: "decimal",
755
756
  formatters: [
756
757
  orderlyUi.inputFormatter.numberFormatter,
757
758
  orderlyUi.inputFormatter.dpFormatter(2)
@@ -2249,152 +2250,49 @@ var PriceInput = (props) => {
2249
2250
  }
2250
2251
  );
2251
2252
  };
2252
- var QuantityInput = React3.memo((props) => {
2253
+ var QtyAndTotalInput = React3.memo((props) => {
2253
2254
  const { t } = orderlyI18n.useTranslation();
2254
2255
  const { symbolInfo, onFocus, onBlur, getErrorMsg, setOrderValue } = useOrderEntryContext();
2255
- const { base, base_dp } = symbolInfo;
2256
- return /* @__PURE__ */ jsxRuntime.jsx(
2257
- CustomInput,
2258
- {
2259
- id: "order_quantity_input",
2260
- name: "order_quantity_input",
2261
- label: t("common.qty"),
2262
- suffix: base,
2263
- error: getErrorMsg("order_quantity"),
2264
- value: props.order_quantity,
2265
- onChange: (e) => {
2266
- setOrderValue("order_quantity", e);
2267
- },
2268
- formatters: [orderlyUi.inputFormatter.dpFormatter(base_dp)],
2269
- onFocus: onFocus(3 /* QUANTITY */),
2270
- onBlur: onBlur(3 /* QUANTITY */),
2271
- className: "!oui-rounded-r",
2272
- classNames: {
2273
- suffix: "oui-justify-end"
2274
- }
2275
- }
2276
- );
2277
- });
2278
- QuantityInput.displayName = "QuantityInput";
2279
- var TotalTypeSelect = React3.memo((props) => {
2280
- const { t } = orderlyI18n.useTranslation();
2281
- const options2 = React3.useMemo(() => {
2282
- return [
2283
- {
2284
- label: t("orderEntry.orderSize"),
2285
- value: "orderSize" /* OrderSize */
2286
- },
2256
+ const { base, quote, base_dp, quote_dp } = symbolInfo;
2257
+ return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Grid, { cols: 2, className: "oui-group oui-space-x-1", children: [
2258
+ /* @__PURE__ */ jsxRuntime.jsx(
2259
+ CustomInput,
2287
2260
  {
2288
- label: t("orderEntry.initialMargin"),
2289
- value: "initialMargin" /* InitialMargin */
2290
- }
2291
- ];
2292
- }, [t]);
2293
- return /* @__PURE__ */ jsxRuntime.jsx(
2294
- orderlyUi.Select.options,
2295
- {
2296
- size: "xs",
2297
- value: props.value,
2298
- valueFormatter: (value, option) => {
2299
- const item = options2.find((o) => o.value === value);
2300
- return item?.label + "\u2248";
2301
- },
2302
- classNames: {
2303
- trigger: orderlyUi.cn(
2304
- "oui-w-auto oui-border-none oui-bg-transparent",
2305
- "oui-absolute oui-left-0 oui-top-[5px] oui-text-2xs oui-text-base-contrast-36"
2306
- )
2307
- },
2308
- onValueChange: props.onChange,
2309
- options: options2
2310
- }
2311
- );
2312
- });
2313
- TotalTypeSelect.displayName = "TotalTypeSelect";
2314
- var TotalInput = React3.memo((props) => {
2315
- const { t } = orderlyI18n.useTranslation();
2316
- const { total } = props;
2317
- const [margin, setMargin] = React3.useState("");
2318
- const {
2319
- symbolInfo,
2320
- onFocus,
2321
- onBlur,
2322
- getErrorMsg,
2323
- setOrderValue,
2324
- leverage = 1,
2325
- currentFocusInput
2326
- } = useOrderEntryContext();
2327
- const { quote } = symbolInfo;
2328
- const [totalType, setTotalType] = orderlyHooks.useLocalStorage(
2329
- "orderly_order_total_type",
2330
- "orderSize" /* OrderSize */
2331
- );
2332
- React3.useEffect(() => {
2333
- if (total) {
2334
- if (currentFocusInput !== 6 /* MARGIN */) {
2335
- const margin2 = new orderlyUtils.Decimal(total).div(leverage).todp(2).toString();
2336
- setMargin(margin2);
2261
+ id: "order_quantity_input",
2262
+ name: "order_quantity_input",
2263
+ label: t("common.qty"),
2264
+ suffix: base,
2265
+ error: getErrorMsg("order_quantity"),
2266
+ value: props.order_quantity,
2267
+ onChange: (e) => {
2268
+ setOrderValue("order_quantity", e);
2269
+ },
2270
+ formatters: [orderlyUi.inputFormatter.dpFormatter(base_dp)],
2271
+ onFocus: onFocus(3 /* QUANTITY */),
2272
+ onBlur: onBlur(3 /* QUANTITY */),
2273
+ inputMode: "decimal",
2274
+ className: "!oui-rounded-r oui-rounded-bl-xl"
2337
2275
  }
2338
- } else {
2339
- setMargin("");
2340
- }
2341
- }, [total, leverage, currentFocusInput]);
2342
- const onMarginChange = (val) => {
2343
- const total2 = val ? new orderlyUtils.Decimal(val).mul(leverage).toString() : "";
2344
- setOrderValue("total", total2);
2345
- setMargin(val);
2346
- };
2347
- const prefix = /* @__PURE__ */ jsxRuntime.jsx(TotalTypeSelect, { value: totalType, onChange: setTotalType });
2348
- if (totalType === "initialMargin" /* InitialMargin */) {
2349
- return /* @__PURE__ */ jsxRuntime.jsx(
2276
+ ),
2277
+ /* @__PURE__ */ jsxRuntime.jsx(
2350
2278
  CustomInput,
2351
2279
  {
2352
- id: "order_margin_input",
2353
- name: "order_margin_input",
2354
- label: `${t("orderEntry.initialMargin")}\u2248`,
2355
- prefix,
2280
+ id: "order_total_input",
2281
+ name: "order_total_input",
2282
+ label: `${t("common.total")}\u2248`,
2356
2283
  suffix: quote,
2357
- error: getErrorMsg("total") ? "initial margin error" : "",
2358
- value: margin,
2359
- onChange: onMarginChange,
2360
- formatters: [orderlyUi.inputFormatter.dpFormatter(2)],
2361
- onFocus: onFocus(6 /* MARGIN */),
2362
- onBlur: onBlur(6 /* MARGIN */),
2363
- className: "!oui-rounded-l",
2364
- classNames: {
2365
- suffix: "oui-justify-end"
2366
- }
2284
+ error: getErrorMsg("total"),
2285
+ value: props.total,
2286
+ onChange: (e) => {
2287
+ setOrderValue("total", e);
2288
+ },
2289
+ formatters: [orderlyUi.inputFormatter.dpFormatter(quote_dp)],
2290
+ onFocus: onFocus(5 /* TOTAL */),
2291
+ onBlur: onBlur(5 /* TOTAL */),
2292
+ inputMode: "decimal",
2293
+ className: "!oui-rounded-bl oui-rounded-br-xl"
2367
2294
  }
2368
- );
2369
- }
2370
- return /* @__PURE__ */ jsxRuntime.jsx(
2371
- CustomInput,
2372
- {
2373
- id: "order_total_input",
2374
- name: "order_total_input",
2375
- label: `${t("orderEntry.orderSize")}\u2248`,
2376
- prefix,
2377
- suffix: quote,
2378
- error: getErrorMsg("total"),
2379
- value: props.total,
2380
- onChange: (val) => {
2381
- setOrderValue("total", val);
2382
- },
2383
- className: "!oui-rounded-l",
2384
- classNames: {
2385
- suffix: "oui-justify-end"
2386
- },
2387
- formatters: [orderlyUi.inputFormatter.dpFormatter(2)],
2388
- onFocus: onFocus(5 /* TOTAL */),
2389
- onBlur: onBlur(5 /* TOTAL */)
2390
- }
2391
- );
2392
- });
2393
- TotalInput.displayName = "TotalInput";
2394
- var QtyAndTotalInput = React3.memo((props) => {
2395
- return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Grid, { cols: 2, className: "oui-group oui-space-x-1", children: [
2396
- /* @__PURE__ */ jsxRuntime.jsx(QuantityInput, { order_quantity: props.order_quantity }),
2397
- /* @__PURE__ */ jsxRuntime.jsx(TotalInput, { total: props.total })
2295
+ )
2398
2296
  ] });
2399
2297
  });
2400
2298
  QtyAndTotalInput.displayName = "QtyAndTotalInput";
@@ -4042,6 +3940,7 @@ var TPSLTriggerPriceInput = (props) => {
4042
3940
  },
4043
3941
  color: props.error ? "danger" : void 0,
4044
3942
  autoComplete: "off",
3943
+ inputMode: "decimal",
4045
3944
  value: innerValue,
4046
3945
  classNames: {
4047
3946
  additional: "oui-text-base-contrast-54",
@@ -4510,21 +4409,29 @@ var OrderEntry = (props) => {
4510
4409
  ),
4511
4410
  !showSoundSection && extraButton
4512
4411
  ] }),
4513
- showSoundSection && /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { justify: "between", itemAlign: "center", children: [
4514
- /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", gapX: 1, children: [
4515
- /* @__PURE__ */ jsxRuntime.jsx(
4516
- orderlyUi.Switch,
4517
- {
4518
- className: "oui-h-[14px]",
4519
- id: soundAlertId,
4520
- checked: soundAlert,
4521
- onCheckedChange: (checked) => setSoundAlert(checked)
4522
- }
4523
- ),
4524
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: soundAlertId, className: "oui-text-xs", children: t("portfolio.setting.soundAlerts") })
4525
- ] }),
4526
- extraButton
4527
- ] }),
4412
+ showSoundSection && /* @__PURE__ */ jsxRuntime.jsxs(
4413
+ orderlyUi.Flex,
4414
+ {
4415
+ justify: "between",
4416
+ itemAlign: "center",
4417
+ className: "!oui-mt-0 xl:!oui-mt-3",
4418
+ children: [
4419
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", gapX: 1, children: [
4420
+ /* @__PURE__ */ jsxRuntime.jsx(
4421
+ orderlyUi.Switch,
4422
+ {
4423
+ className: "oui-h-[14px]",
4424
+ id: soundAlertId,
4425
+ checked: soundAlert,
4426
+ onCheckedChange: (checked) => setSoundAlert(checked)
4427
+ }
4428
+ ),
4429
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: soundAlertId, className: "oui-text-xs", children: t("portfolio.setting.soundAlerts") })
4430
+ ] }),
4431
+ extraButton
4432
+ ]
4433
+ }
4434
+ ),
4528
4435
  !showSoundSection && isMobile && (formattedOrder.order_type == orderlyTypes.OrderType.LIMIT || formattedOrder.order_type == orderlyTypes.OrderType.MARKET) && !formattedOrder.reduce_only && !pinned && /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { className: "oui-w-full", justify: "end", children: extraButton }),
4529
4436
  pinned && /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { p: 2, r: "md", intensity: 700, position: "relative", children: [
4530
4437
  /* @__PURE__ */ jsxRuntime.jsx(AdditionalInfo, { ...additionalInfoProps }),