@orderly.network/ui-order-entry 3.1.0 → 3.1.1

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
@@ -598,7 +598,10 @@ var SymbolBadge = (props) => {
598
598
  props.symbol
599
599
  );
600
600
  const badge = brokerName ?? brokerId ?? void 0;
601
- return /* @__PURE__ */ jsxRuntime.jsx(ui.SymbolBadge, { badge, fullName: brokerNameRaw });
601
+ if (!badge) {
602
+ return null;
603
+ }
604
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { as: "span", display: "inlineFlex", className: props.className, children: /* @__PURE__ */ jsxRuntime.jsx(ui.SymbolBadge, { badge, fullName: brokerNameRaw }) });
602
605
  };
603
606
  var OrderConfirmDialog = (props) => {
604
607
  const { symbolInfo, order, onConfirm, onCancel } = props;
@@ -3756,6 +3759,13 @@ var PriceInput = (props) => {
3756
3759
  }
3757
3760
  );
3758
3761
  };
3762
+ function stackedOrderInputRoundedCn(position) {
3763
+ return ui.cn(
3764
+ "!oui-rounded",
3765
+ position === "top" && "!oui-rounded-t-xl",
3766
+ position === "bottom" && "!oui-rounded-b-xl"
3767
+ );
3768
+ }
3759
3769
  var QuantityInput = React3.memo((props) => {
3760
3770
  const { t } = i18n.useTranslation();
3761
3771
  const { symbolInfo, onFocus, onBlur, getErrorMsg, setOrderValue } = useOrderEntryContext();
@@ -3775,8 +3785,9 @@ var QuantityInput = React3.memo((props) => {
3775
3785
  formatters: [ui.inputFormatter.dpFormatter(base_dp)],
3776
3786
  onFocus: onFocus(3 /* QUANTITY */),
3777
3787
  onBlur: onBlur(3 /* QUANTITY */),
3778
- className: "oui-orderEntry-quantityInput !oui-rounded-e",
3788
+ className: stackedOrderInputRoundedCn(props.stackPosition),
3779
3789
  classNames: {
3790
+ root: "oui-orderEntry-quantityInput",
3780
3791
  suffix: "oui-justify-end"
3781
3792
  }
3782
3793
  }
@@ -3868,8 +3879,9 @@ var TotalInput = React3.memo((props) => {
3868
3879
  formatters: [ui.inputFormatter.dpFormatter(2)],
3869
3880
  onFocus: onFocus(6 /* MARGIN */),
3870
3881
  onBlur: onBlur(6 /* MARGIN */),
3871
- className: "oui-orderEntry-marginInput !oui-rounded-s",
3882
+ className: stackedOrderInputRoundedCn(props.stackPosition),
3872
3883
  classNames: {
3884
+ root: "oui-orderEntry-marginInput",
3873
3885
  suffix: "oui-justify-end"
3874
3886
  }
3875
3887
  }
@@ -3888,8 +3900,9 @@ var TotalInput = React3.memo((props) => {
3888
3900
  onChange: (val) => {
3889
3901
  setOrderValue("total", val);
3890
3902
  },
3891
- className: "oui-orderEntry-totalInput !oui-rounded-s",
3903
+ className: stackedOrderInputRoundedCn(props.stackPosition),
3892
3904
  classNames: {
3905
+ root: "oui-orderEntry-totalInput",
3893
3906
  suffix: "oui-justify-end"
3894
3907
  },
3895
3908
  formatters: [ui.inputFormatter.dpFormatter(2)],
@@ -3900,9 +3913,15 @@ var TotalInput = React3.memo((props) => {
3900
3913
  });
3901
3914
  TotalInput.displayName = "TotalInput";
3902
3915
  var QtyAndTotalInput = React3.memo((props) => {
3903
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Grid, { cols: 2, className: "oui-orderEntry-qtyAndTotal oui-group oui-gap-1", children: [
3904
- /* @__PURE__ */ jsxRuntime.jsx(QuantityInput, { order_quantity: props.order_quantity }),
3905
- /* @__PURE__ */ jsxRuntime.jsx(TotalInput, { total: props.total })
3916
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-orderEntry-qtyAndTotal oui-space-y-1", children: [
3917
+ /* @__PURE__ */ jsxRuntime.jsx(
3918
+ QuantityInput,
3919
+ {
3920
+ order_quantity: props.order_quantity,
3921
+ stackPosition: props.quantityStackPosition
3922
+ }
3923
+ ),
3924
+ /* @__PURE__ */ jsxRuntime.jsx(TotalInput, { total: props.total, stackPosition: "bottom" })
3906
3925
  ] });
3907
3926
  });
3908
3927
  QtyAndTotalInput.displayName = "QtyAndTotalInput";
@@ -4428,7 +4447,7 @@ var ScaledQuantityUnit = (props) => {
4428
4447
  trigger: ui.cn(
4429
4448
  "oui-orderEntry-scaledQuantityUnit-btn",
4430
4449
  "oui-absolute oui-end-0 oui-top-1",
4431
- "oui-w-full oui-justify-end",
4450
+ "oui-w-auto oui-justify-end",
4432
4451
  "oui-shadow-none"
4433
4452
  )
4434
4453
  },
@@ -4473,7 +4492,7 @@ var ScaledQuantityInput = React3.memo((props) => {
4473
4492
  suffix,
4474
4493
  id: "order_quantity_input",
4475
4494
  name: "order_quantity_input",
4476
- className: "oui-orderEntry-scaledOrder-quantityInput !oui-rounded-e",
4495
+ className: stackedOrderInputRoundedCn(props.stackPosition),
4477
4496
  value: props.order_quantity,
4478
4497
  error: getErrorMsg(
4479
4498
  "order_quantity",
@@ -4484,7 +4503,10 @@ var ScaledQuantityInput = React3.memo((props) => {
4484
4503
  },
4485
4504
  formatters: [ui.inputFormatter.dpFormatter(base_dp)],
4486
4505
  onFocus: onFocus(3 /* QUANTITY */),
4487
- onBlur: onBlur(3 /* QUANTITY */)
4506
+ onBlur: onBlur(3 /* QUANTITY */),
4507
+ classNames: {
4508
+ root: "oui-orderEntry-scaledOrder-quantityInput"
4509
+ }
4488
4510
  }
4489
4511
  );
4490
4512
  }
@@ -4495,7 +4517,7 @@ var ScaledQuantityInput = React3.memo((props) => {
4495
4517
  suffix,
4496
4518
  id: "order_total_input",
4497
4519
  name: "order_total_input",
4498
- className: "oui-orderEntry-scaledOrder-totalInput !oui-rounded-e",
4520
+ className: stackedOrderInputRoundedCn(props.stackPosition),
4499
4521
  value: props.total,
4500
4522
  error: getErrorMsg("order_quantity", `${errors?.total?.value} ${quote}`),
4501
4523
  onChange: (val) => {
@@ -4503,7 +4525,10 @@ var ScaledQuantityInput = React3.memo((props) => {
4503
4525
  },
4504
4526
  formatters: [ui.inputFormatter.dpFormatter(quote_dp)],
4505
4527
  onFocus: onFocus(5 /* TOTAL */),
4506
- onBlur: onBlur(5 /* TOTAL */)
4528
+ onBlur: onBlur(5 /* TOTAL */),
4529
+ classNames: {
4530
+ root: "oui-orderEntry-scaledOrder-totalInput"
4531
+ }
4507
4532
  }
4508
4533
  );
4509
4534
  });
@@ -4542,7 +4567,7 @@ var TotalOrdersInput = React3.memo((props) => {
4542
4567
  label: t("orderEntry.totalOrders"),
4543
4568
  placeholder: "2-20",
4544
4569
  id: "order_total_orders_input",
4545
- className: "oui-orderEntry-scaledOrder-totalOrdersInput !oui-rounded-s",
4570
+ className: stackedOrderInputRoundedCn(props.stackPosition),
4546
4571
  value: props.total_orders,
4547
4572
  error: getErrorMsg("total_orders"),
4548
4573
  onChange: (val) => {
@@ -4554,7 +4579,10 @@ var TotalOrdersInput = React3.memo((props) => {
4554
4579
  ui.inputFormatter.dpFormatter(0)
4555
4580
  ],
4556
4581
  onFocus: onFocus(9 /* TOTAL_ORDERS */),
4557
- onBlur: onBlur(9 /* TOTAL_ORDERS */)
4582
+ onBlur: onBlur(9 /* TOTAL_ORDERS */),
4583
+ classNames: {
4584
+ root: "oui-orderEntry-scaledOrder-totalOrdersInput"
4585
+ }
4558
4586
  }
4559
4587
  );
4560
4588
  });
@@ -4569,23 +4597,23 @@ var ScaledOrderInput = (props) => {
4569
4597
  end_price: values.end_price
4570
4598
  }
4571
4599
  ),
4572
- /* @__PURE__ */ jsxRuntime.jsxs(
4573
- ui.Grid,
4574
- {
4575
- cols: 2,
4576
- className: "oui-scaledOrderInput-qtyAndOrders oui-group oui-gap-1",
4577
- children: [
4578
- /* @__PURE__ */ jsxRuntime.jsx(
4579
- ScaledQuantityInput,
4580
- {
4581
- order_quantity: values.order_quantity,
4582
- total: values.total
4583
- }
4584
- ),
4585
- /* @__PURE__ */ jsxRuntime.jsx(TotalOrdersInput, { total_orders: values.total_orders })
4586
- ]
4587
- }
4588
- ),
4600
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-scaledOrderInput-qtyAndOrders oui-space-y-1", children: [
4601
+ /* @__PURE__ */ jsxRuntime.jsx(
4602
+ ScaledQuantityInput,
4603
+ {
4604
+ order_quantity: values.order_quantity,
4605
+ total: values.total,
4606
+ stackPosition: "middle"
4607
+ }
4608
+ ),
4609
+ /* @__PURE__ */ jsxRuntime.jsx(
4610
+ TotalOrdersInput,
4611
+ {
4612
+ total_orders: values.total_orders,
4613
+ stackPosition: "middle"
4614
+ }
4615
+ )
4616
+ ] }),
4589
4617
  /* @__PURE__ */ jsxRuntime.jsx(
4590
4618
  QuantityDistributionInput,
4591
4619
  {
@@ -4861,7 +4889,8 @@ var TrailingStopInput = (props) => {
4861
4889
  QtyAndTotalInput,
4862
4890
  {
4863
4891
  order_quantity: values.order_quantity,
4864
- total: values.total
4892
+ total: values.total,
4893
+ quantityStackPosition: "middle"
4865
4894
  }
4866
4895
  )
4867
4896
  ] });
@@ -4895,7 +4924,8 @@ function OrderInput(props) {
4895
4924
  QtyAndTotalInput,
4896
4925
  {
4897
4926
  order_quantity: values.order_quantity,
4898
- total: values.total
4927
+ total: values.total,
4928
+ quantityStackPosition: showTriggerPrice || showPrice ? "middle" : "top"
4899
4929
  }
4900
4930
  )
4901
4931
  ] });