@orderly.network/ui-order-entry 3.1.0-alpha.0 → 3.1.1-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
@@ -3,7 +3,7 @@ import { useLocalStorage, utils, useGetEstLiqPrice, useOrderlyContext, useMemoiz
3
3
  import { i18n, useTranslation, Trans } from '@orderly.network/i18n';
4
4
  import { useOrderEntryFormErrorMsg, useCanTrade } from '@orderly.network/react-app';
5
5
  import { OrderSide, EMPTY_LIST, DistributionType, TrailingCallbackType, OrderType, MarginMode, PositionType, BBOOrderType, ORDER_ENTRY_EST_LIQ_PRICE_CHANGE, OrderLevel, TrackerEventName } from '@orderly.network/types';
6
- import { registerSimpleDialog, SimpleDialog, ExclamationFillIcon, modal, Text, Tooltip, TooltipTrigger, Flex, Input, cn, inputFormatter, Box, Slider, textVariants, injectable, Button, ThrottledButton, registerSimpleSheet, Select, Grid, Checkbox, SettingFillIcon, useScreen, Tips, InfoCircleIcon, AddCircleIcon, useModal, toast, Divider, Switch, SimpleSheet, Badge, TokenIcon, DataTable, IconButton, CloseIcon, CloseCircleFillIcon, ChevronRightIcon, SymbolBadge as SymbolBadge$1, EditIcon as EditIcon$1, SimpleDropdownMenu, CaretDownIcon, DotStatus, PopoverRoot, PopoverTrigger, PopoverContent } from '@orderly.network/ui';
6
+ import { registerSimpleDialog, SimpleDialog, ExclamationFillIcon, modal, Text, Tooltip, TooltipTrigger, Flex, Input, cn, inputFormatter, Box, Slider, textVariants, injectable, Button, ThrottledButton, registerSimpleSheet, Select, Checkbox, SettingFillIcon, Grid, useScreen, Tips, InfoCircleIcon, AddCircleIcon, useModal, toast, Divider, Switch, SimpleSheet, Badge, TokenIcon, DataTable, IconButton, CloseIcon, CloseCircleFillIcon, ChevronRightIcon, SymbolBadge as SymbolBadge$1, EditIcon as EditIcon$1, SimpleDropdownMenu, CaretDownIcon, DotStatus, PopoverRoot, PopoverTrigger, PopoverContent } from '@orderly.network/ui';
7
7
  import { TPSLPositionTypeWidget, TPSLAdvancedWidget } from '@orderly.network/ui-tpsl';
8
8
  import { Decimal, zero, formatSymbol, removeTrailingZeros, todpIfNeed, getBBOType } from '@orderly.network/utils';
9
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -592,7 +592,10 @@ var SymbolBadge = (props) => {
592
592
  props.symbol
593
593
  );
594
594
  const badge = brokerName ?? brokerId ?? void 0;
595
- return /* @__PURE__ */ jsx(SymbolBadge$1, { badge, fullName: brokerNameRaw });
595
+ if (!badge) {
596
+ return null;
597
+ }
598
+ return /* @__PURE__ */ jsx(Flex, { as: "span", display: "inlineFlex", className: props.className, children: /* @__PURE__ */ jsx(SymbolBadge$1, { badge, fullName: brokerNameRaw }) });
596
599
  };
597
600
  var OrderConfirmDialog = (props) => {
598
601
  const { symbolInfo, order, onConfirm, onCancel } = props;
@@ -3750,6 +3753,13 @@ var PriceInput = (props) => {
3750
3753
  }
3751
3754
  );
3752
3755
  };
3756
+ function stackedOrderInputRoundedCn(position) {
3757
+ return cn(
3758
+ "!oui-rounded",
3759
+ position === "top" && "!oui-rounded-t-xl",
3760
+ position === "bottom" && "!oui-rounded-b-xl"
3761
+ );
3762
+ }
3753
3763
  var QuantityInput = memo((props) => {
3754
3764
  const { t } = useTranslation();
3755
3765
  const { symbolInfo, onFocus, onBlur, getErrorMsg, setOrderValue } = useOrderEntryContext();
@@ -3769,8 +3779,9 @@ var QuantityInput = memo((props) => {
3769
3779
  formatters: [inputFormatter.dpFormatter(base_dp)],
3770
3780
  onFocus: onFocus(3 /* QUANTITY */),
3771
3781
  onBlur: onBlur(3 /* QUANTITY */),
3772
- className: "oui-orderEntry-quantityInput !oui-rounded-e",
3782
+ className: stackedOrderInputRoundedCn(props.stackPosition),
3773
3783
  classNames: {
3784
+ root: "oui-orderEntry-quantityInput",
3774
3785
  suffix: "oui-justify-end"
3775
3786
  }
3776
3787
  }
@@ -3862,8 +3873,9 @@ var TotalInput = memo((props) => {
3862
3873
  formatters: [inputFormatter.dpFormatter(2)],
3863
3874
  onFocus: onFocus(6 /* MARGIN */),
3864
3875
  onBlur: onBlur(6 /* MARGIN */),
3865
- className: "oui-orderEntry-marginInput !oui-rounded-s",
3876
+ className: stackedOrderInputRoundedCn(props.stackPosition),
3866
3877
  classNames: {
3878
+ root: "oui-orderEntry-marginInput",
3867
3879
  suffix: "oui-justify-end"
3868
3880
  }
3869
3881
  }
@@ -3882,8 +3894,9 @@ var TotalInput = memo((props) => {
3882
3894
  onChange: (val) => {
3883
3895
  setOrderValue("total", val);
3884
3896
  },
3885
- className: "oui-orderEntry-totalInput !oui-rounded-s",
3897
+ className: stackedOrderInputRoundedCn(props.stackPosition),
3886
3898
  classNames: {
3899
+ root: "oui-orderEntry-totalInput",
3887
3900
  suffix: "oui-justify-end"
3888
3901
  },
3889
3902
  formatters: [inputFormatter.dpFormatter(2)],
@@ -3894,9 +3907,15 @@ var TotalInput = memo((props) => {
3894
3907
  });
3895
3908
  TotalInput.displayName = "TotalInput";
3896
3909
  var QtyAndTotalInput = memo((props) => {
3897
- return /* @__PURE__ */ jsxs(Grid, { cols: 2, className: "oui-orderEntry-qtyAndTotal oui-group oui-gap-1", children: [
3898
- /* @__PURE__ */ jsx(QuantityInput, { order_quantity: props.order_quantity }),
3899
- /* @__PURE__ */ jsx(TotalInput, { total: props.total })
3910
+ return /* @__PURE__ */ jsxs("div", { className: "oui-orderEntry-qtyAndTotal oui-space-y-1", children: [
3911
+ /* @__PURE__ */ jsx(
3912
+ QuantityInput,
3913
+ {
3914
+ order_quantity: props.order_quantity,
3915
+ stackPosition: props.quantityStackPosition
3916
+ }
3917
+ ),
3918
+ /* @__PURE__ */ jsx(TotalInput, { total: props.total, stackPosition: "bottom" })
3900
3919
  ] });
3901
3920
  });
3902
3921
  QtyAndTotalInput.displayName = "QtyAndTotalInput";
@@ -4422,7 +4441,7 @@ var ScaledQuantityUnit = (props) => {
4422
4441
  trigger: cn(
4423
4442
  "oui-orderEntry-scaledQuantityUnit-btn",
4424
4443
  "oui-absolute oui-end-0 oui-top-1",
4425
- "oui-w-full oui-justify-end",
4444
+ "oui-w-auto oui-justify-end",
4426
4445
  "oui-shadow-none"
4427
4446
  )
4428
4447
  },
@@ -4467,7 +4486,7 @@ var ScaledQuantityInput = memo((props) => {
4467
4486
  suffix,
4468
4487
  id: "order_quantity_input",
4469
4488
  name: "order_quantity_input",
4470
- className: "oui-orderEntry-scaledOrder-quantityInput !oui-rounded-e",
4489
+ className: stackedOrderInputRoundedCn(props.stackPosition),
4471
4490
  value: props.order_quantity,
4472
4491
  error: getErrorMsg(
4473
4492
  "order_quantity",
@@ -4478,7 +4497,10 @@ var ScaledQuantityInput = memo((props) => {
4478
4497
  },
4479
4498
  formatters: [inputFormatter.dpFormatter(base_dp)],
4480
4499
  onFocus: onFocus(3 /* QUANTITY */),
4481
- onBlur: onBlur(3 /* QUANTITY */)
4500
+ onBlur: onBlur(3 /* QUANTITY */),
4501
+ classNames: {
4502
+ root: "oui-orderEntry-scaledOrder-quantityInput"
4503
+ }
4482
4504
  }
4483
4505
  );
4484
4506
  }
@@ -4489,7 +4511,7 @@ var ScaledQuantityInput = memo((props) => {
4489
4511
  suffix,
4490
4512
  id: "order_total_input",
4491
4513
  name: "order_total_input",
4492
- className: "oui-orderEntry-scaledOrder-totalInput !oui-rounded-e",
4514
+ className: stackedOrderInputRoundedCn(props.stackPosition),
4493
4515
  value: props.total,
4494
4516
  error: getErrorMsg("order_quantity", `${errors?.total?.value} ${quote}`),
4495
4517
  onChange: (val) => {
@@ -4497,7 +4519,10 @@ var ScaledQuantityInput = memo((props) => {
4497
4519
  },
4498
4520
  formatters: [inputFormatter.dpFormatter(quote_dp)],
4499
4521
  onFocus: onFocus(5 /* TOTAL */),
4500
- onBlur: onBlur(5 /* TOTAL */)
4522
+ onBlur: onBlur(5 /* TOTAL */),
4523
+ classNames: {
4524
+ root: "oui-orderEntry-scaledOrder-totalInput"
4525
+ }
4501
4526
  }
4502
4527
  );
4503
4528
  });
@@ -4536,7 +4561,7 @@ var TotalOrdersInput = memo((props) => {
4536
4561
  label: t("orderEntry.totalOrders"),
4537
4562
  placeholder: "2-20",
4538
4563
  id: "order_total_orders_input",
4539
- className: "oui-orderEntry-scaledOrder-totalOrdersInput !oui-rounded-s",
4564
+ className: stackedOrderInputRoundedCn(props.stackPosition),
4540
4565
  value: props.total_orders,
4541
4566
  error: getErrorMsg("total_orders"),
4542
4567
  onChange: (val) => {
@@ -4548,7 +4573,10 @@ var TotalOrdersInput = memo((props) => {
4548
4573
  inputFormatter.dpFormatter(0)
4549
4574
  ],
4550
4575
  onFocus: onFocus(9 /* TOTAL_ORDERS */),
4551
- onBlur: onBlur(9 /* TOTAL_ORDERS */)
4576
+ onBlur: onBlur(9 /* TOTAL_ORDERS */),
4577
+ classNames: {
4578
+ root: "oui-orderEntry-scaledOrder-totalOrdersInput"
4579
+ }
4552
4580
  }
4553
4581
  );
4554
4582
  });
@@ -4563,23 +4591,23 @@ var ScaledOrderInput = (props) => {
4563
4591
  end_price: values.end_price
4564
4592
  }
4565
4593
  ),
4566
- /* @__PURE__ */ jsxs(
4567
- Grid,
4568
- {
4569
- cols: 2,
4570
- className: "oui-scaledOrderInput-qtyAndOrders oui-group oui-gap-1",
4571
- children: [
4572
- /* @__PURE__ */ jsx(
4573
- ScaledQuantityInput,
4574
- {
4575
- order_quantity: values.order_quantity,
4576
- total: values.total
4577
- }
4578
- ),
4579
- /* @__PURE__ */ jsx(TotalOrdersInput, { total_orders: values.total_orders })
4580
- ]
4581
- }
4582
- ),
4594
+ /* @__PURE__ */ jsxs("div", { className: "oui-scaledOrderInput-qtyAndOrders oui-space-y-1", children: [
4595
+ /* @__PURE__ */ jsx(
4596
+ ScaledQuantityInput,
4597
+ {
4598
+ order_quantity: values.order_quantity,
4599
+ total: values.total,
4600
+ stackPosition: "middle"
4601
+ }
4602
+ ),
4603
+ /* @__PURE__ */ jsx(
4604
+ TotalOrdersInput,
4605
+ {
4606
+ total_orders: values.total_orders,
4607
+ stackPosition: "middle"
4608
+ }
4609
+ )
4610
+ ] }),
4583
4611
  /* @__PURE__ */ jsx(
4584
4612
  QuantityDistributionInput,
4585
4613
  {
@@ -4855,7 +4883,8 @@ var TrailingStopInput = (props) => {
4855
4883
  QtyAndTotalInput,
4856
4884
  {
4857
4885
  order_quantity: values.order_quantity,
4858
- total: values.total
4886
+ total: values.total,
4887
+ quantityStackPosition: "middle"
4859
4888
  }
4860
4889
  )
4861
4890
  ] });
@@ -4889,7 +4918,8 @@ function OrderInput(props) {
4889
4918
  QtyAndTotalInput,
4890
4919
  {
4891
4920
  order_quantity: values.order_quantity,
4892
- total: values.total
4921
+ total: values.total,
4922
+ quantityStackPosition: showTriggerPrice || showPrice ? "middle" : "top"
4893
4923
  }
4894
4924
  )
4895
4925
  ] });