@loafmarkets/ui 0.1.57 → 0.1.58

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
@@ -10718,6 +10718,17 @@ function OrderPanel({
10718
10718
  const v = e.target.value;
10719
10719
  if (v === "" || /^\d*\.?\d{0,2}$/.test(v)) {
10720
10720
  setPayInputValue(v);
10721
+ const parsed = parseInt(v.replace(/[^0-9]/g, ""), 10) || 0;
10722
+ if (parsed <= 0) {
10723
+ setManualOrderAmount(null);
10724
+ setSliderValue(0);
10725
+ } else if (parsed >= availableBalance) {
10726
+ setManualOrderAmount(null);
10727
+ setSliderValue(100);
10728
+ } else {
10729
+ setManualOrderAmount(parsed);
10730
+ setSliderValue(availableBalance === 0 ? 0 : Math.round(Math.max(0, parsed / availableBalance * 100)));
10731
+ }
10721
10732
  }
10722
10733
  },
10723
10734
  onKeyDown: (e) => {
@@ -10789,6 +10800,18 @@ function OrderPanel({
10789
10800
  const v = e.target.value;
10790
10801
  if (v === "" || /^\d+$/.test(v)) {
10791
10802
  setReceiveInputValue(v);
10803
+ const units = Math.floor(parseInt(v.replace(/[^0-9]/g, ""), 10) || 0);
10804
+ const spend = units * tokenPrice;
10805
+ if (units <= 0) {
10806
+ setManualOrderAmount(null);
10807
+ setSliderValue(0);
10808
+ } else if (spend >= availableBalance) {
10809
+ setManualOrderAmount(null);
10810
+ setSliderValue(100);
10811
+ } else {
10812
+ setManualOrderAmount(spend);
10813
+ setSliderValue(availableBalance === 0 ? 0 : Math.round(Math.max(0, spend / availableBalance * 100)));
10814
+ }
10792
10815
  }
10793
10816
  },
10794
10817
  onKeyDown: (e) => {