@0xsquid/ui 0.27.2 → 0.27.3-alpha.0
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 +31 -80
- package/dist/cjs/types/components/layout/AppContainer.d.ts +1 -0
- package/dist/cjs/types/components/layout/PipeSeparator.d.ts +1 -1
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +2 -2
- package/dist/cjs/types/types/components.d.ts +2 -2
- package/dist/cjs/types/types/index.d.ts +1 -1
- package/dist/esm/index.js +25 -74
- package/dist/esm/types/components/layout/AppContainer.d.ts +1 -0
- package/dist/esm/types/components/layout/PipeSeparator.d.ts +1 -1
- package/dist/esm/types/components/views/SwapProgressView.d.ts +2 -2
- package/dist/esm/types/types/components.d.ts +2 -2
- package/dist/esm/types/types/index.d.ts +1 -1
- package/dist/index.d.ts +7 -6
- package/package.json +5 -2
- package/dist/cjs/types/core/numbers.d.ts +0 -23
- package/dist/esm/types/core/numbers.d.ts +0 -23
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React$1 = require('react');
|
|
5
|
+
var reactHooks = require('@0xsquid/react-hooks');
|
|
5
6
|
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
var n = Object.create(null);
|
|
@@ -6595,59 +6596,6 @@ var debounce_1 = debounce;
|
|
|
6595
6596
|
|
|
6596
6597
|
var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounce_1);
|
|
6597
6598
|
|
|
6598
|
-
/**
|
|
6599
|
-
* Convert token amount to USD
|
|
6600
|
-
* @param {string|number} tokenAmount - The amount of tokens
|
|
6601
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
6602
|
-
* @returns {BigNumber} - The equivalent amount in USD
|
|
6603
|
-
*/
|
|
6604
|
-
function convertTokenAmountToUSD(tokenAmount, tokenPrice, maxDecimals = 2) {
|
|
6605
|
-
if (!tokenAmount || !tokenPrice)
|
|
6606
|
-
return "";
|
|
6607
|
-
const amount = new BigNumber(tokenAmount);
|
|
6608
|
-
const price = new BigNumber(tokenPrice);
|
|
6609
|
-
return amount.multipliedBy(price).decimalPlaces(maxDecimals).toString();
|
|
6610
|
-
}
|
|
6611
|
-
/**
|
|
6612
|
-
* Convert USD to token amount
|
|
6613
|
-
* @param {string|number} usdAmount - The amount in USD
|
|
6614
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
6615
|
-
* @param {number} maxDecimals - The maximum number of decimals
|
|
6616
|
-
* @returns {BigNumber} - The equivalent amount of tokens
|
|
6617
|
-
*/
|
|
6618
|
-
function convertUSDToTokenAmount(usdAmount, tokenPrice, maxDecimals) {
|
|
6619
|
-
if (!usdAmount || !tokenPrice || !maxDecimals)
|
|
6620
|
-
return "0";
|
|
6621
|
-
const amount = new BigNumber(usdAmount);
|
|
6622
|
-
const price = new BigNumber(tokenPrice);
|
|
6623
|
-
return amount.dividedBy(price).decimalPlaces(maxDecimals).toString();
|
|
6624
|
-
}
|
|
6625
|
-
const INTL_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
6626
|
-
minimumFractionDigits: 2,
|
|
6627
|
-
maximumFractionDigits: 5,
|
|
6628
|
-
});
|
|
6629
|
-
/**
|
|
6630
|
-
* Formats a number to the en-US number format
|
|
6631
|
-
*
|
|
6632
|
-
* @param amount - The number to format
|
|
6633
|
-
* @returns The formatted string
|
|
6634
|
-
*/
|
|
6635
|
-
function formatAmount(amount) {
|
|
6636
|
-
return INTL_NUMBER_FORMATTER.format(amount);
|
|
6637
|
-
}
|
|
6638
|
-
function trimExtraDecimals(value, maxDecimals) {
|
|
6639
|
-
var _a;
|
|
6640
|
-
const split = value.split(".");
|
|
6641
|
-
if (split.length > 1) {
|
|
6642
|
-
const decimals = (_a = split[1]) !== null && _a !== void 0 ? _a : "";
|
|
6643
|
-
if (maxDecimals && decimals.length > maxDecimals) {
|
|
6644
|
-
const newValue = `${split[0]}.${decimals.slice(0, maxDecimals)}`;
|
|
6645
|
-
return newValue;
|
|
6646
|
-
}
|
|
6647
|
-
}
|
|
6648
|
-
return value;
|
|
6649
|
-
}
|
|
6650
|
-
|
|
6651
6599
|
function SwapInputsIcon() {
|
|
6652
6600
|
return (jsxRuntime.jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("g", { clipPath: "url(#clip0_40_7936)", children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_40_7936", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
6653
6601
|
}
|
|
@@ -17869,9 +17817,8 @@ function NavigationBar(_a) {
|
|
|
17869
17817
|
: "tw-flex"), children: jsxRuntime.jsx(HeadingText, { size: "small", children: title }) })) : null] })));
|
|
17870
17818
|
}
|
|
17871
17819
|
|
|
17872
|
-
function PipeSeparator(
|
|
17873
|
-
|
|
17874
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-h-[0.8em] tw-w-[2px] tw-rounded-full tw-bg-[currentColor]", className) })));
|
|
17820
|
+
function PipeSeparator(props) {
|
|
17821
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-h-[0.8em] tw-w-[2px] tw-rounded-full tw-bg-[currentColor]", props.className) })));
|
|
17875
17822
|
}
|
|
17876
17823
|
|
|
17877
17824
|
function CollapsibleMenu({ children, menuRef, isOpen, transitionDuration, size, className, }) {
|
|
@@ -18796,7 +18743,7 @@ function ListItem(_a) {
|
|
|
18796
18743
|
});
|
|
18797
18744
|
return (jsxRuntime.jsxs("li", Object.assign({}, containerProps, { ref: itemRef, className: cn("tw-relative tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300 tw-highlight-adjacent", listItemSizeMap[size], extraPadding && "tw-px-squid-xs", compactOnMobile
|
|
18798
18745
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
18799
|
-
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin"), children: [size === "large" ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon
|
|
18746
|
+
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin"), children: [size === "large" ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon || (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, placeholderImageUrl: placeholderImageUrl, size: "md", rounded: rounded })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon || (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn("tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs",
|
|
18800
18747
|
// 'large' variant has extra padding
|
|
18801
18748
|
size === "large" ? "tw-w-[56%] tw-pl-squid-xxs" : "tw-w-[67%]"), children: [typeof itemTitle === "string" ? (jsxRuntime.jsx(BodyText, { size: "small", className: cn("tw-max-w-full tw-truncate", subtitle && "tw-h-[17px] !tw-leading-[17px]", compactOnMobile ? "tw-hidden mobile-lg:tw-block" : "tw-block"), children: itemTitle })) : (itemTitle), size === "large" &&
|
|
18802
18749
|
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (loadingComponent()) : subtitle ? (jsxRuntime.jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsxRuntime.jsx(CaptionText, { className: cn(subtitleClassName, "tw-hidden group-hover/list-item:tw-block"), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxRuntime.jsxs(DetailTag, Object.assign({}, detailProps, { className: cn("tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs", size === "large" ? "tw-h-squid-xl" : "tw-h-squid-l", showDetailOnHoverOnly
|
|
@@ -18804,10 +18751,9 @@ function ListItem(_a) {
|
|
|
18804
18751
|
: "tw-flex", isDetailInteractive && "hover:tw-bg-material-light-thin", detailButtonClassName), children: [!!detail && (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] })))] })), !!dropdownMenuContent && (jsxRuntime.jsx(ListItemActionsButton, { ref: openDropdownButtonRef, onClick: openDropdown, isActive: isDropdownOpen, className: "peer-hover/list-item:tw-opacity-100" })), isDropdownOpen && !!dropdownMenuContent ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef, isHidden: !dropdownStyles, className: cn(!!dropdownStyles &&
|
|
18805
18752
|
dropdownPositionClassMap$1[dropdownStyles.position]), dropdownRef: dropdownRef, children: dropdownMenuContent })) : null] })));
|
|
18806
18753
|
}
|
|
18807
|
-
const ListItemActionsButton = React$1.forwardRef((
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
: "tw-opacity-0", props.className), children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })));
|
|
18754
|
+
const ListItemActionsButton = React$1.forwardRef((_a, ref) => {
|
|
18755
|
+
var { isActive, className } = _a, props = __rest$1(_a, ["isActive", "className"]);
|
|
18756
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { ref: ref, className: cn("tw-peer tw-absolute tw-right-squid-s tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-p-2 tw-text-grey-300 hover:tw-bg-material-light-thin hover:tw-opacity-100 focus-visible:tw-opacity-100", isActive ? "tw-bg-material-light-thin tw-opacity-100" : "tw-opacity-0", className), children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })));
|
|
18811
18757
|
});
|
|
18812
18758
|
|
|
18813
18759
|
const dropdownPositionClassMap = {
|
|
@@ -19223,6 +19169,7 @@ const SwapStepsCollapsed = React$1.forwardRef((props, ref) => {
|
|
|
19223
19169
|
// show separator for all steps except the first one
|
|
19224
19170
|
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? "pending" : step.status }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-max-h-[55px] tw-min-h-[55px] tw-w-full tw-justify-center tw-gap-squid-xs tw-self-stretch tw-px-squid-s tw-pb-squid-s", children: jsxRuntime.jsx(Button$1, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full", containerClassName: "tw-w-full" }) })] }) })] }) }) }));
|
|
19225
19171
|
});
|
|
19172
|
+
SwapStepsCollapsed.displayName = "SwapStepsCollapsed";
|
|
19226
19173
|
|
|
19227
19174
|
const WIDTH_SM = "69";
|
|
19228
19175
|
const HEIGHT_SM = "31";
|
|
@@ -25178,7 +25125,9 @@ function PopLayout(props) {
|
|
|
25178
25125
|
}
|
|
25179
25126
|
|
|
25180
25127
|
function Toast({ headerContent, actionsContent, description, chipLabel, title, }) {
|
|
25181
|
-
return (jsxRuntime.jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs",
|
|
25128
|
+
return (jsxRuntime.jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", contentWrapperProps: {
|
|
25129
|
+
className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs",
|
|
25130
|
+
}, rounded: "sm", children: [headerContent, jsxRuntime.jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsxRuntime.jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsxRuntime.jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsxRuntime.jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
|
|
25182
25131
|
}
|
|
25183
25132
|
|
|
25184
25133
|
var lib = {};
|
|
@@ -26292,10 +26241,7 @@ const tooltipThresholdPaddingMap = {
|
|
|
26292
26241
|
xl: "40px",
|
|
26293
26242
|
xxl: "60px",
|
|
26294
26243
|
};
|
|
26295
|
-
const TooltipContainer = (
|
|
26296
|
-
var { className } = _a, props = __rest$1(_a, ["className"]);
|
|
26297
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-relative", className) })));
|
|
26298
|
-
};
|
|
26244
|
+
const TooltipContainer = (props) => (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-relative", props.className) })));
|
|
26299
26245
|
const TooltipTriggerWrapper = (_a) => {
|
|
26300
26246
|
var { elementRef } = _a, props = __rest$1(_a, ["elementRef"]);
|
|
26301
26247
|
return jsxRuntime.jsx("div", Object.assign({}, props, { ref: elementRef }));
|
|
@@ -26486,10 +26432,10 @@ function NumericInput(_a) {
|
|
|
26486
26432
|
}
|
|
26487
26433
|
}, [forcedAmount]);
|
|
26488
26434
|
const updateInputValue = React$1.useCallback((newValue) => {
|
|
26489
|
-
const safeNewValue = trimExtraDecimals(newValue, token.decimals);
|
|
26435
|
+
const safeNewValue = reactHooks.trimExtraDecimals(newValue, token.decimals);
|
|
26490
26436
|
const formattedAmount = userInputType === UserInputType.TOKEN
|
|
26491
26437
|
? safeNewValue
|
|
26492
|
-
: convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
26438
|
+
: reactHooks.convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
26493
26439
|
setInputValue(formattedAmount);
|
|
26494
26440
|
}, [userInputType, token.price, direction, token.decimals]);
|
|
26495
26441
|
const onBalanceButtonClick = React$1.useCallback(() => {
|
|
@@ -26502,7 +26448,7 @@ function NumericInput(_a) {
|
|
|
26502
26448
|
onAmountChange,
|
|
26503
26449
|
]);
|
|
26504
26450
|
const handleInputChange = (e) => {
|
|
26505
|
-
|
|
26451
|
+
const value = e.target.value.replace(/,/g, "."); // Replace commas with dots
|
|
26506
26452
|
const maxDecimalsForInputType = userInputType === UserInputType.TOKEN ? token.decimals : maxUsdDecimals;
|
|
26507
26453
|
const isValidAmount = new RegExp(`^\\d*\\.?\\d{0,${maxDecimalsForInputType}}$`).test(value);
|
|
26508
26454
|
if (isValidAmount) {
|
|
@@ -26523,8 +26469,8 @@ function NumericInput(_a) {
|
|
|
26523
26469
|
var _a;
|
|
26524
26470
|
if (inputValue !== "") {
|
|
26525
26471
|
const convertedAmount = userInputType === UserInputType.TOKEN
|
|
26526
|
-
? convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals)
|
|
26527
|
-
: convertUSDToTokenAmount(inputValue, token.price, token.decimals);
|
|
26472
|
+
? reactHooks.convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals)
|
|
26473
|
+
: reactHooks.convertUSDToTokenAmount(inputValue, token.price, token.decimals);
|
|
26528
26474
|
setInputValue(convertedAmount);
|
|
26529
26475
|
}
|
|
26530
26476
|
setUserInputType((prevMode) => prevMode === UserInputType.TOKEN
|
|
@@ -26541,7 +26487,7 @@ function NumericInput(_a) {
|
|
|
26541
26487
|
isUsdAmountVerySmall: false,
|
|
26542
26488
|
};
|
|
26543
26489
|
if (userInputType === UserInputType.TOKEN) {
|
|
26544
|
-
const usdRawAmount = convertTokenAmountToUSD(amount, token.price, maxUsdDecimals);
|
|
26490
|
+
const usdRawAmount = reactHooks.convertTokenAmountToUSD(amount, token.price, maxUsdDecimals);
|
|
26545
26491
|
const tokenRawAmount = amount;
|
|
26546
26492
|
const isTokenAmountVerySmall = !!tokenRawAmount &&
|
|
26547
26493
|
RegExpNonZeroValue.test(tokenRawAmount) &&
|
|
@@ -26558,7 +26504,7 @@ function NumericInput(_a) {
|
|
|
26558
26504
|
};
|
|
26559
26505
|
}
|
|
26560
26506
|
else {
|
|
26561
|
-
const tokenRawAmount = convertUSDToTokenAmount(amount, token.price, token.decimals);
|
|
26507
|
+
const tokenRawAmount = reactHooks.convertUSDToTokenAmount(amount, token.price, token.decimals);
|
|
26562
26508
|
const usdRawAmount = amount;
|
|
26563
26509
|
const isUsdAmountVerySmall = (!!usdRawAmount &&
|
|
26564
26510
|
RegExpNonZeroValue.test(usdRawAmount) &&
|
|
@@ -26582,14 +26528,18 @@ function NumericInput(_a) {
|
|
|
26582
26528
|
return "0";
|
|
26583
26529
|
if (userInputType === UserInputType.TOKEN) {
|
|
26584
26530
|
if (direction === "from") {
|
|
26585
|
-
return
|
|
26531
|
+
return reactHooks.formatUsdAmount(reactHooks.convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals), {
|
|
26532
|
+
includeSign: false,
|
|
26533
|
+
});
|
|
26586
26534
|
}
|
|
26587
26535
|
else {
|
|
26588
|
-
return
|
|
26536
|
+
return reactHooks.formatUsdAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : "0", {
|
|
26537
|
+
includeSign: false,
|
|
26538
|
+
});
|
|
26589
26539
|
}
|
|
26590
26540
|
}
|
|
26591
26541
|
else {
|
|
26592
|
-
return
|
|
26542
|
+
return reactHooks.formatTokenAmount(reactHooks.convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
26593
26543
|
}
|
|
26594
26544
|
}, [
|
|
26595
26545
|
inputValue,
|
|
@@ -26606,7 +26556,7 @@ function NumericInput(_a) {
|
|
|
26606
26556
|
: "tw-text-grey-300";
|
|
26607
26557
|
const BalanceChipTag = balanceChipClickable ? "button" : "div";
|
|
26608
26558
|
const balanceFormatted = React$1.useMemo(() => {
|
|
26609
|
-
return
|
|
26559
|
+
return reactHooks.formatTokenAmount(balance !== null && balance !== void 0 ? balance : "0");
|
|
26610
26560
|
}, [balance]);
|
|
26611
26561
|
const containerClassname = "tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-px-squid-m tw-relative tw-h-[65px] mobile-sm-height:tw-h-[75px]";
|
|
26612
26562
|
const inputRef = React$1.useRef(null);
|
|
@@ -62008,7 +61958,7 @@ const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
|
62008
61958
|
return "Needs gas on destination";
|
|
62009
61959
|
}
|
|
62010
61960
|
};
|
|
62011
|
-
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, }) => {
|
|
61961
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, refundTokenSymbol, }) => {
|
|
62012
61962
|
switch (swapState) {
|
|
62013
61963
|
case SwapState.CONFIRM: {
|
|
62014
61964
|
return "Authenticate the transaction in your wallet.";
|
|
@@ -62029,7 +61979,7 @@ const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, to
|
|
|
62029
61979
|
return "You declined the transaction in your wallet.";
|
|
62030
61980
|
}
|
|
62031
61981
|
case SwapState.PARTIAL_SUCCESS: {
|
|
62032
|
-
return `You received a refund of
|
|
61982
|
+
return `You received a refund of ${refundTokenSymbol} to your wallet ${toAddressFormatted} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}.`;
|
|
62033
61983
|
}
|
|
62034
61984
|
case SwapState.NEEDS_GAS: {
|
|
62035
61985
|
return "Add gas to the transaction via Axelarscan to complete the swap";
|
|
@@ -62046,7 +61996,7 @@ const swapProgressButtonTexts = {
|
|
|
62046
61996
|
[SwapState.PARTIAL_SUCCESS]: "Cancel",
|
|
62047
61997
|
[SwapState.NEEDS_GAS]: "Go to Axelarscan",
|
|
62048
61998
|
};
|
|
62049
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }) {
|
|
61999
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }) {
|
|
62050
62000
|
const [showSwapInfoSection, setShowSwapInfoSection] = React$1.useState(true);
|
|
62051
62001
|
const isFirstRenderRef = React$1.useRef(true);
|
|
62052
62002
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -62076,6 +62026,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
62076
62026
|
toChain,
|
|
62077
62027
|
toToken,
|
|
62078
62028
|
toAddressFormatted,
|
|
62029
|
+
refundTokenSymbol,
|
|
62079
62030
|
});
|
|
62080
62031
|
return {
|
|
62081
62032
|
headerTitle,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
export declare function PipeSeparator(
|
|
2
|
+
export declare function PipeSeparator(props: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,13 @@ import { SwapStepsCollapsedFooterButton } from "../layout/SwapStepsCollapsed";
|
|
|
3
3
|
type ChainData = {
|
|
4
4
|
networkName: string;
|
|
5
5
|
logoUrl: string;
|
|
6
|
-
bgColor: string;
|
|
7
6
|
};
|
|
8
7
|
type Token = {
|
|
9
8
|
symbol: string;
|
|
10
9
|
logoUrl: string;
|
|
11
10
|
bgColor: string;
|
|
12
11
|
};
|
|
13
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
12
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }: {
|
|
14
13
|
steps: SwapStep[];
|
|
15
14
|
handleClose?: (swapState: SwapState) => void;
|
|
16
15
|
handleComplete?: () => void;
|
|
@@ -28,5 +27,6 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, handleCom
|
|
|
28
27
|
swapState: SwapState;
|
|
29
28
|
estimatedTimeToComplete?: string;
|
|
30
29
|
footerButton?: SwapStepsCollapsedFooterButton;
|
|
30
|
+
refundTokenSymbol?: string;
|
|
31
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -13,11 +13,11 @@ export type DescriptionBlock = {
|
|
|
13
13
|
value: string;
|
|
14
14
|
rounded?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export interface SwapStep {
|
|
17
17
|
descriptionBlocks: DescriptionBlock[];
|
|
18
18
|
link?: string;
|
|
19
19
|
status: ActionStatus;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
export declare enum SwapState {
|
|
22
22
|
CONFIRM = 0,
|
|
23
23
|
PROGRESS = 1,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { SquidTheme } from "./config";
|
|
2
2
|
export * from "./utils";
|
|
3
|
-
export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, } from "./components";
|
|
3
|
+
export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, DescriptionBlock, } from "./components";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default$1, { useState, createContext, useContext, useMemo, useRef, useEffect, useLayoutEffect, useInsertionEffect, useCallback, forwardRef, Fragment as Fragment$1, createElement, useId as useId$1, Component, cloneElement, Children, isValidElement, useImperativeHandle } from 'react';
|
|
4
|
+
import { trimExtraDecimals, convertTokenAmountToUSD, formatUsdAmount, formatTokenAmount, convertUSDToTokenAmount } from '@0xsquid/react-hooks';
|
|
4
5
|
|
|
5
6
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
6
7
|
|
|
@@ -6575,59 +6576,6 @@ var debounce_1 = debounce;
|
|
|
6575
6576
|
|
|
6576
6577
|
var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounce_1);
|
|
6577
6578
|
|
|
6578
|
-
/**
|
|
6579
|
-
* Convert token amount to USD
|
|
6580
|
-
* @param {string|number} tokenAmount - The amount of tokens
|
|
6581
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
6582
|
-
* @returns {BigNumber} - The equivalent amount in USD
|
|
6583
|
-
*/
|
|
6584
|
-
function convertTokenAmountToUSD(tokenAmount, tokenPrice, maxDecimals = 2) {
|
|
6585
|
-
if (!tokenAmount || !tokenPrice)
|
|
6586
|
-
return "";
|
|
6587
|
-
const amount = new BigNumber(tokenAmount);
|
|
6588
|
-
const price = new BigNumber(tokenPrice);
|
|
6589
|
-
return amount.multipliedBy(price).decimalPlaces(maxDecimals).toString();
|
|
6590
|
-
}
|
|
6591
|
-
/**
|
|
6592
|
-
* Convert USD to token amount
|
|
6593
|
-
* @param {string|number} usdAmount - The amount in USD
|
|
6594
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
6595
|
-
* @param {number} maxDecimals - The maximum number of decimals
|
|
6596
|
-
* @returns {BigNumber} - The equivalent amount of tokens
|
|
6597
|
-
*/
|
|
6598
|
-
function convertUSDToTokenAmount(usdAmount, tokenPrice, maxDecimals) {
|
|
6599
|
-
if (!usdAmount || !tokenPrice || !maxDecimals)
|
|
6600
|
-
return "0";
|
|
6601
|
-
const amount = new BigNumber(usdAmount);
|
|
6602
|
-
const price = new BigNumber(tokenPrice);
|
|
6603
|
-
return amount.dividedBy(price).decimalPlaces(maxDecimals).toString();
|
|
6604
|
-
}
|
|
6605
|
-
const INTL_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
6606
|
-
minimumFractionDigits: 2,
|
|
6607
|
-
maximumFractionDigits: 5,
|
|
6608
|
-
});
|
|
6609
|
-
/**
|
|
6610
|
-
* Formats a number to the en-US number format
|
|
6611
|
-
*
|
|
6612
|
-
* @param amount - The number to format
|
|
6613
|
-
* @returns The formatted string
|
|
6614
|
-
*/
|
|
6615
|
-
function formatAmount(amount) {
|
|
6616
|
-
return INTL_NUMBER_FORMATTER.format(amount);
|
|
6617
|
-
}
|
|
6618
|
-
function trimExtraDecimals(value, maxDecimals) {
|
|
6619
|
-
var _a;
|
|
6620
|
-
const split = value.split(".");
|
|
6621
|
-
if (split.length > 1) {
|
|
6622
|
-
const decimals = (_a = split[1]) !== null && _a !== void 0 ? _a : "";
|
|
6623
|
-
if (maxDecimals && decimals.length > maxDecimals) {
|
|
6624
|
-
const newValue = `${split[0]}.${decimals.slice(0, maxDecimals)}`;
|
|
6625
|
-
return newValue;
|
|
6626
|
-
}
|
|
6627
|
-
}
|
|
6628
|
-
return value;
|
|
6629
|
-
}
|
|
6630
|
-
|
|
6631
6579
|
function SwapInputsIcon() {
|
|
6632
6580
|
return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { clipPath: "url(#clip0_40_7936)", children: jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_40_7936", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
6633
6581
|
}
|
|
@@ -17849,9 +17797,8 @@ function NavigationBar(_a) {
|
|
|
17849
17797
|
: "tw-flex"), children: jsx(HeadingText, { size: "small", children: title }) })) : null] })));
|
|
17850
17798
|
}
|
|
17851
17799
|
|
|
17852
|
-
function PipeSeparator(
|
|
17853
|
-
|
|
17854
|
-
return (jsx("div", Object.assign({}, props, { className: cn("tw-h-[0.8em] tw-w-[2px] tw-rounded-full tw-bg-[currentColor]", className) })));
|
|
17800
|
+
function PipeSeparator(props) {
|
|
17801
|
+
return (jsx("div", Object.assign({}, props, { className: cn("tw-h-[0.8em] tw-w-[2px] tw-rounded-full tw-bg-[currentColor]", props.className) })));
|
|
17855
17802
|
}
|
|
17856
17803
|
|
|
17857
17804
|
function CollapsibleMenu({ children, menuRef, isOpen, transitionDuration, size, className, }) {
|
|
@@ -18776,7 +18723,7 @@ function ListItem(_a) {
|
|
|
18776
18723
|
});
|
|
18777
18724
|
return (jsxs("li", Object.assign({}, containerProps, { ref: itemRef, className: cn("tw-relative tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300 tw-highlight-adjacent", listItemSizeMap[size], extraPadding && "tw-px-squid-xs", compactOnMobile
|
|
18778
18725
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
18779
|
-
: "tw-w-full", className), children: [jsxs(ItemTag, Object.assign({}, itemProps, { className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin"), children: [size === "large" ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon
|
|
18726
|
+
: "tw-w-full", className), children: [jsxs(ItemTag, Object.assign({}, itemProps, { className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin"), children: [size === "large" ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon || (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, placeholderImageUrl: placeholderImageUrl, size: "md", rounded: rounded })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon || (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn("tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs",
|
|
18780
18727
|
// 'large' variant has extra padding
|
|
18781
18728
|
size === "large" ? "tw-w-[56%] tw-pl-squid-xxs" : "tw-w-[67%]"), children: [typeof itemTitle === "string" ? (jsx(BodyText, { size: "small", className: cn("tw-max-w-full tw-truncate", subtitle && "tw-h-[17px] !tw-leading-[17px]", compactOnMobile ? "tw-hidden mobile-lg:tw-block" : "tw-block"), children: itemTitle })) : (itemTitle), size === "large" &&
|
|
18782
18729
|
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (loadingComponent()) : subtitle ? (jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsx(CaptionText, { className: cn(subtitleClassName, "tw-hidden group-hover/list-item:tw-block"), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxs(DetailTag, Object.assign({}, detailProps, { className: cn("tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs", size === "large" ? "tw-h-squid-xl" : "tw-h-squid-l", showDetailOnHoverOnly
|
|
@@ -18784,10 +18731,9 @@ function ListItem(_a) {
|
|
|
18784
18731
|
: "tw-flex", isDetailInteractive && "hover:tw-bg-material-light-thin", detailButtonClassName), children: [!!detail && (jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] })))] })), !!dropdownMenuContent && (jsx(ListItemActionsButton, { ref: openDropdownButtonRef, onClick: openDropdown, isActive: isDropdownOpen, className: "peer-hover/list-item:tw-opacity-100" })), isDropdownOpen && !!dropdownMenuContent ? (jsx(DropdownMenu, { menuRef: menuRef, isHidden: !dropdownStyles, className: cn(!!dropdownStyles &&
|
|
18785
18732
|
dropdownPositionClassMap$1[dropdownStyles.position]), dropdownRef: dropdownRef, children: dropdownMenuContent })) : null] })));
|
|
18786
18733
|
}
|
|
18787
|
-
const ListItemActionsButton = forwardRef((
|
|
18788
|
-
|
|
18789
|
-
|
|
18790
|
-
: "tw-opacity-0", props.className), children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })));
|
|
18734
|
+
const ListItemActionsButton = forwardRef((_a, ref) => {
|
|
18735
|
+
var { isActive, className } = _a, props = __rest$1(_a, ["isActive", "className"]);
|
|
18736
|
+
return (jsx("button", Object.assign({}, props, { ref: ref, className: cn("tw-peer tw-absolute tw-right-squid-s tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-p-2 tw-text-grey-300 hover:tw-bg-material-light-thin hover:tw-opacity-100 focus-visible:tw-opacity-100", isActive ? "tw-bg-material-light-thin tw-opacity-100" : "tw-opacity-0", className), children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })));
|
|
18791
18737
|
});
|
|
18792
18738
|
|
|
18793
18739
|
const dropdownPositionClassMap = {
|
|
@@ -19203,6 +19149,7 @@ const SwapStepsCollapsed = forwardRef((props, ref) => {
|
|
|
19203
19149
|
// show separator for all steps except the first one
|
|
19204
19150
|
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? "pending" : step.status }, index))) }), jsx("footer", { className: "tw-flex tw-max-h-[55px] tw-min-h-[55px] tw-w-full tw-justify-center tw-gap-squid-xs tw-self-stretch tw-px-squid-s tw-pb-squid-s", children: jsx(Button$1, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full", containerClassName: "tw-w-full" }) })] }) })] }) }) }));
|
|
19205
19151
|
});
|
|
19152
|
+
SwapStepsCollapsed.displayName = "SwapStepsCollapsed";
|
|
19206
19153
|
|
|
19207
19154
|
const WIDTH_SM = "69";
|
|
19208
19155
|
const HEIGHT_SM = "31";
|
|
@@ -25158,7 +25105,9 @@ function PopLayout(props) {
|
|
|
25158
25105
|
}
|
|
25159
25106
|
|
|
25160
25107
|
function Toast({ headerContent, actionsContent, description, chipLabel, title, }) {
|
|
25161
|
-
return (jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs",
|
|
25108
|
+
return (jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", contentWrapperProps: {
|
|
25109
|
+
className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs",
|
|
25110
|
+
}, rounded: "sm", children: [headerContent, jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
|
|
25162
25111
|
}
|
|
25163
25112
|
|
|
25164
25113
|
var lib = {};
|
|
@@ -26272,10 +26221,7 @@ const tooltipThresholdPaddingMap = {
|
|
|
26272
26221
|
xl: "40px",
|
|
26273
26222
|
xxl: "60px",
|
|
26274
26223
|
};
|
|
26275
|
-
const TooltipContainer = (
|
|
26276
|
-
var { className } = _a, props = __rest$1(_a, ["className"]);
|
|
26277
|
-
return (jsx("div", Object.assign({}, props, { className: cn("tw-relative", className) })));
|
|
26278
|
-
};
|
|
26224
|
+
const TooltipContainer = (props) => (jsx("div", Object.assign({}, props, { className: cn("tw-relative", props.className) })));
|
|
26279
26225
|
const TooltipTriggerWrapper = (_a) => {
|
|
26280
26226
|
var { elementRef } = _a, props = __rest$1(_a, ["elementRef"]);
|
|
26281
26227
|
return jsx("div", Object.assign({}, props, { ref: elementRef }));
|
|
@@ -26482,7 +26428,7 @@ function NumericInput(_a) {
|
|
|
26482
26428
|
onAmountChange,
|
|
26483
26429
|
]);
|
|
26484
26430
|
const handleInputChange = (e) => {
|
|
26485
|
-
|
|
26431
|
+
const value = e.target.value.replace(/,/g, "."); // Replace commas with dots
|
|
26486
26432
|
const maxDecimalsForInputType = userInputType === UserInputType.TOKEN ? token.decimals : maxUsdDecimals;
|
|
26487
26433
|
const isValidAmount = new RegExp(`^\\d*\\.?\\d{0,${maxDecimalsForInputType}}$`).test(value);
|
|
26488
26434
|
if (isValidAmount) {
|
|
@@ -26562,14 +26508,18 @@ function NumericInput(_a) {
|
|
|
26562
26508
|
return "0";
|
|
26563
26509
|
if (userInputType === UserInputType.TOKEN) {
|
|
26564
26510
|
if (direction === "from") {
|
|
26565
|
-
return
|
|
26511
|
+
return formatUsdAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals), {
|
|
26512
|
+
includeSign: false,
|
|
26513
|
+
});
|
|
26566
26514
|
}
|
|
26567
26515
|
else {
|
|
26568
|
-
return
|
|
26516
|
+
return formatUsdAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : "0", {
|
|
26517
|
+
includeSign: false,
|
|
26518
|
+
});
|
|
26569
26519
|
}
|
|
26570
26520
|
}
|
|
26571
26521
|
else {
|
|
26572
|
-
return
|
|
26522
|
+
return formatTokenAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
26573
26523
|
}
|
|
26574
26524
|
}, [
|
|
26575
26525
|
inputValue,
|
|
@@ -26586,7 +26536,7 @@ function NumericInput(_a) {
|
|
|
26586
26536
|
: "tw-text-grey-300";
|
|
26587
26537
|
const BalanceChipTag = balanceChipClickable ? "button" : "div";
|
|
26588
26538
|
const balanceFormatted = useMemo(() => {
|
|
26589
|
-
return
|
|
26539
|
+
return formatTokenAmount(balance !== null && balance !== void 0 ? balance : "0");
|
|
26590
26540
|
}, [balance]);
|
|
26591
26541
|
const containerClassname = "tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-px-squid-m tw-relative tw-h-[65px] mobile-sm-height:tw-h-[75px]";
|
|
26592
26542
|
const inputRef = useRef(null);
|
|
@@ -61988,7 +61938,7 @@ const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
|
61988
61938
|
return "Needs gas on destination";
|
|
61989
61939
|
}
|
|
61990
61940
|
};
|
|
61991
|
-
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, }) => {
|
|
61941
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, refundTokenSymbol, }) => {
|
|
61992
61942
|
switch (swapState) {
|
|
61993
61943
|
case SwapState.CONFIRM: {
|
|
61994
61944
|
return "Authenticate the transaction in your wallet.";
|
|
@@ -62009,7 +61959,7 @@ const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, to
|
|
|
62009
61959
|
return "You declined the transaction in your wallet.";
|
|
62010
61960
|
}
|
|
62011
61961
|
case SwapState.PARTIAL_SUCCESS: {
|
|
62012
|
-
return `You received a refund of
|
|
61962
|
+
return `You received a refund of ${refundTokenSymbol} to your wallet ${toAddressFormatted} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}.`;
|
|
62013
61963
|
}
|
|
62014
61964
|
case SwapState.NEEDS_GAS: {
|
|
62015
61965
|
return "Add gas to the transaction via Axelarscan to complete the swap";
|
|
@@ -62026,7 +61976,7 @@ const swapProgressButtonTexts = {
|
|
|
62026
61976
|
[SwapState.PARTIAL_SUCCESS]: "Cancel",
|
|
62027
61977
|
[SwapState.NEEDS_GAS]: "Go to Axelarscan",
|
|
62028
61978
|
};
|
|
62029
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }) {
|
|
61979
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }) {
|
|
62030
61980
|
const [showSwapInfoSection, setShowSwapInfoSection] = useState(true);
|
|
62031
61981
|
const isFirstRenderRef = useRef(true);
|
|
62032
61982
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -62056,6 +62006,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
62056
62006
|
toChain,
|
|
62057
62007
|
toToken,
|
|
62058
62008
|
toAddressFormatted,
|
|
62009
|
+
refundTokenSymbol,
|
|
62059
62010
|
});
|
|
62060
62011
|
return {
|
|
62061
62012
|
headerTitle,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
export declare function PipeSeparator(
|
|
2
|
+
export declare function PipeSeparator(props: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,13 @@ import { SwapStepsCollapsedFooterButton } from "../layout/SwapStepsCollapsed";
|
|
|
3
3
|
type ChainData = {
|
|
4
4
|
networkName: string;
|
|
5
5
|
logoUrl: string;
|
|
6
|
-
bgColor: string;
|
|
7
6
|
};
|
|
8
7
|
type Token = {
|
|
9
8
|
symbol: string;
|
|
10
9
|
logoUrl: string;
|
|
11
10
|
bgColor: string;
|
|
12
11
|
};
|
|
13
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
12
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }: {
|
|
14
13
|
steps: SwapStep[];
|
|
15
14
|
handleClose?: (swapState: SwapState) => void;
|
|
16
15
|
handleComplete?: () => void;
|
|
@@ -28,5 +27,6 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, handleCom
|
|
|
28
27
|
swapState: SwapState;
|
|
29
28
|
estimatedTimeToComplete?: string;
|
|
30
29
|
footerButton?: SwapStepsCollapsedFooterButton;
|
|
30
|
+
refundTokenSymbol?: string;
|
|
31
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -13,11 +13,11 @@ export type DescriptionBlock = {
|
|
|
13
13
|
value: string;
|
|
14
14
|
rounded?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export interface SwapStep {
|
|
17
17
|
descriptionBlocks: DescriptionBlock[];
|
|
18
18
|
link?: string;
|
|
19
19
|
status: ActionStatus;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
export declare enum SwapState {
|
|
22
22
|
CONFIRM = 0,
|
|
23
23
|
PROGRESS = 1,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { SquidTheme } from "./config";
|
|
2
2
|
export * from "./utils";
|
|
3
|
-
export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, } from "./components";
|
|
3
|
+
export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, DescriptionBlock, } from "./components";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="trusted-types" />
|
|
2
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as react from 'react';
|
|
4
5
|
import react__default, { ReactNode, ComponentProps } from 'react';
|
|
@@ -37,11 +38,11 @@ type DescriptionBlock = {
|
|
|
37
38
|
value: string;
|
|
38
39
|
rounded?: boolean;
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
+
interface SwapStep {
|
|
41
42
|
descriptionBlocks: DescriptionBlock[];
|
|
42
43
|
link?: string;
|
|
43
44
|
status: ActionStatus;
|
|
44
|
-
}
|
|
45
|
+
}
|
|
45
46
|
declare enum SwapState {
|
|
46
47
|
CONFIRM = 0,
|
|
47
48
|
PROGRESS = 1,
|
|
@@ -1456,7 +1457,7 @@ interface NavigationBarProps extends React.ComponentProps<"nav"> {
|
|
|
1456
1457
|
}
|
|
1457
1458
|
declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, isLoading, ...props }: NavigationBarProps): react_jsx_runtime.JSX.Element;
|
|
1458
1459
|
|
|
1459
|
-
declare function PipeSeparator(
|
|
1460
|
+
declare function PipeSeparator(props: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
1460
1461
|
|
|
1461
1462
|
interface CollapsibleMenuProps {
|
|
1462
1463
|
menuRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
@@ -2382,14 +2383,13 @@ declare function SwapDetailsView({ isLoading, canToggleBoostMode, }: {
|
|
|
2382
2383
|
type ChainData = {
|
|
2383
2384
|
networkName: string;
|
|
2384
2385
|
logoUrl: string;
|
|
2385
|
-
bgColor: string;
|
|
2386
2386
|
};
|
|
2387
2387
|
type Token = {
|
|
2388
2388
|
symbol: string;
|
|
2389
2389
|
logoUrl: string;
|
|
2390
2390
|
bgColor: string;
|
|
2391
2391
|
};
|
|
2392
|
-
declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
2392
|
+
declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }: {
|
|
2393
2393
|
steps: SwapStep[];
|
|
2394
2394
|
handleClose?: (swapState: SwapState) => void;
|
|
2395
2395
|
handleComplete?: () => void;
|
|
@@ -2407,6 +2407,7 @@ declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete,
|
|
|
2407
2407
|
swapState: SwapState;
|
|
2408
2408
|
estimatedTimeToComplete?: string;
|
|
2409
2409
|
footerButton?: SwapStepsCollapsedFooterButton;
|
|
2410
|
+
refundTokenSymbol?: string;
|
|
2410
2411
|
}): react_jsx_runtime.JSX.Element;
|
|
2411
2412
|
|
|
2412
2413
|
interface BaseTransactionViewProps {
|
|
@@ -2654,4 +2655,4 @@ declare const baseTailwindConfig: Config;
|
|
|
2654
2655
|
*/
|
|
2655
2656
|
declare const cn: (...inputs: ClassValue[]) => string;
|
|
2656
2657
|
|
|
2657
|
-
export { type ActionButton, ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, type ActionStatus, ActionStatusRow, ActionWrapper, AddressButton, type AllOrNone, AnimationWrapper, AppContainer, Approve, ApproveAction, ArrowBottomTopIcon, ArrowButton, ArrowCornerDownRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowOutOfBoxIcon, ArrowRightDownCircleIcon, ArrowRightDownIcon, ArrowRightIcon, ArrowRightUpCircleIcon, ArrowRightUpIcon, ArrowRotate, ArrowSplit, ArrowTriangle, ArrowUpIcon, ArrowWallDownIcon, ArrowsSwapIcon, AssetsButton, type AssetsButtonVariant, AssetsView, BackpackIcon, BadgeImage, BankIcon, type BaseActionProps, type BaseTransactionViewProps, BellAlarmIcon, BlockSkeleton, BodyText, Boost, BoostBadge, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, BrokenHeartIcon, BubblesIcon, Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CSS_VARS, Calendar, CaptionText, CatSquareIcon, ChainLink, Checkmark1Icon, Checkmark2Icon, ChevronArrowIcon, ChevronDownSmallIcon, ChevronGrabberVerticalIcon, ChevronLargeDownIcon, ChevronLargeRightIcon, ChevronRightSmallIcon, ChevronTopIcon, ChevronTopSmallIcon, Chip, type ChipProps, CircleMinusIcon, CirclePlusIcon, CircleX, CircleXFilledIcon, ClockOutlineIcon, ClockSolidIcon, CoinsAddIcon, CoinsIcon, Collapse, CollapsibleMenu, CollectionIcon, ColorPaletteIcon, CompassRoundOutlinedIcon, CompassRoundSolidIcon, ConsoleIcon, Copy, CrossAnimatedIcon, DashboardFast, DescriptionBlocks, DetailsToolbar, DiscordIcon, DockIconAnalytics, DockIconCheckout, DockIconHelp, DockIconProfile, DockIconScan, DockIconSwap, DockSwapIcon, DollarOutlinedIcon, DollarSolidIcon, DotGrid1x3HorizontalIcon, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuTitle, type DropdownPosition, type DropdownStyles, EmojiMeh, EmojiSadIcon, EmptyHeartIcon, ErrorMessage, EthereumIcon, ExplosionIcon, EyeOpenIcon, FeeButton, FeesAction, type FeesActionProps, FeesLines, FeesTotal, FilledHeartIcon, FilterAscendingIcon, FilterButton, FilterIcon, FilterTimelineIcon, GasIcon, GhostIcon, GithubIcon, HashLink, HeadingText, HeartSmallIcon, HelpIcon, HistoryItem, type HistoryItemStatus, HomeIcon, IconButton, IconLabel, Image, ImageIcon, ImageSparkle, IncompleteAction, InfinityIcon, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, LightningIcon, LimitIcon, LinkIcon, List, ListItem, ListItemActionsButton, Loader, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, MaxIcon, Menu, MenuItem, MenuSwapIcon, MirrorIcon, Modal, ModalContent, ModalContentDivider, MoonIcon, NavigationBar, NotAllowedIcon, NumericInput, PathSquareIcon, PercentIcon, PieChartIcon, PipeSeparator, PlusIcon, PoopIcon, PowerIcon, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, type PropertyListItemProps, PunkIcon, RangeInput, ReceiptBillIcon, ReceiveNFTAction, ReceiveTokensAction, RecipientView, RefreshIcon, ReorderIcon, RouteStep, STEP_ITEM_HEIGHT, SearchIcon, SectionTitle, SendTokensAction, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsGearIcon, SettingsItem, type SettingsItemProps, SettingsSlider, SettingsSliderIcon, type SettingsSliderProps, ShoppingBagIcon, SizeTransition, SmileIcon, SnapIcon, SortIcon, SparkleIcon, SparklesIcon, SquareArrowCenter, SquareArrowTopLeftIcon, SquareArrowTopRight2Icon, SquidConfigProvider, SquidLogo, type SquidTheme, StakeAction, StartAction, StocksIcon, SuccessAction, SunIcon, SunriseIcon, SwapAction, SwapConfiguration, SwapDetailsView, SwapErrorIcon, SwapHeader, type SwapHeaderProps, SwapIcon, SwapInputsIcon, SwapProgressView, SwapProgressViewHeader, SwapProperties, type SwapPropertiesProps, SwapState, type SwapStep, SwapStepItem, SwapStepSeparator, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, SwapSuccessIcon, SwapTransactionView, SwapWarningIcon, Switch, type SwitchProps, TagIcon, TagIconFilled, TextSkeleton, type ThemeType, ThumbsUp, Tick, TimeFliesIcon, Timeline, Timestamp, Toast, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, TradingViewStepsIcon, TransactionAction, type TransactionActionProps, type TransactionActionType, TransactionFilters, TransactionHeader, TransactionHeaderLayout, type TransactionHeaderProps, type TransactionHeaderType, TransactionItem, TransactionProperties, type TransactionPropertiesProps, type TransactionPropertiesType, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, type TransactionViewProps, type TransactionViewType, Transfer, TranslateIcon, TriangleExclamation, UsdAmount, WalletFilledIcon, WalletIcon, WalletLink, WalletsView, WrapAction, XSocial, baseTailwindConfig, cn, darkTheme, lightTheme, linkActionTimelineProps, statusTextClassMap, useCollapsibleMenu, useDropdownMenu, useMediaQuery, useOnResize, useRect, useTimer, useVersion };
|
|
2658
|
+
export { type ActionButton, ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, type ActionStatus, ActionStatusRow, ActionWrapper, AddressButton, type AllOrNone, AnimationWrapper, AppContainer, Approve, ApproveAction, ArrowBottomTopIcon, ArrowButton, ArrowCornerDownRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowOutOfBoxIcon, ArrowRightDownCircleIcon, ArrowRightDownIcon, ArrowRightIcon, ArrowRightUpCircleIcon, ArrowRightUpIcon, ArrowRotate, ArrowSplit, ArrowTriangle, ArrowUpIcon, ArrowWallDownIcon, ArrowsSwapIcon, AssetsButton, type AssetsButtonVariant, AssetsView, BackpackIcon, BadgeImage, BankIcon, type BaseActionProps, type BaseTransactionViewProps, BellAlarmIcon, BlockSkeleton, BodyText, Boost, BoostBadge, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, BrokenHeartIcon, BubblesIcon, Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CSS_VARS, Calendar, CaptionText, CatSquareIcon, ChainLink, Checkmark1Icon, Checkmark2Icon, ChevronArrowIcon, ChevronDownSmallIcon, ChevronGrabberVerticalIcon, ChevronLargeDownIcon, ChevronLargeRightIcon, ChevronRightSmallIcon, ChevronTopIcon, ChevronTopSmallIcon, Chip, type ChipProps, CircleMinusIcon, CirclePlusIcon, CircleX, CircleXFilledIcon, ClockOutlineIcon, ClockSolidIcon, CoinsAddIcon, CoinsIcon, Collapse, CollapsibleMenu, CollectionIcon, ColorPaletteIcon, CompassRoundOutlinedIcon, CompassRoundSolidIcon, ConsoleIcon, Copy, CrossAnimatedIcon, DashboardFast, type DescriptionBlock, DescriptionBlocks, DetailsToolbar, DiscordIcon, DockIconAnalytics, DockIconCheckout, DockIconHelp, DockIconProfile, DockIconScan, DockIconSwap, DockSwapIcon, DollarOutlinedIcon, DollarSolidIcon, DotGrid1x3HorizontalIcon, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuTitle, type DropdownPosition, type DropdownStyles, EmojiMeh, EmojiSadIcon, EmptyHeartIcon, ErrorMessage, EthereumIcon, ExplosionIcon, EyeOpenIcon, FeeButton, FeesAction, type FeesActionProps, FeesLines, FeesTotal, FilledHeartIcon, FilterAscendingIcon, FilterButton, FilterIcon, FilterTimelineIcon, GasIcon, GhostIcon, GithubIcon, HashLink, HeadingText, HeartSmallIcon, HelpIcon, HistoryItem, type HistoryItemStatus, HomeIcon, IconButton, IconLabel, Image, ImageIcon, ImageSparkle, IncompleteAction, InfinityIcon, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, LightningIcon, LimitIcon, LinkIcon, List, ListItem, ListItemActionsButton, Loader, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, MaxIcon, Menu, MenuItem, MenuSwapIcon, MirrorIcon, Modal, ModalContent, ModalContentDivider, MoonIcon, NavigationBar, NotAllowedIcon, NumericInput, PathSquareIcon, PercentIcon, PieChartIcon, PipeSeparator, PlusIcon, PoopIcon, PowerIcon, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, type PropertyListItemProps, PunkIcon, RangeInput, ReceiptBillIcon, ReceiveNFTAction, ReceiveTokensAction, RecipientView, RefreshIcon, ReorderIcon, RouteStep, STEP_ITEM_HEIGHT, SearchIcon, SectionTitle, SendTokensAction, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsGearIcon, SettingsItem, type SettingsItemProps, SettingsSlider, SettingsSliderIcon, type SettingsSliderProps, ShoppingBagIcon, SizeTransition, SmileIcon, SnapIcon, SortIcon, SparkleIcon, SparklesIcon, SquareArrowCenter, SquareArrowTopLeftIcon, SquareArrowTopRight2Icon, SquidConfigProvider, SquidLogo, type SquidTheme, StakeAction, StartAction, StocksIcon, SuccessAction, SunIcon, SunriseIcon, SwapAction, SwapConfiguration, SwapDetailsView, SwapErrorIcon, SwapHeader, type SwapHeaderProps, SwapIcon, SwapInputsIcon, SwapProgressView, SwapProgressViewHeader, SwapProperties, type SwapPropertiesProps, SwapState, type SwapStep, SwapStepItem, SwapStepSeparator, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, SwapSuccessIcon, SwapTransactionView, SwapWarningIcon, Switch, type SwitchProps, TagIcon, TagIconFilled, TextSkeleton, type ThemeType, ThumbsUp, Tick, TimeFliesIcon, Timeline, Timestamp, Toast, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, TradingViewStepsIcon, TransactionAction, type TransactionActionProps, type TransactionActionType, TransactionFilters, TransactionHeader, TransactionHeaderLayout, type TransactionHeaderProps, type TransactionHeaderType, TransactionItem, TransactionProperties, type TransactionPropertiesProps, type TransactionPropertiesType, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, type TransactionViewProps, type TransactionViewType, Transfer, TranslateIcon, TriangleExclamation, UsdAmount, WalletFilledIcon, WalletIcon, WalletLink, WalletsView, WrapAction, XSocial, baseTailwindConfig, cn, darkTheme, lightTheme, linkActionTimelineProps, statusTextClassMap, useCollapsibleMenu, useDropdownMenu, useMediaQuery, useOnResize, useRect, useTimer, useVersion };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/0xsquid/squid-ui.git"
|
|
6
6
|
},
|
|
7
7
|
"description": "Squid's UI components",
|
|
8
|
-
"version": "0.27.
|
|
8
|
+
"version": "0.27.3-alpha.0",
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"resolutions": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"test": "vitest"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@0xsquid/react-hooks": "3.0.4",
|
|
32
33
|
"@lottiefiles/react-lottie-player": "3.5.0",
|
|
33
34
|
"bignumber.js": "9.1.2",
|
|
34
35
|
"clsx": "2.1.1",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
},
|
|
52
53
|
"homepage": "https://github.com/0xsquid/squid-ui#readme",
|
|
53
54
|
"devDependencies": {
|
|
55
|
+
"@0xsquid/squid-types": "0.1.104",
|
|
54
56
|
"@chromatic-com/storybook": "^1.2.22",
|
|
55
57
|
"@release-it/conventional-changelog": "github:release-it/conventional-changelog",
|
|
56
58
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -118,6 +120,7 @@
|
|
|
118
120
|
},
|
|
119
121
|
"peerDependencies": {
|
|
120
122
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
121
|
-
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
123
|
+
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
124
|
+
"@0xsquid/react-hooks": "^3.0.4"
|
|
122
125
|
}
|
|
123
126
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert token amount to USD
|
|
3
|
-
* @param {string|number} tokenAmount - The amount of tokens
|
|
4
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
5
|
-
* @returns {BigNumber} - The equivalent amount in USD
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertTokenAmountToUSD(tokenAmount: string | number, tokenPrice: string | number, maxDecimals?: number): string;
|
|
8
|
-
/**
|
|
9
|
-
* Convert USD to token amount
|
|
10
|
-
* @param {string|number} usdAmount - The amount in USD
|
|
11
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
12
|
-
* @param {number} maxDecimals - The maximum number of decimals
|
|
13
|
-
* @returns {BigNumber} - The equivalent amount of tokens
|
|
14
|
-
*/
|
|
15
|
-
export declare function convertUSDToTokenAmount(usdAmount: string | number, tokenPrice: string | number, maxDecimals: number): string;
|
|
16
|
-
/**
|
|
17
|
-
* Formats a number to the en-US number format
|
|
18
|
-
*
|
|
19
|
-
* @param amount - The number to format
|
|
20
|
-
* @returns The formatted string
|
|
21
|
-
*/
|
|
22
|
-
export declare function formatAmount(amount: number | bigint | string): string;
|
|
23
|
-
export declare function trimExtraDecimals(value: string, maxDecimals?: number): string;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert token amount to USD
|
|
3
|
-
* @param {string|number} tokenAmount - The amount of tokens
|
|
4
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
5
|
-
* @returns {BigNumber} - The equivalent amount in USD
|
|
6
|
-
*/
|
|
7
|
-
export declare function convertTokenAmountToUSD(tokenAmount: string | number, tokenPrice: string | number, maxDecimals?: number): string;
|
|
8
|
-
/**
|
|
9
|
-
* Convert USD to token amount
|
|
10
|
-
* @param {string|number} usdAmount - The amount in USD
|
|
11
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
12
|
-
* @param {number} maxDecimals - The maximum number of decimals
|
|
13
|
-
* @returns {BigNumber} - The equivalent amount of tokens
|
|
14
|
-
*/
|
|
15
|
-
export declare function convertUSDToTokenAmount(usdAmount: string | number, tokenPrice: string | number, maxDecimals: number): string;
|
|
16
|
-
/**
|
|
17
|
-
* Formats a number to the en-US number format
|
|
18
|
-
*
|
|
19
|
-
* @param amount - The number to format
|
|
20
|
-
* @returns The formatted string
|
|
21
|
-
*/
|
|
22
|
-
export declare function formatAmount(amount: number | bigint | string): string;
|
|
23
|
-
export declare function trimExtraDecimals(value: string, maxDecimals?: number): string;
|