@loafmarkets/ui 0.1.273 → 0.1.275

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
@@ -12444,7 +12444,7 @@ function OrderPanel({
12444
12444
  const [isReceiveInputFocused, setIsReceiveInputFocused] = useState(false);
12445
12445
  const handlePayBlur = () => {
12446
12446
  setIsPayInputFocused(false);
12447
- const parsed = parseInt(payInputValue.replace(/[^0-9]/g, ""), 10) || 0;
12447
+ const parsed = parseInt(payInputValue.replace(/,/g, "").replace(/[^0-9]/g, ""), 10) || 0;
12448
12448
  if (parsed <= 0) {
12449
12449
  setManualOrderAmount(null);
12450
12450
  setSliderValue(0);
@@ -12571,15 +12571,17 @@ function OrderPanel({
12571
12571
  value: isPayInputFocused ? payInputValue : orderTotal.toLocaleString(),
12572
12572
  onFocus: (e) => {
12573
12573
  setIsPayInputFocused(true);
12574
- setPayInputValue((manualOrderAmount ?? orderTotal).toString());
12575
- e.target.select();
12574
+ const raw = manualOrderAmount ?? orderTotal;
12575
+ setPayInputValue(raw > 0 ? raw.toLocaleString() : "");
12576
+ requestAnimationFrame(() => e.target.select());
12576
12577
  },
12577
12578
  onBlur: handlePayBlur,
12578
12579
  onChange: (e) => {
12579
- const v = e.target.value;
12580
- if (v === "" || /^\d*\.?\d{0,2}$/.test(v)) {
12581
- setPayInputValue(v);
12582
- const parsed = parseInt(v.replace(/[^0-9]/g, ""), 10) || 0;
12580
+ const raw = e.target.value.replace(/,/g, "");
12581
+ if (raw === "" || /^\d*\.?\d{0,2}$/.test(raw)) {
12582
+ const formatted = raw === "" ? "" : Number(raw.replace(/\..*$/, "")).toLocaleString() + (raw.includes(".") ? "." + raw.split(".")[1] : "");
12583
+ setPayInputValue(formatted);
12584
+ const parsed = parseInt(raw.replace(/[^0-9]/g, ""), 10) || 0;
12583
12585
  if (parsed <= 0) {
12584
12586
  setManualOrderAmount(null);
12585
12587
  setSliderValue(0);
@@ -12649,19 +12651,19 @@ function OrderPanel({
12649
12651
  {
12650
12652
  type: "text",
12651
12653
  inputMode: "numeric",
12652
- value: isReceiveInputFocused ? receiveInputValue : tokenQuantity.toString(),
12654
+ value: isReceiveInputFocused ? receiveInputValue : tokenQuantity.toLocaleString(),
12653
12655
  style: { color: "#0ecb81" },
12654
12656
  onFocus: (e) => {
12655
12657
  setIsReceiveInputFocused(true);
12656
- setReceiveInputValue(tokenQuantity.toString());
12657
- e.target.select();
12658
+ setReceiveInputValue(tokenQuantity > 0 ? tokenQuantity.toLocaleString() : "");
12659
+ requestAnimationFrame(() => e.target.select());
12658
12660
  },
12659
12661
  onBlur: handleReceiveBlur,
12660
12662
  onChange: (e) => {
12661
- const v = e.target.value;
12662
- if (v === "" || /^\d+$/.test(v)) {
12663
- setReceiveInputValue(v);
12664
- const units = Math.floor(parseInt(v.replace(/[^0-9]/g, ""), 10) || 0);
12663
+ const raw = e.target.value.replace(/,/g, "");
12664
+ if (raw === "" || /^\d+$/.test(raw)) {
12665
+ setReceiveInputValue(raw === "" ? "" : Number(raw).toLocaleString());
12666
+ const units = Math.floor(parseInt(raw.replace(/[^0-9]/g, ""), 10) || 0);
12665
12667
  const spend = units * tokenPrice;
12666
12668
  if (units <= 0) {
12667
12669
  setManualOrderAmount(null);