@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.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
|
-
|
|
12575
|
-
|
|
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
|
|
12580
|
-
if (
|
|
12581
|
-
|
|
12582
|
-
|
|
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);
|
|
@@ -12653,15 +12655,15 @@ function OrderPanel({
|
|
|
12653
12655
|
style: { color: "#0ecb81" },
|
|
12654
12656
|
onFocus: (e) => {
|
|
12655
12657
|
setIsReceiveInputFocused(true);
|
|
12656
|
-
setReceiveInputValue(tokenQuantity.
|
|
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
|
|
12662
|
-
if (
|
|
12663
|
-
setReceiveInputValue(
|
|
12664
|
-
const units = Math.floor(parseInt(
|
|
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);
|
|
@@ -15028,7 +15030,7 @@ function PropertyBuy({
|
|
|
15028
15030
|
const statusColor = STATUS_COLOR2[ipoStatus] ?? "#D4AF37";
|
|
15029
15031
|
const displayStatusLabel = isPrivateClient && ipoStatus !== "LIVE" ? "Private Client Access" : statusLabel;
|
|
15030
15032
|
const displayStatusColor = isPrivateClient && ipoStatus !== "LIVE" ? "#D4AF37" : statusColor;
|
|
15031
|
-
const rawSpend = manualOrderAmount !== null ? manualOrderAmount : Math.round(sliderValue / 100 * availableBalance);
|
|
15033
|
+
const rawSpend = manualOrderAmount !== null ? manualOrderAmount : sliderValue === 100 ? Math.floor(availableBalance / (1 + feeRate)) : Math.round(sliderValue / 100 * availableBalance);
|
|
15032
15034
|
const tokenQuantity = Math.floor(rawSpend / tokenPrice);
|
|
15033
15035
|
const feeInUsd = tokenQuantity * tokenPrice * feeRate;
|
|
15034
15036
|
const orderTotal = tokenQuantity * tokenPrice + feeInUsd;
|