@0xsquid/ui 2.4.8 → 2.4.9
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/cjs/index.js +10 -3
- package/dist/esm/index.js +10 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -27376,8 +27376,15 @@ function NumericInput(_a) {
|
|
|
27376
27376
|
: "tw-text-grey-300";
|
|
27377
27377
|
const BalanceChipTag = balanceChipClickable ? "button" : "div";
|
|
27378
27378
|
const balanceFormatted = React$1.useMemo(() => {
|
|
27379
|
-
|
|
27380
|
-
|
|
27379
|
+
switch (userInputType) {
|
|
27380
|
+
case UserInputType.TOKEN:
|
|
27381
|
+
return formatTokenAmount(balance !== null && balance !== void 0 ? balance : "0");
|
|
27382
|
+
case UserInputType.USD:
|
|
27383
|
+
return formatUsdAmount(convertTokenAmountToUSD(balance !== null && balance !== void 0 ? balance : "0", token === null || token === void 0 ? void 0 : token.price), {
|
|
27384
|
+
includeSign: false,
|
|
27385
|
+
});
|
|
27386
|
+
}
|
|
27387
|
+
}, [userInputType, balance, token.price]);
|
|
27381
27388
|
const containerClassname = "tw-px-squid-xs !tw-h-full tw-pt-squid-xxs mobile-xs-height:tw-pb-squid-s tw-text-heading-small tw-font-regular mobile-lg:tw-px-squid-m tw-relative tw-h-[65px] mobile-sm-height:tw-h-[75px]";
|
|
27382
27389
|
const inputRef = React$1.useRef(null);
|
|
27383
27390
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInteractive && !isLoading ? (jsxRuntime.jsxs("form", { className: containerClassname, onSubmit: (e) => {
|
|
@@ -27396,7 +27403,7 @@ function NumericInput(_a) {
|
|
|
27396
27403
|
? "tw-opacity-0"
|
|
27397
27404
|
: "" }), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat("%") })] })) : null] }) }))), jsxRuntime.jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
|
|
27398
27405
|
? interactiveChipClassName
|
|
27399
|
-
: notInteractiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balanceFormatted }), !(balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.hideMaxChip) && jsxRuntime.jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
27406
|
+
: notInteractiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsxs("div", { children: [userInputType === UserInputType.USD && (jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "$" })), jsxRuntime.jsx(CaptionText, { children: balanceFormatted })] }), !(balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.hideMaxChip) && jsxRuntime.jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
27400
27407
|
}
|
|
27401
27408
|
|
|
27402
27409
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected = false, }) {
|
package/dist/esm/index.js
CHANGED
|
@@ -27356,8 +27356,15 @@ function NumericInput(_a) {
|
|
|
27356
27356
|
: "tw-text-grey-300";
|
|
27357
27357
|
const BalanceChipTag = balanceChipClickable ? "button" : "div";
|
|
27358
27358
|
const balanceFormatted = useMemo(() => {
|
|
27359
|
-
|
|
27360
|
-
|
|
27359
|
+
switch (userInputType) {
|
|
27360
|
+
case UserInputType.TOKEN:
|
|
27361
|
+
return formatTokenAmount(balance !== null && balance !== void 0 ? balance : "0");
|
|
27362
|
+
case UserInputType.USD:
|
|
27363
|
+
return formatUsdAmount(convertTokenAmountToUSD(balance !== null && balance !== void 0 ? balance : "0", token === null || token === void 0 ? void 0 : token.price), {
|
|
27364
|
+
includeSign: false,
|
|
27365
|
+
});
|
|
27366
|
+
}
|
|
27367
|
+
}, [userInputType, balance, token.price]);
|
|
27361
27368
|
const containerClassname = "tw-px-squid-xs !tw-h-full tw-pt-squid-xxs mobile-xs-height:tw-pb-squid-s tw-text-heading-small tw-font-regular mobile-lg:tw-px-squid-m tw-relative tw-h-[65px] mobile-sm-height:tw-h-[75px]";
|
|
27362
27369
|
const inputRef = useRef(null);
|
|
27363
27370
|
return (jsxs(Fragment, { children: [isInteractive && !isLoading ? (jsxs("form", { className: containerClassname, onSubmit: (e) => {
|
|
@@ -27376,7 +27383,7 @@ function NumericInput(_a) {
|
|
|
27376
27383
|
? "tw-opacity-0"
|
|
27377
27384
|
: "" }), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat("%") })] })) : null] }) }))), jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
|
|
27378
27385
|
? interactiveChipClassName
|
|
27379
|
-
: notInteractiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balanceFormatted }), !(balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.hideMaxChip) && jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
27386
|
+
: notInteractiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs("div", { children: [userInputType === UserInputType.USD && (jsx(CaptionText, { className: "tw-opacity-66", children: "$" })), jsx(CaptionText, { children: balanceFormatted })] }), !(balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.hideMaxChip) && jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
27380
27387
|
}
|
|
27381
27388
|
|
|
27382
27389
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected = false, }) {
|