@0xsquid/ui 0.18.3 → 0.18.5
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 +13 -15
- package/dist/cjs/types/components/controls/NumericInput.d.ts +2 -1
- package/dist/cjs/types/components/icons/Arrow.d.ts +3 -1
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +3 -1
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +1 -1
- package/dist/cjs/types/stories/layout/SwapConfiguration.stories.d.ts +1 -0
- package/dist/esm/index.js +13 -15
- package/dist/esm/types/components/controls/NumericInput.d.ts +2 -1
- package/dist/esm/types/components/icons/Arrow.d.ts +3 -1
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +3 -1
- package/dist/esm/types/components/views/SwapProgressView.d.ts +1 -1
- package/dist/esm/types/stories/layout/SwapConfiguration.stories.d.ts +1 -0
- package/dist/index.d.ts +6 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2907,8 +2907,8 @@ function ArrowRightUpIcon() {
|
|
|
2907
2907
|
function ChevronArrowIcon({ size = '16', className, }) {
|
|
2908
2908
|
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M6.66663 14L9.64022 8.64754C9.86394 8.24484 9.86394 7.75519 9.64022 7.35249L6.66663 2", stroke: "currentColor", strokeOpacity: "0.66", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2909
2909
|
}
|
|
2910
|
-
function ArrowTriangle() {
|
|
2911
|
-
return (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2910
|
+
function ArrowTriangle({ className }) {
|
|
2911
|
+
return (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2912
2912
|
}
|
|
2913
2913
|
function ChevronLargeDownIcon({ size = '24', className, }) {
|
|
2914
2914
|
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
@@ -6703,10 +6703,6 @@ function trimExtraDecimals(value, maxDecimals) {
|
|
|
6703
6703
|
return value;
|
|
6704
6704
|
}
|
|
6705
6705
|
|
|
6706
|
-
function MaxIcon() {
|
|
6707
|
-
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_41_20801)", 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.5ZM10.6508 4.74074L14.1508 7.74074C14.5701 8.10017 14.6187 8.73147 14.2593 9.15079C13.8998 9.57012 13.2685 9.61868 12.8492 9.25926L10 6.81708L7.15079 9.25926C6.73147 9.61868 6.10017 9.57012 5.74074 9.15079C5.38132 8.73147 5.42988 8.10017 5.84921 7.74074L9.34921 4.74074C9.7237 4.41975 10.2763 4.41975 10.6508 4.74074ZM14.1508 13.7407L10.6508 10.7407C10.2763 10.4198 9.7237 10.4198 9.34921 10.7407L5.84921 13.7407C5.42988 14.1002 5.38132 14.7315 5.74074 15.1508C6.10017 15.5701 6.73147 15.6187 7.15079 15.2593L10 12.8171L12.8492 15.2593C13.2685 15.6187 13.8998 15.5701 14.2593 15.1508C14.6187 14.7315 14.5701 14.1002 14.1508 13.7407Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_41_20801", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
6708
|
-
}
|
|
6709
|
-
|
|
6710
6706
|
function SwapInputsIcon() {
|
|
6711
6707
|
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)" }) }) })] }));
|
|
6712
6708
|
}
|
|
@@ -18123,7 +18119,7 @@ function LogoContainer({ children }) {
|
|
|
18123
18119
|
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
|
|
18124
18120
|
}
|
|
18125
18121
|
|
|
18126
|
-
function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, }) {
|
|
18122
|
+
function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = true, }) {
|
|
18127
18123
|
var _a, _b;
|
|
18128
18124
|
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxRuntime.jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { size: "small", children: ":" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsxRuntime.jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { onClick: onAssetsButtonClick, chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor, variant: assetsButtonVariant }) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
|
|
18129
18125
|
decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
|
|
@@ -18134,7 +18130,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain,
|
|
|
18134
18130
|
}, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
|
|
18135
18131
|
token: '0.001',
|
|
18136
18132
|
usd: '0.01',
|
|
18137
|
-
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!
|
|
18133
|
+
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive })] }));
|
|
18138
18134
|
}
|
|
18139
18135
|
|
|
18140
18136
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -24254,10 +24250,11 @@ var InputMode;
|
|
|
24254
24250
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24255
24251
|
token: '0.001',
|
|
24256
24252
|
usd: '0.01',
|
|
24257
|
-
}, showDetails = true, isLoading = false, direction, amountUsd, }) {
|
|
24253
|
+
}, showDetails = true, isLoading = false, direction, amountUsd, isInteractive = false, }) {
|
|
24258
24254
|
var _a;
|
|
24259
24255
|
const [inputValue, setInputValue] = React.useState('');
|
|
24260
24256
|
const [inputMode, setInputMode] = React.useState(InputMode.TOKEN);
|
|
24257
|
+
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
24261
24258
|
React.useEffect(() => {
|
|
24262
24259
|
if (forcedAmount !== undefined) {
|
|
24263
24260
|
updateInputValue(forcedAmount);
|
|
@@ -24271,7 +24268,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24271
24268
|
setInputValue(formattedAmount);
|
|
24272
24269
|
}, [inputMode, token.price, direction, token.decimals]);
|
|
24273
24270
|
const onBalanceButtonClick = React.useCallback(() => {
|
|
24274
|
-
if (
|
|
24271
|
+
if (balanceChipClickable) {
|
|
24275
24272
|
updateInputValue(balance);
|
|
24276
24273
|
onAmountChange(balance);
|
|
24277
24274
|
}
|
|
@@ -24365,12 +24362,11 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24365
24362
|
return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
24366
24363
|
}
|
|
24367
24364
|
}, [inputValue, inputMode, token.price, direction, amountUsd]);
|
|
24368
|
-
const isInteractive = direction === 'from';
|
|
24369
24365
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
24370
24366
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
24371
24367
|
? 'tw-text-status-negative'
|
|
24372
24368
|
: 'tw-text-grey-300';
|
|
24373
|
-
const BalanceChipTag =
|
|
24369
|
+
const BalanceChipTag = balanceChipClickable ? 'button' : 'div';
|
|
24374
24370
|
const balanceFormatted = React.useMemo(() => {
|
|
24375
24371
|
return formatAmount(balance !== null && balance !== void 0 ? balance : '0');
|
|
24376
24372
|
}, [balance]);
|
|
@@ -24380,7 +24376,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24380
24376
|
? formatIfVerySmall.token
|
|
24381
24377
|
: amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24382
24378
|
? formatIfVerySmall.token
|
|
24383
|
-
: amountFormatted }), ' ', jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, {}), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName,
|
|
24379
|
+
: amountFormatted }), ' ', jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0 ? 'tw-opacity-0' : '' }), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable && interactiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balanceFormatted }), jsxRuntime.jsx(Chip, { label: "Max" })] })] }))] }));
|
|
24384
24380
|
}
|
|
24385
24381
|
|
|
24386
24382
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
@@ -59835,7 +59831,9 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
59835
59831
|
const handleCollapseRouteSteps = () => { var _a; return (_a = trackTransactionViewRef.current) === null || _a === void 0 ? void 0 : _a.handleToggleRouteSteps(); };
|
|
59836
59832
|
return (jsxRuntime.jsxs(Modal, { isOpen: isOpen, onBackdropClick:
|
|
59837
59833
|
// close route steps modal when open and backdrop is clicked
|
|
59838
|
-
!showSwapInfoSection
|
|
59834
|
+
!showSwapInfoSection
|
|
59835
|
+
? handleCollapseRouteSteps
|
|
59836
|
+
: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), children: [jsxRuntime.jsxs(ModalContent, { style: {
|
|
59839
59837
|
[CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
59840
59838
|
[CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
59841
59839
|
}, borderType: "outline", className: cn('!tw-max-h-[470px]',
|
|
@@ -59853,7 +59851,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
59853
59851
|
}, secondToken: {
|
|
59854
59852
|
bgColor: toToken.bgColor,
|
|
59855
59853
|
logoURI: toToken.logoUrl,
|
|
59856
|
-
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsxRuntime.jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: "Cancel", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Button$1, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
59854
|
+
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsxRuntime.jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: "Cancel", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Button$1, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }), jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }))] }));
|
|
59857
59855
|
}
|
|
59858
59856
|
const TrackTransactionView = React.forwardRef((props, ref) => {
|
|
59859
59857
|
const { swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, footerButton, } = props;
|
|
@@ -23,6 +23,7 @@ interface NumericInputProps {
|
|
|
23
23
|
direction?: SwapDirection;
|
|
24
24
|
amountUsd?: string;
|
|
25
25
|
maxUsdDecimals?: number;
|
|
26
|
+
isInteractive?: boolean;
|
|
26
27
|
}
|
|
27
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -5,7 +5,9 @@ export declare function ChevronArrowIcon({ size, className, }: {
|
|
|
5
5
|
size?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function ArrowTriangle(
|
|
8
|
+
export declare function ArrowTriangle({ className }: {
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export declare function ChevronTopSmallIcon(): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export declare function ChevronLargeDownIcon({ size, className, }: {
|
|
11
13
|
size?: string;
|
|
@@ -30,6 +30,8 @@ interface SwapConfigurationProps {
|
|
|
30
30
|
emptyAddressLabel?: string;
|
|
31
31
|
assetsButtonVariant?: AssetsButtonVariant;
|
|
32
32
|
maxUsdDecimals?: number;
|
|
33
|
+
isInputInteractive?: boolean;
|
|
34
|
+
isLoading?: boolean;
|
|
33
35
|
}
|
|
34
|
-
export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
35
37
|
export {};
|
|
@@ -12,7 +12,7 @@ type Token = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
14
14
|
steps: SwapStep[];
|
|
15
|
-
handleClose?: () => void;
|
|
15
|
+
handleClose?: (swapState: SwapState) => void;
|
|
16
16
|
handleComplete?: () => void;
|
|
17
17
|
isOpen?: boolean;
|
|
18
18
|
socialLink?: string;
|
|
@@ -12,6 +12,7 @@ export declare const Address: Story;
|
|
|
12
12
|
export declare const WithBalance: Story;
|
|
13
13
|
export declare const LowPriceImpact: Story;
|
|
14
14
|
export declare const HighPriceImpact: Story;
|
|
15
|
+
export declare const ZeroPriceImpact: Story;
|
|
15
16
|
export declare const IsFetching: Story;
|
|
16
17
|
export declare const AllProps: Story;
|
|
17
18
|
export declare const ToDirection: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -2887,8 +2887,8 @@ function ArrowRightUpIcon() {
|
|
|
2887
2887
|
function ChevronArrowIcon({ size = '16', className, }) {
|
|
2888
2888
|
return (jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsx("path", { d: "M6.66663 14L9.64022 8.64754C9.86394 8.24484 9.86394 7.75519 9.64022 7.35249L6.66663 2", stroke: "currentColor", strokeOpacity: "0.66", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2889
2889
|
}
|
|
2890
|
-
function ArrowTriangle() {
|
|
2891
|
-
return (jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2890
|
+
function ArrowTriangle({ className }) {
|
|
2891
|
+
return (jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2892
2892
|
}
|
|
2893
2893
|
function ChevronLargeDownIcon({ size = '24', className, }) {
|
|
2894
2894
|
return (jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
@@ -6683,10 +6683,6 @@ function trimExtraDecimals(value, maxDecimals) {
|
|
|
6683
6683
|
return value;
|
|
6684
6684
|
}
|
|
6685
6685
|
|
|
6686
|
-
function MaxIcon() {
|
|
6687
|
-
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_41_20801)", 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.5ZM10.6508 4.74074L14.1508 7.74074C14.5701 8.10017 14.6187 8.73147 14.2593 9.15079C13.8998 9.57012 13.2685 9.61868 12.8492 9.25926L10 6.81708L7.15079 9.25926C6.73147 9.61868 6.10017 9.57012 5.74074 9.15079C5.38132 8.73147 5.42988 8.10017 5.84921 7.74074L9.34921 4.74074C9.7237 4.41975 10.2763 4.41975 10.6508 4.74074ZM14.1508 13.7407L10.6508 10.7407C10.2763 10.4198 9.7237 10.4198 9.34921 10.7407L5.84921 13.7407C5.42988 14.1002 5.38132 14.7315 5.74074 15.1508C6.10017 15.5701 6.73147 15.6187 7.15079 15.2593L10 12.8171L12.8492 15.2593C13.2685 15.6187 13.8998 15.5701 14.2593 15.1508C14.6187 14.7315 14.5701 14.1002 14.1508 13.7407Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_41_20801", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
6688
|
-
}
|
|
6689
|
-
|
|
6690
6686
|
function SwapInputsIcon() {
|
|
6691
6687
|
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)" }) }) })] }));
|
|
6692
6688
|
}
|
|
@@ -18103,7 +18099,7 @@ function LogoContainer({ children }) {
|
|
|
18103
18099
|
return (jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
|
|
18104
18100
|
}
|
|
18105
18101
|
|
|
18106
|
-
function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, }) {
|
|
18102
|
+
function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = true, }) {
|
|
18107
18103
|
var _a, _b;
|
|
18108
18104
|
return (jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor, variant: assetsButtonVariant }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
|
|
18109
18105
|
decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
|
|
@@ -18114,7 +18110,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain,
|
|
|
18114
18110
|
}, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
|
|
18115
18111
|
token: '0.001',
|
|
18116
18112
|
usd: '0.01',
|
|
18117
|
-
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!
|
|
18113
|
+
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive })] }));
|
|
18118
18114
|
}
|
|
18119
18115
|
|
|
18120
18116
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -24234,10 +24230,11 @@ var InputMode;
|
|
|
24234
24230
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24235
24231
|
token: '0.001',
|
|
24236
24232
|
usd: '0.01',
|
|
24237
|
-
}, showDetails = true, isLoading = false, direction, amountUsd, }) {
|
|
24233
|
+
}, showDetails = true, isLoading = false, direction, amountUsd, isInteractive = false, }) {
|
|
24238
24234
|
var _a;
|
|
24239
24235
|
const [inputValue, setInputValue] = useState('');
|
|
24240
24236
|
const [inputMode, setInputMode] = useState(InputMode.TOKEN);
|
|
24237
|
+
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
24241
24238
|
useEffect(() => {
|
|
24242
24239
|
if (forcedAmount !== undefined) {
|
|
24243
24240
|
updateInputValue(forcedAmount);
|
|
@@ -24251,7 +24248,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24251
24248
|
setInputValue(formattedAmount);
|
|
24252
24249
|
}, [inputMode, token.price, direction, token.decimals]);
|
|
24253
24250
|
const onBalanceButtonClick = useCallback(() => {
|
|
24254
|
-
if (
|
|
24251
|
+
if (balanceChipClickable) {
|
|
24255
24252
|
updateInputValue(balance);
|
|
24256
24253
|
onAmountChange(balance);
|
|
24257
24254
|
}
|
|
@@ -24345,12 +24342,11 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24345
24342
|
return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
24346
24343
|
}
|
|
24347
24344
|
}, [inputValue, inputMode, token.price, direction, amountUsd]);
|
|
24348
|
-
const isInteractive = direction === 'from';
|
|
24349
24345
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
24350
24346
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
24351
24347
|
? 'tw-text-status-negative'
|
|
24352
24348
|
: 'tw-text-grey-300';
|
|
24353
|
-
const BalanceChipTag =
|
|
24349
|
+
const BalanceChipTag = balanceChipClickable ? 'button' : 'div';
|
|
24354
24350
|
const balanceFormatted = useMemo(() => {
|
|
24355
24351
|
return formatAmount(balance !== null && balance !== void 0 ? balance : '0');
|
|
24356
24352
|
}, [balance]);
|
|
@@ -24360,7 +24356,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24360
24356
|
? formatIfVerySmall.token
|
|
24361
24357
|
: amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24362
24358
|
? formatIfVerySmall.token
|
|
24363
|
-
: amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName,
|
|
24359
|
+
: amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0 ? 'tw-opacity-0' : '' }), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable && interactiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balanceFormatted }), jsx(Chip, { label: "Max" })] })] }))] }));
|
|
24364
24360
|
}
|
|
24365
24361
|
|
|
24366
24362
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
@@ -59815,7 +59811,9 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
59815
59811
|
const handleCollapseRouteSteps = () => { var _a; return (_a = trackTransactionViewRef.current) === null || _a === void 0 ? void 0 : _a.handleToggleRouteSteps(); };
|
|
59816
59812
|
return (jsxs(Modal, { isOpen: isOpen, onBackdropClick:
|
|
59817
59813
|
// close route steps modal when open and backdrop is clicked
|
|
59818
|
-
!showSwapInfoSection
|
|
59814
|
+
!showSwapInfoSection
|
|
59815
|
+
? handleCollapseRouteSteps
|
|
59816
|
+
: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), children: [jsxs(ModalContent, { style: {
|
|
59819
59817
|
[CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
59820
59818
|
[CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
59821
59819
|
}, borderType: "outline", className: cn('!tw-max-h-[470px]',
|
|
@@ -59833,7 +59831,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
59833
59831
|
}, secondToken: {
|
|
59834
59832
|
bgColor: toToken.bgColor,
|
|
59835
59833
|
logoURI: toToken.logoUrl,
|
|
59836
|
-
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(PropertyListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(Transfer, { from: jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsx(PropertyListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsx(Transfer, { from: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(PropertyListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsx(PropertyListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsx(Button$1, { size: "lg", variant: "primary", label: "Cancel", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsx(Button$1, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsx(Button$1, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsx(Button$1, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
59834
|
+
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(PropertyListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(Transfer, { from: jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsx(PropertyListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsx(Transfer, { from: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(PropertyListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsx(PropertyListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsx(Button$1, { size: "lg", variant: "primary", label: "Cancel", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsx(Button$1, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }), jsx(Button$1, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsx(Button$1, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }))] }));
|
|
59837
59835
|
}
|
|
59838
59836
|
const TrackTransactionView = forwardRef((props, ref) => {
|
|
59839
59837
|
const { swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, footerButton, } = props;
|
|
@@ -23,6 +23,7 @@ interface NumericInputProps {
|
|
|
23
23
|
direction?: SwapDirection;
|
|
24
24
|
amountUsd?: string;
|
|
25
25
|
maxUsdDecimals?: number;
|
|
26
|
+
isInteractive?: boolean;
|
|
26
27
|
}
|
|
27
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -5,7 +5,9 @@ export declare function ChevronArrowIcon({ size, className, }: {
|
|
|
5
5
|
size?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function ArrowTriangle(
|
|
8
|
+
export declare function ArrowTriangle({ className }: {
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export declare function ChevronTopSmallIcon(): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export declare function ChevronLargeDownIcon({ size, className, }: {
|
|
11
13
|
size?: string;
|
|
@@ -30,6 +30,8 @@ interface SwapConfigurationProps {
|
|
|
30
30
|
emptyAddressLabel?: string;
|
|
31
31
|
assetsButtonVariant?: AssetsButtonVariant;
|
|
32
32
|
maxUsdDecimals?: number;
|
|
33
|
+
isInputInteractive?: boolean;
|
|
34
|
+
isLoading?: boolean;
|
|
33
35
|
}
|
|
34
|
-
export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
35
37
|
export {};
|
|
@@ -12,7 +12,7 @@ type Token = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
14
14
|
steps: SwapStep[];
|
|
15
|
-
handleClose?: () => void;
|
|
15
|
+
handleClose?: (swapState: SwapState) => void;
|
|
16
16
|
handleComplete?: () => void;
|
|
17
17
|
isOpen?: boolean;
|
|
18
18
|
socialLink?: string;
|
|
@@ -12,6 +12,7 @@ export declare const Address: Story;
|
|
|
12
12
|
export declare const WithBalance: Story;
|
|
13
13
|
export declare const LowPriceImpact: Story;
|
|
14
14
|
export declare const HighPriceImpact: Story;
|
|
15
|
+
export declare const ZeroPriceImpact: Story;
|
|
15
16
|
export declare const IsFetching: Story;
|
|
16
17
|
export declare const AllProps: Story;
|
|
17
18
|
export declare const ToDirection: Story;
|
package/dist/index.d.ts
CHANGED
|
@@ -227,8 +227,9 @@ interface NumericInputProps {
|
|
|
227
227
|
direction?: SwapDirection;
|
|
228
228
|
amountUsd?: string;
|
|
229
229
|
maxUsdDecimals?: number;
|
|
230
|
+
isInteractive?: boolean;
|
|
230
231
|
}
|
|
231
|
-
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, }: NumericInputProps): react_jsx_runtime.JSX.Element;
|
|
232
|
+
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive, }: NumericInputProps): react_jsx_runtime.JSX.Element;
|
|
232
233
|
|
|
233
234
|
interface SettingsSliderProps {
|
|
234
235
|
value: number | undefined;
|
|
@@ -1409,8 +1410,10 @@ interface SwapConfigurationProps {
|
|
|
1409
1410
|
emptyAddressLabel?: string;
|
|
1410
1411
|
assetsButtonVariant?: AssetsButtonVariant;
|
|
1411
1412
|
maxUsdDecimals?: number;
|
|
1413
|
+
isInputInteractive?: boolean;
|
|
1414
|
+
isLoading?: boolean;
|
|
1412
1415
|
}
|
|
1413
|
-
declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
1416
|
+
declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
1414
1417
|
|
|
1415
1418
|
interface SwapProgressViewHeaderProps {
|
|
1416
1419
|
title: string;
|
|
@@ -1764,7 +1767,7 @@ type Token = {
|
|
|
1764
1767
|
};
|
|
1765
1768
|
declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
1766
1769
|
steps: SwapStep[];
|
|
1767
|
-
handleClose?: () => void;
|
|
1770
|
+
handleClose?: (swapState: SwapState) => void;
|
|
1768
1771
|
handleComplete?: () => void;
|
|
1769
1772
|
isOpen?: boolean;
|
|
1770
1773
|
socialLink?: string;
|