@loafmarkets/ui 0.1.274 → 0.1.276
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 +16 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12470,7 +12470,7 @@ function OrderPanel({
|
|
|
12470
12470
|
const [isReceiveInputFocused, setIsReceiveInputFocused] = React5.useState(false);
|
|
12471
12471
|
const handlePayBlur = () => {
|
|
12472
12472
|
setIsPayInputFocused(false);
|
|
12473
|
-
const parsed = parseInt(payInputValue.replace(/[^0-9]/g, ""), 10) || 0;
|
|
12473
|
+
const parsed = parseInt(payInputValue.replace(/,/g, "").replace(/[^0-9]/g, ""), 10) || 0;
|
|
12474
12474
|
if (parsed <= 0) {
|
|
12475
12475
|
setManualOrderAmount(null);
|
|
12476
12476
|
setSliderValue(0);
|
|
@@ -12597,15 +12597,17 @@ function OrderPanel({
|
|
|
12597
12597
|
value: isPayInputFocused ? payInputValue : orderTotal.toLocaleString(),
|
|
12598
12598
|
onFocus: (e) => {
|
|
12599
12599
|
setIsPayInputFocused(true);
|
|
12600
|
-
|
|
12601
|
-
|
|
12600
|
+
const raw = manualOrderAmount ?? orderTotal;
|
|
12601
|
+
setPayInputValue(raw > 0 ? raw.toLocaleString() : "");
|
|
12602
|
+
requestAnimationFrame(() => e.target.select());
|
|
12602
12603
|
},
|
|
12603
12604
|
onBlur: handlePayBlur,
|
|
12604
12605
|
onChange: (e) => {
|
|
12605
|
-
const
|
|
12606
|
-
if (
|
|
12607
|
-
|
|
12608
|
-
|
|
12606
|
+
const raw = e.target.value.replace(/,/g, "");
|
|
12607
|
+
if (raw === "" || /^\d*\.?\d{0,2}$/.test(raw)) {
|
|
12608
|
+
const formatted = raw === "" ? "" : Number(raw.replace(/\..*$/, "")).toLocaleString() + (raw.includes(".") ? "." + raw.split(".")[1] : "");
|
|
12609
|
+
setPayInputValue(formatted);
|
|
12610
|
+
const parsed = parseInt(raw.replace(/[^0-9]/g, ""), 10) || 0;
|
|
12609
12611
|
if (parsed <= 0) {
|
|
12610
12612
|
setManualOrderAmount(null);
|
|
12611
12613
|
setSliderValue(0);
|
|
@@ -12679,15 +12681,15 @@ function OrderPanel({
|
|
|
12679
12681
|
style: { color: "#0ecb81" },
|
|
12680
12682
|
onFocus: (e) => {
|
|
12681
12683
|
setIsReceiveInputFocused(true);
|
|
12682
|
-
setReceiveInputValue(tokenQuantity.
|
|
12683
|
-
e.target.select();
|
|
12684
|
+
setReceiveInputValue(tokenQuantity > 0 ? tokenQuantity.toLocaleString() : "");
|
|
12685
|
+
requestAnimationFrame(() => e.target.select());
|
|
12684
12686
|
},
|
|
12685
12687
|
onBlur: handleReceiveBlur,
|
|
12686
12688
|
onChange: (e) => {
|
|
12687
|
-
const
|
|
12688
|
-
if (
|
|
12689
|
-
setReceiveInputValue(
|
|
12690
|
-
const units = Math.floor(parseInt(
|
|
12689
|
+
const raw = e.target.value.replace(/,/g, "");
|
|
12690
|
+
if (raw === "" || /^\d+$/.test(raw)) {
|
|
12691
|
+
setReceiveInputValue(raw === "" ? "" : Number(raw).toLocaleString());
|
|
12692
|
+
const units = Math.floor(parseInt(raw.replace(/[^0-9]/g, ""), 10) || 0);
|
|
12691
12693
|
const spend = units * tokenPrice;
|
|
12692
12694
|
if (units <= 0) {
|
|
12693
12695
|
setManualOrderAmount(null);
|
|
@@ -15054,7 +15056,7 @@ function PropertyBuy({
|
|
|
15054
15056
|
const statusColor = STATUS_COLOR2[ipoStatus] ?? "#D4AF37";
|
|
15055
15057
|
const displayStatusLabel = isPrivateClient && ipoStatus !== "LIVE" ? "Private Client Access" : statusLabel;
|
|
15056
15058
|
const displayStatusColor = isPrivateClient && ipoStatus !== "LIVE" ? "#D4AF37" : statusColor;
|
|
15057
|
-
const rawSpend = manualOrderAmount !== null ? manualOrderAmount : Math.round(sliderValue / 100 * availableBalance);
|
|
15059
|
+
const rawSpend = manualOrderAmount !== null ? manualOrderAmount : sliderValue === 100 ? Math.floor(availableBalance / (1 + feeRate)) : Math.round(sliderValue / 100 * availableBalance);
|
|
15058
15060
|
const tokenQuantity = Math.floor(rawSpend / tokenPrice);
|
|
15059
15061
|
const feeInUsd = tokenQuantity * tokenPrice * feeRate;
|
|
15060
15062
|
const orderTotal = tokenQuantity * tokenPrice + feeInUsd;
|