@0xsquid/ui 0.13.9 → 0.13.11
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 +100 -46
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +3 -4
- package/dist/cjs/types/components/icons/SwapStatus.d.ts +3 -2
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +3 -1
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +2 -1
- package/dist/cjs/types/core/constants.d.ts +1 -0
- package/dist/cjs/types/services/internal/colorService.d.ts +1 -0
- package/dist/cjs/types/stories/layout/Boost.stories.d.ts +3 -2
- package/dist/cjs/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
- package/dist/cjs/types/stories/views/SwapProgressView.stories.d.ts +9 -1
- package/dist/cjs/types/types/config.d.ts +2 -0
- package/dist/esm/index.js +100 -46
- package/dist/esm/types/components/buttons/BoostButton.d.ts +3 -4
- package/dist/esm/types/components/icons/SwapStatus.d.ts +3 -2
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +3 -1
- package/dist/esm/types/components/views/SwapProgressView.d.ts +2 -1
- package/dist/esm/types/core/constants.d.ts +1 -0
- package/dist/esm/types/services/internal/colorService.d.ts +1 -0
- package/dist/esm/types/stories/layout/Boost.stories.d.ts +3 -2
- package/dist/esm/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
- package/dist/esm/types/stories/views/SwapProgressView.stories.d.ts +9 -1
- package/dist/esm/types/types/config.d.ts +2 -0
- package/dist/index.css +16 -6
- package/dist/index.d.ts +7 -6
- package/package.json +1 -1
- package/dist/cjs/types/stories/buttons/BoostButton.stories.d.ts +0 -9
- package/dist/esm/types/stories/buttons/BoostButton.stories.d.ts +0 -9
package/dist/cjs/index.js
CHANGED
|
@@ -2831,6 +2831,12 @@ const themeTypesKeys = {
|
|
|
2831
2831
|
'status-partial': {
|
|
2832
2832
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-partial`,
|
|
2833
2833
|
},
|
|
2834
|
+
'grey-100-005': {
|
|
2835
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-100-005`,
|
|
2836
|
+
},
|
|
2837
|
+
'material-light-blend-grey-900': {
|
|
2838
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-blend-grey-900`,
|
|
2839
|
+
},
|
|
2834
2840
|
};
|
|
2835
2841
|
|
|
2836
2842
|
function PlusIcon() {
|
|
@@ -2882,6 +2888,7 @@ const ANIMATION_DURATIONS = {
|
|
|
2882
2888
|
CHANGE_SWAP_STEP: 300,
|
|
2883
2889
|
SHOW_MODAL: 400,
|
|
2884
2890
|
HIDE_MODAL: 400,
|
|
2891
|
+
BOOST_BUTTON: 500,
|
|
2885
2892
|
};
|
|
2886
2893
|
const ANIMATION_TIMINGS = {
|
|
2887
2894
|
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
@@ -3107,7 +3114,7 @@ const borderRadiusClassMap = {
|
|
|
3107
3114
|
};
|
|
3108
3115
|
function Menu(_a) {
|
|
3109
3116
|
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
|
|
3110
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-
|
|
3117
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-xs tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsxRuntime.jsx("div", { className: "tw-z-20 tw-max-w-full tw-text-caption", children: children })), displayControls ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsxRuntime.jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
3111
3118
|
}
|
|
3112
3119
|
|
|
3113
3120
|
const tooltipWidthClassMap = {
|
|
@@ -3133,28 +3140,13 @@ function Tooltip({ children, tooltipContent, tooltipWidth = 'container', thresho
|
|
|
3133
3140
|
'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
|
|
3134
3141
|
}
|
|
3135
3142
|
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
3141
|
-
return;
|
|
3142
|
-
// we don't want to trigger the animation when the component is mounted
|
|
3143
|
-
// so we set the animation duration only when user clicks the button
|
|
3144
|
-
boostIndicatorRef.current.style.setProperty(CSS_VARS.MOVE_WITH_SPRING_BOUNCE_DURATION, animationDuration);
|
|
3145
|
-
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
3146
|
-
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
3147
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
3148
|
-
}
|
|
3149
|
-
else {
|
|
3150
|
-
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
3151
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
return (jsxRuntime.jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxRuntime.jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: "tw-group tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsxRuntime.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxRuntime.jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
3143
|
+
function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
|
|
3144
|
+
return (jsxRuntime.jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxRuntime.jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsxRuntime.jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
|
|
3145
|
+
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxRuntime.jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
|
|
3146
|
+
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxRuntime.jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
3155
3147
|
boxShadow: generateMarkerLines(40),
|
|
3156
|
-
} })] }), jsxRuntime.jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
3157
|
-
transitionDuration:
|
|
3148
|
+
} })] }), jsxRuntime.jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled/boost-toggle:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
3149
|
+
transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
|
|
3158
3150
|
} })] }) }));
|
|
3159
3151
|
}
|
|
3160
3152
|
function generateMarkerLines(count) {
|
|
@@ -3188,9 +3180,25 @@ function SettingsButton({ label, isSelected = false, onClick, }) {
|
|
|
3188
3180
|
}
|
|
3189
3181
|
|
|
3190
3182
|
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3183
|
+
const boostIndicatorRef = React.useRef(null);
|
|
3184
|
+
function handleToggleBoostMode() {
|
|
3185
|
+
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
3186
|
+
return;
|
|
3187
|
+
// we don't want to trigger the animation when the component is mounted
|
|
3188
|
+
// so we set the animation duration only when user clicks the button
|
|
3189
|
+
boostIndicatorRef.current.style.setProperty(CSS_VARS.MOVE_WITH_SPRING_BOUNCE_DURATION, `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`);
|
|
3190
|
+
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
3191
|
+
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
3192
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
3193
|
+
}
|
|
3194
|
+
else {
|
|
3195
|
+
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
3196
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
return (jsxRuntime.jsx("div", { className: "tw-bg-grey-900", children: jsxRuntime.jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: cn('tw-group/boost-toggle tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-rounded-squid-m tw-bg-grey-900 tw-pr-squid-xs', canToggleBoostMode && 'hover:tw-bg-material-light-thin'), children: [jsxRuntime.jsx(BoostButton, { boostIndicatorRef: boostIndicatorRef, boostMode: boostMode, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, tooltipDisplayDelayMs: boostTooltipDisplayDelayMs }), jsxRuntime.jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
3200
|
+
? 'tw-bg-grey-300'
|
|
3201
|
+
: 'tw-bg-status-positive') })] }) }));
|
|
3194
3202
|
}
|
|
3195
3203
|
|
|
3196
3204
|
function EmojiSadIcon({ className }) {
|
|
@@ -3210,7 +3218,7 @@ const detailStateClassMap = {
|
|
|
3210
3218
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
3211
3219
|
full: '',
|
|
3212
3220
|
};
|
|
3213
|
-
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, }) {
|
|
3221
|
+
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, isFlipButtonDisabled, flipButtonDisabledMessage, }) {
|
|
3214
3222
|
const state = React.useMemo(() => {
|
|
3215
3223
|
if (errorMessage)
|
|
3216
3224
|
return 'error';
|
|
@@ -3221,7 +3229,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3221
3229
|
return 'full';
|
|
3222
3230
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3223
3231
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3224
|
-
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(
|
|
3232
|
+
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Tooltip, { tooltipContent: isFlipButtonDisabled ? flipButtonDisabledMessage : undefined, tooltipWidth: "max", children: jsxRuntime.jsx("button", { disabled: isFlipButtonDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsxRuntime.jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !isFlipButtonDisabled &&
|
|
3233
|
+
'group-hover/flip-button:tw-rotate-180') }) }) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3225
3234
|
}
|
|
3226
3235
|
|
|
3227
3236
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -38590,12 +38599,15 @@ function XSocial({ className, size = '24', }) {
|
|
|
38590
38599
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M17.4033 3.5H20.2852L13.989 10.701L21.396 20.5H15.5964L11.054 14.557L5.85637 20.5H2.97269L9.70709 12.7977L2.60156 3.5H8.54839L12.6544 8.93215L17.4033 3.5ZM16.3918 18.7738H17.9887L7.68067 5.13549H5.96702L16.3918 18.7738Z", fill: "currentColor" }) }));
|
|
38591
38600
|
}
|
|
38592
38601
|
|
|
38593
|
-
function
|
|
38602
|
+
function SwapSuccessIcon() {
|
|
38594
38603
|
return (jsxRuntime.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24Z", fill: "currentColor", className: "tw-text-grey-900" }), jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4ZM31.5479 20.2665C32.2474 19.4116 32.1214 18.1516 31.2665 17.4521C30.4116 16.7527 29.1515 16.8787 28.4521 17.7336L20.8515 27.0232L18.4142 24.5858C17.6332 23.8048 16.3668 23.8048 15.5858 24.5858C14.8047 25.3669 14.8047 26.6332 15.5858 27.4143L19.5858 31.4143C19.9853 31.8138 20.5353 32.0257 21.0996 31.9976C21.664 31.9694 22.1901 31.7039 22.5479 31.2665L31.5479 20.2665Z", className: "tw-text-status-positive", fill: "currentColor" }), jsxRuntime.jsx("g", { filter: "url(#filter0_b_457_52170)", children: jsxRuntime.jsx("circle", { cx: "24", cy: "24", r: "20.5", stroke: "currentColor", className: "tw-text-material-light-average" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("filter", { id: "filter0_b_457_52170", x: "-17", y: "-17", width: "82", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsxRuntime.jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsxRuntime.jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsxRuntime.jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_52170" }), jsxRuntime.jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_52170", result: "shape" })] }) })] }));
|
|
38595
38604
|
}
|
|
38596
|
-
function
|
|
38605
|
+
function SwapErrorIcon() {
|
|
38597
38606
|
return (jsxRuntime.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24Z", className: "tw-text-grey-900", fill: "currentColor" }), jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44ZM31.0683 28.9289C27.163 25.0237 20.8314 25.0237 16.9261 28.9289C16.1451 29.71 16.1451 30.9763 16.9261 31.7574C17.7072 32.5384 18.9735 32.5384 19.7545 31.7574C22.0977 29.4142 25.8967 29.4142 28.2398 31.7574C29.0209 32.5384 30.2872 32.5384 31.0683 31.7574C31.8493 30.9763 31.8493 29.71 31.0683 28.9289ZM21 19C21 20.6569 19.8807 22 18.5 22C17.1193 22 16 20.6569 16 19C16 17.3431 17.1193 16 18.5 16C19.8807 16 21 17.3431 21 19ZM29.5 22C30.8807 22 32 20.6569 32 19C32 17.3431 30.8807 16 29.5 16C28.1193 16 27 17.3431 27 19C27 20.6569 28.1193 22 29.5 22Z", className: "tw-text-status-negative", fill: "currentColor" }), jsxRuntime.jsx("g", { filter: "url(#filter0_b_457_52502)", children: jsxRuntime.jsx("circle", { cx: "24", cy: "24", r: "20.5", stroke: "currentColor", className: "tw-text-material-light-average", "stroke-opacity": "0.33" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("filter", { id: "filter0_b_457_52502", x: "-17", y: "-17", width: "82", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsxRuntime.jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsxRuntime.jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsxRuntime.jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_52502" }), jsxRuntime.jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_52502", result: "shape" })] }) })] }));
|
|
38598
38607
|
}
|
|
38608
|
+
function SwapWarningIcon() {
|
|
38609
|
+
return (jsxRuntime.jsxs("svg", { width: "42", height: "42", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M1 21C1 9.95431 9.95431 1 21 1C32.0457 1 41 9.95431 41 21C41 32.0457 32.0457 41 21 41C9.95431 41 1 32.0457 1 21Z", fill: "currentColor", className: "tw-text-grey-900" }), jsxRuntime.jsx("g", { filter: "url(#filter0_b_588_15630)", children: jsxRuntime.jsx("circle", { cx: "21", cy: "21", r: "20.5", stroke: "currentColor", className: "tw-text-material-light-average" }) }), jsxRuntime.jsxs("g", { "clip-path": "url(#clip0_588_15630)", children: [jsxRuntime.jsx("path", { d: "M1 21C1 9.95431 9.95431 1 21 1C32.0457 1 41 9.95431 41 21C41 32.0457 32.0457 41 21 41C9.95431 41 1 32.0457 1 21Z", fill: "currentColor", className: "tw-text-grey-900" }), jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M41 21C41 32.0457 32.0457 41 21 41C9.9543 41 1 32.0457 1 21C1 9.9543 9.9543 1 21 1C32.0457 1 41 9.9543 41 21ZM15.5 19C16.8807 19 18 17.6569 18 16C18 14.3431 16.8807 13 15.5 13C14.1193 13 13 14.3431 13 16C13 17.6569 14.1193 19 15.5 19ZM29 16C29 17.6569 27.8807 19 26.5 19C25.1193 19 24 17.6569 24 16C24 14.3431 25.1193 13 26.5 13C27.8807 13 29 14.3431 29 16ZM15 27C13.8954 27 13 27.8954 13 29C13 30.1046 13.8954 31 15 31H27C28.1046 31 29 30.1046 29 29C29 27.8954 28.1046 27 27 27H15Z", fill: "currentColor", className: "tw-text-status-partial" })] }), jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsxs("filter", { id: "filter0_b_588_15630", x: "-20", y: "-20", width: "82", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsxRuntime.jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsxRuntime.jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsxRuntime.jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_588_15630" }), jsxRuntime.jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_588_15630", result: "shape" })] }), jsxRuntime.jsx("clipPath", { id: "clip0_588_15630", children: jsxRuntime.jsx("path", { d: "M1 21C1 9.95431 9.95431 1 21 1C32.0457 1 41 9.95431 41 21C41 32.0457 32.0457 41 21 41C9.95431 41 1 32.0457 1 21Z", fill: "white" }) })] })] }));
|
|
38610
|
+
}
|
|
38599
38611
|
|
|
38600
38612
|
function WalletFilledIcon({ size = '24' }) {
|
|
38601
38613
|
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: [jsxRuntime.jsx("path", { d: "M4 6.5V17C4 18.6569 5.34315 20 7 20H18C19.1046 20 20 19.1046 20 18V11C20 9.89543 19.1046 9 18 9H16M4 6.5C4 7.88071 5.11929 9 6.5 9H16M4 6.5C4 5.11929 5.11929 4 6.5 4H14.5882C15.3679 4 16 4.63207 16 5.41176V9", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "square", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M15.5 15.375C15.9832 15.375 16.375 14.9832 16.375 14.5C16.375 14.0168 15.9832 13.625 15.5 13.625C15.0168 13.625 14.625 14.0168 14.625 14.5C14.625 14.9832 15.0168 15.375 15.5 15.375Z", fill: "currentColor", stroke: "currentColor", "stroke-width": "0.75" })] }));
|
|
@@ -38657,12 +38669,12 @@ const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
|
38657
38669
|
case SwapState.CONFIRMATION_REJECTED:
|
|
38658
38670
|
return 'Swap rejected';
|
|
38659
38671
|
case SwapState.PARTIAL_SUCCESS:
|
|
38660
|
-
return 'Swap failed
|
|
38672
|
+
return 'Swap failed to complete';
|
|
38661
38673
|
case SwapState.NEEDS_GAS:
|
|
38662
38674
|
return 'Needs gas on destination';
|
|
38663
38675
|
}
|
|
38664
38676
|
};
|
|
38665
|
-
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, }) => {
|
|
38677
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, }) => {
|
|
38666
38678
|
switch (swapState) {
|
|
38667
38679
|
case SwapState.CONFIRM: {
|
|
38668
38680
|
return 'Authenticate the transaction in your wallet.';
|
|
@@ -38683,7 +38695,7 @@ const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, })
|
|
|
38683
38695
|
return 'You declined the transaction in your wallet.';
|
|
38684
38696
|
}
|
|
38685
38697
|
case SwapState.PARTIAL_SUCCESS: {
|
|
38686
|
-
return `You received a refund of axlUSDC on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}
|
|
38698
|
+
return `You received a refund of axlUSDC to your wallet ${toAddressFormatted} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}.`;
|
|
38687
38699
|
}
|
|
38688
38700
|
case SwapState.NEEDS_GAS: {
|
|
38689
38701
|
return 'Add gas to the transaction via Axelarscan to complete the swap';
|
|
@@ -38697,10 +38709,10 @@ const swapProgressButtonTexts = {
|
|
|
38697
38709
|
[SwapState.ERROR]: 'Ok, go back',
|
|
38698
38710
|
[SwapState.CONFIRMATION_TOO_LONG]: 'Cancel',
|
|
38699
38711
|
[SwapState.CONFIRMATION_REJECTED]: 'Ok, go back',
|
|
38700
|
-
[SwapState.PARTIAL_SUCCESS]: '
|
|
38712
|
+
[SwapState.PARTIAL_SUCCESS]: 'Cancel',
|
|
38701
38713
|
[SwapState.NEEDS_GAS]: 'Go to Axelarscan',
|
|
38702
38714
|
};
|
|
38703
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
38715
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
38704
38716
|
const [showSwapInfoSection, setShowSwapInfoSection] = React.useState(true);
|
|
38705
38717
|
const isFirstRenderRef = React.useRef(true);
|
|
38706
38718
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -38729,6 +38741,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38729
38741
|
toAmount,
|
|
38730
38742
|
toChain,
|
|
38731
38743
|
toToken,
|
|
38744
|
+
toAddressFormatted,
|
|
38732
38745
|
});
|
|
38733
38746
|
return {
|
|
38734
38747
|
headerTitle,
|
|
@@ -38747,18 +38760,18 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38747
38760
|
: 'tw-animate-scale-and-fade-down'), children: [jsxRuntime.jsx("div", { className: "tw-flex tw-h-[160px] tw-w-full tw-items-center tw-justify-center tw-rounded-tl-squid-l tw-rounded-tr-squid-l tw-bg-royal-500 tw-text-material-light-thin", style: {
|
|
38748
38761
|
// box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
|
|
38749
38762
|
boxShadow: '0 1px 0 currentColor',
|
|
38750
|
-
}, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsxRuntime.jsx(Loader, { size: "60" }) }) }) }), jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: swapState === SwapState.COMPLETED ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(
|
|
38751
|
-
swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(EmojiSadFilledIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] })) : (jsxRuntime.jsx(TokenPair, { firstToken: {
|
|
38763
|
+
}, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsxRuntime.jsx(Loader, { size: "60" }) }) }) }), jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: swapState === SwapState.COMPLETED ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(SwapSuccessIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", icon: jsxRuntime.jsx(XSocial, {}), label: "Share", link: socialLink, title: "Share on X" })] })) : swapState === SwapState.ERROR ? (jsxRuntime.jsx(SwapErrorTopMenu, { supportLink: supportLink, type: "error" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsx(SwapErrorTopMenu, { supportLink: supportLink, type: "warning" })) : (jsxRuntime.jsx(TokenPair, { firstToken: {
|
|
38752
38764
|
bgColor: fromToken.bgColor,
|
|
38753
38765
|
imageUrl: fromToken.logoUrl,
|
|
38754
38766
|
}, secondToken: {
|
|
38755
38767
|
bgColor: toToken.bgColor,
|
|
38756
38768
|
imageUrl: toToken.logoUrl,
|
|
38757
|
-
} })) }), 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(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromAmount })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toAmount })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: 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 })] }), toContent: 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(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete }) })] })] }), jsxRuntime.jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" })] }));
|
|
38769
|
+
} })) }), 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(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromAmount })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toAmount })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: 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 })] }), toContent: 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(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Button, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
38758
38770
|
}
|
|
38759
38771
|
const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }) => {
|
|
38760
38772
|
const { currentStepIndex, steps } = React.useMemo(() => {
|
|
38761
|
-
if (
|
|
38773
|
+
if (swapState === SwapState.COMPLETED) {
|
|
38774
|
+
onTxEnd();
|
|
38762
38775
|
return {
|
|
38763
38776
|
steps: rawSteps,
|
|
38764
38777
|
currentStepIndex: rawSteps.length - 1,
|
|
@@ -38792,13 +38805,6 @@ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart,
|
|
|
38792
38805
|
currentStepIndex: rawSteps.length - 1,
|
|
38793
38806
|
};
|
|
38794
38807
|
}
|
|
38795
|
-
else if (swapState === SwapState.COMPLETED) {
|
|
38796
|
-
onTxEnd();
|
|
38797
|
-
return {
|
|
38798
|
-
steps: rawSteps,
|
|
38799
|
-
currentStepIndex: rawSteps.length - 1,
|
|
38800
|
-
};
|
|
38801
|
-
}
|
|
38802
38808
|
return {
|
|
38803
38809
|
steps: rawSteps,
|
|
38804
38810
|
currentStepIndex: 0,
|
|
@@ -38809,6 +38815,9 @@ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart,
|
|
|
38809
38815
|
const SwapDetailItemValues = ({ fromContent, toContent, }) => {
|
|
38810
38816
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: fromContent })) : (fromContent), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: toContent })) : (toContent)] }));
|
|
38811
38817
|
};
|
|
38818
|
+
const SwapErrorTopMenu = ({ supportLink, type, }) => {
|
|
38819
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: type === 'error' ? jsxRuntime.jsx(SwapErrorIcon, {}) : jsxRuntime.jsx(SwapWarningIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] }));
|
|
38820
|
+
};
|
|
38812
38821
|
|
|
38813
38822
|
const lightTheme = {
|
|
38814
38823
|
// content
|
|
@@ -38875,6 +38884,7 @@ const themeKeysToReplace = [
|
|
|
38875
38884
|
* @param style
|
|
38876
38885
|
*/
|
|
38877
38886
|
const parseSquidTheme = (userTheme) => {
|
|
38887
|
+
var _a;
|
|
38878
38888
|
if (!userTheme)
|
|
38879
38889
|
return undefined;
|
|
38880
38890
|
const squidTheme = Object.entries(userTheme).reduce((internalKeys, [userKey, userValue]) => {
|
|
@@ -38914,7 +38924,11 @@ const parseSquidTheme = (userTheme) => {
|
|
|
38914
38924
|
// })
|
|
38915
38925
|
// })
|
|
38916
38926
|
parsed.push({
|
|
38917
|
-
[
|
|
38927
|
+
[themeTypesKeys['grey-100-005'].cssVariable]: getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.05),
|
|
38928
|
+
});
|
|
38929
|
+
// color representing the blend of material-light and grey-900
|
|
38930
|
+
parsed.push({
|
|
38931
|
+
[themeTypesKeys['material-light-blend-grey-900'].cssVariable]: (_a = blendColors(squidTheme['material-light-thin'], squidTheme['grey-900'])) !== null && _a !== void 0 ? _a : '',
|
|
38918
38932
|
});
|
|
38919
38933
|
return parsed.reduce((a, v) => {
|
|
38920
38934
|
const key = Object.keys(v)[0];
|
|
@@ -38936,6 +38950,46 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
38936
38950
|
.toString(16)
|
|
38937
38951
|
.padStart(2, '0')).toUpperCase();
|
|
38938
38952
|
}
|
|
38953
|
+
function hexToRgb(hex) {
|
|
38954
|
+
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
38955
|
+
let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
38956
|
+
hex = hex.replace(shorthandRegex, function (m, r, g, b, a) {
|
|
38957
|
+
return r + r + g + g + b + b + (a ? a + a : '');
|
|
38958
|
+
});
|
|
38959
|
+
let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex);
|
|
38960
|
+
return result
|
|
38961
|
+
? {
|
|
38962
|
+
r: parseInt(result[1], 16),
|
|
38963
|
+
g: parseInt(result[2], 16),
|
|
38964
|
+
b: parseInt(result[3], 16),
|
|
38965
|
+
a: result[4] ? parseInt(result[4], 16) / 255 : 1,
|
|
38966
|
+
}
|
|
38967
|
+
: null;
|
|
38968
|
+
}
|
|
38969
|
+
function rgbToHex(r, g, b) {
|
|
38970
|
+
return ('#' +
|
|
38971
|
+
[r, g, b]
|
|
38972
|
+
.map((x) => {
|
|
38973
|
+
const hex = x.toString(16);
|
|
38974
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
38975
|
+
})
|
|
38976
|
+
.join(''));
|
|
38977
|
+
}
|
|
38978
|
+
// Example usage:
|
|
38979
|
+
// let foregroundColor = '#FBFBFD1A'
|
|
38980
|
+
// let bgColor = '#17191C'
|
|
38981
|
+
// let resultingColor = blendColors(foregroundColor, bgColor)
|
|
38982
|
+
// console.log(resultingColor) // Output: ~#2f3033
|
|
38983
|
+
function blendColors(foreground, background) {
|
|
38984
|
+
let fg = hexToRgb(foreground);
|
|
38985
|
+
let bg = hexToRgb(background);
|
|
38986
|
+
if (!fg || !bg)
|
|
38987
|
+
return null;
|
|
38988
|
+
let r = Math.round(fg.r * fg.a + bg.r * (1 - fg.a));
|
|
38989
|
+
let g = Math.round(fg.g * fg.a + bg.g * (1 - fg.a));
|
|
38990
|
+
let b = Math.round(fg.b * fg.a + bg.b * (1 - fg.a));
|
|
38991
|
+
return rgbToHex(r, g, b);
|
|
38992
|
+
}
|
|
38939
38993
|
|
|
38940
38994
|
function SquidConfigProvider({ theme = lightTheme, children, themeType = 'light', }) {
|
|
38941
38995
|
const parsedStyle = parseSquidTheme(theme);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { BoostMode } from '../../types/components';
|
|
2
3
|
interface BoostButtonProps {
|
|
3
4
|
boostMode: BoostMode;
|
|
4
5
|
canToggleBoostMode?: boolean;
|
|
5
|
-
onToggleBoostMode?: ({ boostMode }: {
|
|
6
|
-
boostMode: BoostMode;
|
|
7
|
-
}) => void;
|
|
8
6
|
boostDisabledMessage?: string;
|
|
9
7
|
tooltipDisplayDelayMs?: number;
|
|
8
|
+
boostIndicatorRef: React.RefObject<HTMLDivElement>;
|
|
10
9
|
}
|
|
11
|
-
export declare function BoostButton({ boostMode,
|
|
10
|
+
export declare function BoostButton({ boostMode, canToggleBoostMode, boostDisabledMessage, tooltipDisplayDelayMs, boostIndicatorRef, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function
|
|
1
|
+
export declare function SwapSuccessIcon(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function SwapErrorIcon(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function SwapWarningIcon(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,8 @@ interface DetailsToolbarProps {
|
|
|
7
7
|
}) => void;
|
|
8
8
|
onInvertSwapButtonClick?: () => void;
|
|
9
9
|
onFeeButtonClick?: () => void;
|
|
10
|
+
isFlipButtonDisabled?: boolean;
|
|
11
|
+
flipButtonDisabledMessage?: string;
|
|
10
12
|
feeInUsd?: string;
|
|
11
13
|
estimatedTime?: string;
|
|
12
14
|
canToggleBoostMode?: boolean;
|
|
@@ -19,5 +21,5 @@ interface DetailsToolbarProps {
|
|
|
19
21
|
};
|
|
20
22
|
boostTooltipDisplayDelayMs?: number;
|
|
21
23
|
}
|
|
22
|
-
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, isFlipButtonDisabled, flipButtonDisabledMessage, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export {};
|
|
@@ -9,9 +9,10 @@ type Token = {
|
|
|
9
9
|
logoUrl: string;
|
|
10
10
|
bgColor: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
12
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
13
13
|
steps: SwapStep[];
|
|
14
14
|
handleClose?: () => void;
|
|
15
|
+
handleComplete?: () => void;
|
|
15
16
|
isOpen?: boolean;
|
|
16
17
|
socialLink?: string;
|
|
17
18
|
supportLink?: string;
|
|
@@ -36,3 +36,4 @@ export declare function getContrastColor({ r, g, b, }: {
|
|
|
36
36
|
* @returns {string} The hexadecimal color with opacity.
|
|
37
37
|
*/
|
|
38
38
|
export declare function getHexColorFromOpacityPercentage(color: string, opacity: number): string;
|
|
39
|
+
export declare function blendColors(foreground: string, background: string): string | null;
|
|
@@ -3,7 +3,8 @@ import { Boost } from '../../components/layout/Boost';
|
|
|
3
3
|
declare const meta: Meta<typeof Boost>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Normal: Story;
|
|
7
7
|
export declare const Boosted: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const NormalDisabled: Story;
|
|
9
|
+
export declare const BoostedDisabled: Story;
|
|
9
10
|
export declare const DisabledWithDelayedTooltip: Story;
|
|
@@ -3,4 +3,12 @@ import { SwapProgressView } from '../../components/views/SwapProgressView';
|
|
|
3
3
|
declare const meta: Meta<typeof SwapProgressView>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const WithControls: Story;
|
|
7
|
+
export declare const Completed: Story;
|
|
8
|
+
export declare const Error: Story;
|
|
9
|
+
export declare const Confirm: Story;
|
|
10
|
+
export declare const ConfirmationRejected: Story;
|
|
11
|
+
export declare const ConfirmationTooLong: Story;
|
|
12
|
+
export declare const NeedsGas: Story;
|
|
13
|
+
export declare const PartialSuccess: Story;
|
|
14
|
+
export declare const Progress: Story;
|
|
@@ -23,6 +23,8 @@ export interface InternalSquidTheme {
|
|
|
23
23
|
'material-dark-thin': string;
|
|
24
24
|
'material-dark-average': string;
|
|
25
25
|
'material-dark-thick': string;
|
|
26
|
+
'grey-100-005': string;
|
|
27
|
+
'material-light-blend-grey-900': string;
|
|
26
28
|
}
|
|
27
29
|
export type SquidTheme = {
|
|
28
30
|
'content-100': string;
|
package/dist/esm/index.js
CHANGED
|
@@ -2811,6 +2811,12 @@ const themeTypesKeys = {
|
|
|
2811
2811
|
'status-partial': {
|
|
2812
2812
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-partial`,
|
|
2813
2813
|
},
|
|
2814
|
+
'grey-100-005': {
|
|
2815
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-100-005`,
|
|
2816
|
+
},
|
|
2817
|
+
'material-light-blend-grey-900': {
|
|
2818
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-blend-grey-900`,
|
|
2819
|
+
},
|
|
2814
2820
|
};
|
|
2815
2821
|
|
|
2816
2822
|
function PlusIcon() {
|
|
@@ -2862,6 +2868,7 @@ const ANIMATION_DURATIONS = {
|
|
|
2862
2868
|
CHANGE_SWAP_STEP: 300,
|
|
2863
2869
|
SHOW_MODAL: 400,
|
|
2864
2870
|
HIDE_MODAL: 400,
|
|
2871
|
+
BOOST_BUTTON: 500,
|
|
2865
2872
|
};
|
|
2866
2873
|
const ANIMATION_TIMINGS = {
|
|
2867
2874
|
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
@@ -3087,7 +3094,7 @@ const borderRadiusClassMap = {
|
|
|
3087
3094
|
};
|
|
3088
3095
|
function Menu(_a) {
|
|
3089
3096
|
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
|
|
3090
|
-
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-
|
|
3097
|
+
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-xs tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsx("div", { className: "tw-z-20 tw-max-w-full tw-text-caption", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
3091
3098
|
}
|
|
3092
3099
|
|
|
3093
3100
|
const tooltipWidthClassMap = {
|
|
@@ -3113,28 +3120,13 @@ function Tooltip({ children, tooltipContent, tooltipWidth = 'container', thresho
|
|
|
3113
3120
|
'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
|
|
3114
3121
|
}
|
|
3115
3122
|
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
3121
|
-
return;
|
|
3122
|
-
// we don't want to trigger the animation when the component is mounted
|
|
3123
|
-
// so we set the animation duration only when user clicks the button
|
|
3124
|
-
boostIndicatorRef.current.style.setProperty(CSS_VARS.MOVE_WITH_SPRING_BOUNCE_DURATION, animationDuration);
|
|
3125
|
-
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
3126
|
-
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
3127
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
3128
|
-
}
|
|
3129
|
-
else {
|
|
3130
|
-
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
3131
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
|
-
return (jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: "tw-group tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
3123
|
+
function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
|
|
3124
|
+
return (jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
|
|
3125
|
+
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
|
|
3126
|
+
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
3135
3127
|
boxShadow: generateMarkerLines(40),
|
|
3136
|
-
} })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
3137
|
-
transitionDuration:
|
|
3128
|
+
} })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled/boost-toggle:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
3129
|
+
transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
|
|
3138
3130
|
} })] }) }));
|
|
3139
3131
|
}
|
|
3140
3132
|
function generateMarkerLines(count) {
|
|
@@ -3168,9 +3160,25 @@ function SettingsButton({ label, isSelected = false, onClick, }) {
|
|
|
3168
3160
|
}
|
|
3169
3161
|
|
|
3170
3162
|
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3163
|
+
const boostIndicatorRef = useRef(null);
|
|
3164
|
+
function handleToggleBoostMode() {
|
|
3165
|
+
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
3166
|
+
return;
|
|
3167
|
+
// we don't want to trigger the animation when the component is mounted
|
|
3168
|
+
// so we set the animation duration only when user clicks the button
|
|
3169
|
+
boostIndicatorRef.current.style.setProperty(CSS_VARS.MOVE_WITH_SPRING_BOUNCE_DURATION, `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`);
|
|
3170
|
+
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
3171
|
+
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
3172
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
3173
|
+
}
|
|
3174
|
+
else {
|
|
3175
|
+
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
3176
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
return (jsx("div", { className: "tw-bg-grey-900", children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: cn('tw-group/boost-toggle tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-rounded-squid-m tw-bg-grey-900 tw-pr-squid-xs', canToggleBoostMode && 'hover:tw-bg-material-light-thin'), children: [jsx(BoostButton, { boostIndicatorRef: boostIndicatorRef, boostMode: boostMode, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, tooltipDisplayDelayMs: boostTooltipDisplayDelayMs }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
3180
|
+
? 'tw-bg-grey-300'
|
|
3181
|
+
: 'tw-bg-status-positive') })] }) }));
|
|
3174
3182
|
}
|
|
3175
3183
|
|
|
3176
3184
|
function EmojiSadIcon({ className }) {
|
|
@@ -3190,7 +3198,7 @@ const detailStateClassMap = {
|
|
|
3190
3198
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
3191
3199
|
full: '',
|
|
3192
3200
|
};
|
|
3193
|
-
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, }) {
|
|
3201
|
+
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, isFlipButtonDisabled, flipButtonDisabledMessage, }) {
|
|
3194
3202
|
const state = useMemo(() => {
|
|
3195
3203
|
if (errorMessage)
|
|
3196
3204
|
return 'error';
|
|
@@ -3201,7 +3209,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3201
3209
|
return 'full';
|
|
3202
3210
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3203
3211
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3204
|
-
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(
|
|
3212
|
+
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, { tooltipContent: isFlipButtonDisabled ? flipButtonDisabledMessage : undefined, tooltipWidth: "max", children: jsx("button", { disabled: isFlipButtonDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !isFlipButtonDisabled &&
|
|
3213
|
+
'group-hover/flip-button:tw-rotate-180') }) }) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3205
3214
|
}
|
|
3206
3215
|
|
|
3207
3216
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -38570,12 +38579,15 @@ function XSocial({ className, size = '24', }) {
|
|
|
38570
38579
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsx("path", { d: "M17.4033 3.5H20.2852L13.989 10.701L21.396 20.5H15.5964L11.054 14.557L5.85637 20.5H2.97269L9.70709 12.7977L2.60156 3.5H8.54839L12.6544 8.93215L17.4033 3.5ZM16.3918 18.7738H17.9887L7.68067 5.13549H5.96702L16.3918 18.7738Z", fill: "currentColor" }) }));
|
|
38571
38580
|
}
|
|
38572
38581
|
|
|
38573
|
-
function
|
|
38582
|
+
function SwapSuccessIcon() {
|
|
38574
38583
|
return (jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24Z", fill: "currentColor", className: "tw-text-grey-900" }), jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4ZM31.5479 20.2665C32.2474 19.4116 32.1214 18.1516 31.2665 17.4521C30.4116 16.7527 29.1515 16.8787 28.4521 17.7336L20.8515 27.0232L18.4142 24.5858C17.6332 23.8048 16.3668 23.8048 15.5858 24.5858C14.8047 25.3669 14.8047 26.6332 15.5858 27.4143L19.5858 31.4143C19.9853 31.8138 20.5353 32.0257 21.0996 31.9976C21.664 31.9694 22.1901 31.7039 22.5479 31.2665L31.5479 20.2665Z", className: "tw-text-status-positive", fill: "currentColor" }), jsx("g", { filter: "url(#filter0_b_457_52170)", children: jsx("circle", { cx: "24", cy: "24", r: "20.5", stroke: "currentColor", className: "tw-text-material-light-average" }) }), jsx("defs", { children: jsxs("filter", { id: "filter0_b_457_52170", x: "-17", y: "-17", width: "82", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_52170" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_52170", result: "shape" })] }) })] }));
|
|
38575
38584
|
}
|
|
38576
|
-
function
|
|
38585
|
+
function SwapErrorIcon() {
|
|
38577
38586
|
return (jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24Z", className: "tw-text-grey-900", fill: "currentColor" }), jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44ZM31.0683 28.9289C27.163 25.0237 20.8314 25.0237 16.9261 28.9289C16.1451 29.71 16.1451 30.9763 16.9261 31.7574C17.7072 32.5384 18.9735 32.5384 19.7545 31.7574C22.0977 29.4142 25.8967 29.4142 28.2398 31.7574C29.0209 32.5384 30.2872 32.5384 31.0683 31.7574C31.8493 30.9763 31.8493 29.71 31.0683 28.9289ZM21 19C21 20.6569 19.8807 22 18.5 22C17.1193 22 16 20.6569 16 19C16 17.3431 17.1193 16 18.5 16C19.8807 16 21 17.3431 21 19ZM29.5 22C30.8807 22 32 20.6569 32 19C32 17.3431 30.8807 16 29.5 16C28.1193 16 27 17.3431 27 19C27 20.6569 28.1193 22 29.5 22Z", className: "tw-text-status-negative", fill: "currentColor" }), jsx("g", { filter: "url(#filter0_b_457_52502)", children: jsx("circle", { cx: "24", cy: "24", r: "20.5", stroke: "currentColor", className: "tw-text-material-light-average", "stroke-opacity": "0.33" }) }), jsx("defs", { children: jsxs("filter", { id: "filter0_b_457_52502", x: "-17", y: "-17", width: "82", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_52502" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_52502", result: "shape" })] }) })] }));
|
|
38578
38587
|
}
|
|
38588
|
+
function SwapWarningIcon() {
|
|
38589
|
+
return (jsxs("svg", { width: "42", height: "42", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M1 21C1 9.95431 9.95431 1 21 1C32.0457 1 41 9.95431 41 21C41 32.0457 32.0457 41 21 41C9.95431 41 1 32.0457 1 21Z", fill: "currentColor", className: "tw-text-grey-900" }), jsx("g", { filter: "url(#filter0_b_588_15630)", children: jsx("circle", { cx: "21", cy: "21", r: "20.5", stroke: "currentColor", className: "tw-text-material-light-average" }) }), jsxs("g", { "clip-path": "url(#clip0_588_15630)", children: [jsx("path", { d: "M1 21C1 9.95431 9.95431 1 21 1C32.0457 1 41 9.95431 41 21C41 32.0457 32.0457 41 21 41C9.95431 41 1 32.0457 1 21Z", fill: "currentColor", className: "tw-text-grey-900" }), jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M41 21C41 32.0457 32.0457 41 21 41C9.9543 41 1 32.0457 1 21C1 9.9543 9.9543 1 21 1C32.0457 1 41 9.9543 41 21ZM15.5 19C16.8807 19 18 17.6569 18 16C18 14.3431 16.8807 13 15.5 13C14.1193 13 13 14.3431 13 16C13 17.6569 14.1193 19 15.5 19ZM29 16C29 17.6569 27.8807 19 26.5 19C25.1193 19 24 17.6569 24 16C24 14.3431 25.1193 13 26.5 13C27.8807 13 29 14.3431 29 16ZM15 27C13.8954 27 13 27.8954 13 29C13 30.1046 13.8954 31 15 31H27C28.1046 31 29 30.1046 29 29C29 27.8954 28.1046 27 27 27H15Z", fill: "currentColor", className: "tw-text-status-partial" })] }), jsxs("defs", { children: [jsxs("filter", { id: "filter0_b_588_15630", x: "-20", y: "-20", width: "82", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_588_15630" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_588_15630", result: "shape" })] }), jsx("clipPath", { id: "clip0_588_15630", children: jsx("path", { d: "M1 21C1 9.95431 9.95431 1 21 1C32.0457 1 41 9.95431 41 21C41 32.0457 32.0457 41 21 41C9.95431 41 1 32.0457 1 21Z", fill: "white" }) })] })] }));
|
|
38590
|
+
}
|
|
38579
38591
|
|
|
38580
38592
|
function WalletFilledIcon({ size = '24' }) {
|
|
38581
38593
|
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: [jsx("path", { d: "M4 6.5V17C4 18.6569 5.34315 20 7 20H18C19.1046 20 20 19.1046 20 18V11C20 9.89543 19.1046 9 18 9H16M4 6.5C4 7.88071 5.11929 9 6.5 9H16M4 6.5C4 5.11929 5.11929 4 6.5 4H14.5882C15.3679 4 16 4.63207 16 5.41176V9", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "square", "stroke-linejoin": "round" }), jsx("path", { d: "M15.5 15.375C15.9832 15.375 16.375 14.9832 16.375 14.5C16.375 14.0168 15.9832 13.625 15.5 13.625C15.0168 13.625 14.625 14.0168 14.625 14.5C14.625 14.9832 15.0168 15.375 15.5 15.375Z", fill: "currentColor", stroke: "currentColor", "stroke-width": "0.75" })] }));
|
|
@@ -38637,12 +38649,12 @@ const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
|
38637
38649
|
case SwapState.CONFIRMATION_REJECTED:
|
|
38638
38650
|
return 'Swap rejected';
|
|
38639
38651
|
case SwapState.PARTIAL_SUCCESS:
|
|
38640
|
-
return 'Swap failed
|
|
38652
|
+
return 'Swap failed to complete';
|
|
38641
38653
|
case SwapState.NEEDS_GAS:
|
|
38642
38654
|
return 'Needs gas on destination';
|
|
38643
38655
|
}
|
|
38644
38656
|
};
|
|
38645
|
-
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, }) => {
|
|
38657
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, }) => {
|
|
38646
38658
|
switch (swapState) {
|
|
38647
38659
|
case SwapState.CONFIRM: {
|
|
38648
38660
|
return 'Authenticate the transaction in your wallet.';
|
|
@@ -38663,7 +38675,7 @@ const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, })
|
|
|
38663
38675
|
return 'You declined the transaction in your wallet.';
|
|
38664
38676
|
}
|
|
38665
38677
|
case SwapState.PARTIAL_SUCCESS: {
|
|
38666
|
-
return `You received a refund of axlUSDC on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}
|
|
38678
|
+
return `You received a refund of axlUSDC to your wallet ${toAddressFormatted} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}.`;
|
|
38667
38679
|
}
|
|
38668
38680
|
case SwapState.NEEDS_GAS: {
|
|
38669
38681
|
return 'Add gas to the transaction via Axelarscan to complete the swap';
|
|
@@ -38677,10 +38689,10 @@ const swapProgressButtonTexts = {
|
|
|
38677
38689
|
[SwapState.ERROR]: 'Ok, go back',
|
|
38678
38690
|
[SwapState.CONFIRMATION_TOO_LONG]: 'Cancel',
|
|
38679
38691
|
[SwapState.CONFIRMATION_REJECTED]: 'Ok, go back',
|
|
38680
|
-
[SwapState.PARTIAL_SUCCESS]: '
|
|
38692
|
+
[SwapState.PARTIAL_SUCCESS]: 'Cancel',
|
|
38681
38693
|
[SwapState.NEEDS_GAS]: 'Go to Axelarscan',
|
|
38682
38694
|
};
|
|
38683
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
38695
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
38684
38696
|
const [showSwapInfoSection, setShowSwapInfoSection] = useState(true);
|
|
38685
38697
|
const isFirstRenderRef = useRef(true);
|
|
38686
38698
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -38709,6 +38721,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38709
38721
|
toAmount,
|
|
38710
38722
|
toChain,
|
|
38711
38723
|
toToken,
|
|
38724
|
+
toAddressFormatted,
|
|
38712
38725
|
});
|
|
38713
38726
|
return {
|
|
38714
38727
|
headerTitle,
|
|
@@ -38727,18 +38740,18 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38727
38740
|
: 'tw-animate-scale-and-fade-down'), children: [jsx("div", { className: "tw-flex tw-h-[160px] tw-w-full tw-items-center tw-justify-center tw-rounded-tl-squid-l tw-rounded-tr-squid-l tw-bg-royal-500 tw-text-material-light-thin", style: {
|
|
38728
38741
|
// box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
|
|
38729
38742
|
boxShadow: '0 1px 0 currentColor',
|
|
38730
|
-
}, children: jsx("div", { children: jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsx(Loader, { size: "60" }) }) }) }), jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: swapState === SwapState.COMPLETED ? (jsxs(Fragment, { children: [jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsx(
|
|
38731
|
-
swapState === SwapState.PARTIAL_SUCCESS ? (jsxs(Fragment, { children: [jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsx(EmojiSadFilledIcon, {}) }), jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] })) : (jsx(TokenPair, { firstToken: {
|
|
38743
|
+
}, children: jsx("div", { children: jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsx(Loader, { size: "60" }) }) }) }), jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: swapState === SwapState.COMPLETED ? (jsxs(Fragment, { children: [jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsx(SwapSuccessIcon, {}) }), jsx(Button, { size: "md", variant: "secondary", icon: jsx(XSocial, {}), label: "Share", link: socialLink, title: "Share on X" })] })) : swapState === SwapState.ERROR ? (jsx(SwapErrorTopMenu, { supportLink: supportLink, type: "error" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsx(SwapErrorTopMenu, { supportLink: supportLink, type: "warning" })) : (jsx(TokenPair, { firstToken: {
|
|
38732
38744
|
bgColor: fromToken.bgColor,
|
|
38733
38745
|
imageUrl: fromToken.logoUrl,
|
|
38734
38746
|
}, secondToken: {
|
|
38735
38747
|
bgColor: toToken.bgColor,
|
|
38736
38748
|
imageUrl: toToken.logoUrl,
|
|
38737
|
-
} })) }), 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(SwapDetailListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsx(CaptionText, { children: fromAmount })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsx(CaptionText, { children: toAmount })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsx(SwapDetailItemValues, { fromContent: 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 })] }), toContent: 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(SwapDetailListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsx(SwapDetailListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete }) })] })] }), jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" })] }));
|
|
38749
|
+
} })) }), 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(SwapDetailListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsx(CaptionText, { children: fromAmount })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsx(CaptionText, { children: toAmount })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsx(SwapDetailItemValues, { fromContent: 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 })] }), toContent: 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(SwapDetailListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsx(SwapDetailListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), swapState === SwapState.PARTIAL_SUCCESS ? (jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsx(Button, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsx(Button, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
38738
38750
|
}
|
|
38739
38751
|
const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }) => {
|
|
38740
38752
|
const { currentStepIndex, steps } = useMemo(() => {
|
|
38741
|
-
if (
|
|
38753
|
+
if (swapState === SwapState.COMPLETED) {
|
|
38754
|
+
onTxEnd();
|
|
38742
38755
|
return {
|
|
38743
38756
|
steps: rawSteps,
|
|
38744
38757
|
currentStepIndex: rawSteps.length - 1,
|
|
@@ -38772,13 +38785,6 @@ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart,
|
|
|
38772
38785
|
currentStepIndex: rawSteps.length - 1,
|
|
38773
38786
|
};
|
|
38774
38787
|
}
|
|
38775
|
-
else if (swapState === SwapState.COMPLETED) {
|
|
38776
|
-
onTxEnd();
|
|
38777
|
-
return {
|
|
38778
|
-
steps: rawSteps,
|
|
38779
|
-
currentStepIndex: rawSteps.length - 1,
|
|
38780
|
-
};
|
|
38781
|
-
}
|
|
38782
38788
|
return {
|
|
38783
38789
|
steps: rawSteps,
|
|
38784
38790
|
currentStepIndex: 0,
|
|
@@ -38789,6 +38795,9 @@ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart,
|
|
|
38789
38795
|
const SwapDetailItemValues = ({ fromContent, toContent, }) => {
|
|
38790
38796
|
return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsx(CaptionText, { children: fromContent })) : (fromContent), jsx("span", { className: "tw-text-grey-500", children: jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsx(CaptionText, { children: toContent })) : (toContent)] }));
|
|
38791
38797
|
};
|
|
38798
|
+
const SwapErrorTopMenu = ({ supportLink, type, }) => {
|
|
38799
|
+
return (jsxs(Fragment, { children: [jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: type === 'error' ? jsx(SwapErrorIcon, {}) : jsx(SwapWarningIcon, {}) }), jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] }));
|
|
38800
|
+
};
|
|
38792
38801
|
|
|
38793
38802
|
const lightTheme = {
|
|
38794
38803
|
// content
|
|
@@ -38855,6 +38864,7 @@ const themeKeysToReplace = [
|
|
|
38855
38864
|
* @param style
|
|
38856
38865
|
*/
|
|
38857
38866
|
const parseSquidTheme = (userTheme) => {
|
|
38867
|
+
var _a;
|
|
38858
38868
|
if (!userTheme)
|
|
38859
38869
|
return undefined;
|
|
38860
38870
|
const squidTheme = Object.entries(userTheme).reduce((internalKeys, [userKey, userValue]) => {
|
|
@@ -38894,7 +38904,11 @@ const parseSquidTheme = (userTheme) => {
|
|
|
38894
38904
|
// })
|
|
38895
38905
|
// })
|
|
38896
38906
|
parsed.push({
|
|
38897
|
-
[
|
|
38907
|
+
[themeTypesKeys['grey-100-005'].cssVariable]: getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.05),
|
|
38908
|
+
});
|
|
38909
|
+
// color representing the blend of material-light and grey-900
|
|
38910
|
+
parsed.push({
|
|
38911
|
+
[themeTypesKeys['material-light-blend-grey-900'].cssVariable]: (_a = blendColors(squidTheme['material-light-thin'], squidTheme['grey-900'])) !== null && _a !== void 0 ? _a : '',
|
|
38898
38912
|
});
|
|
38899
38913
|
return parsed.reduce((a, v) => {
|
|
38900
38914
|
const key = Object.keys(v)[0];
|
|
@@ -38916,6 +38930,46 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
38916
38930
|
.toString(16)
|
|
38917
38931
|
.padStart(2, '0')).toUpperCase();
|
|
38918
38932
|
}
|
|
38933
|
+
function hexToRgb(hex) {
|
|
38934
|
+
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
38935
|
+
let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
38936
|
+
hex = hex.replace(shorthandRegex, function (m, r, g, b, a) {
|
|
38937
|
+
return r + r + g + g + b + b + (a ? a + a : '');
|
|
38938
|
+
});
|
|
38939
|
+
let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex);
|
|
38940
|
+
return result
|
|
38941
|
+
? {
|
|
38942
|
+
r: parseInt(result[1], 16),
|
|
38943
|
+
g: parseInt(result[2], 16),
|
|
38944
|
+
b: parseInt(result[3], 16),
|
|
38945
|
+
a: result[4] ? parseInt(result[4], 16) / 255 : 1,
|
|
38946
|
+
}
|
|
38947
|
+
: null;
|
|
38948
|
+
}
|
|
38949
|
+
function rgbToHex(r, g, b) {
|
|
38950
|
+
return ('#' +
|
|
38951
|
+
[r, g, b]
|
|
38952
|
+
.map((x) => {
|
|
38953
|
+
const hex = x.toString(16);
|
|
38954
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
38955
|
+
})
|
|
38956
|
+
.join(''));
|
|
38957
|
+
}
|
|
38958
|
+
// Example usage:
|
|
38959
|
+
// let foregroundColor = '#FBFBFD1A'
|
|
38960
|
+
// let bgColor = '#17191C'
|
|
38961
|
+
// let resultingColor = blendColors(foregroundColor, bgColor)
|
|
38962
|
+
// console.log(resultingColor) // Output: ~#2f3033
|
|
38963
|
+
function blendColors(foreground, background) {
|
|
38964
|
+
let fg = hexToRgb(foreground);
|
|
38965
|
+
let bg = hexToRgb(background);
|
|
38966
|
+
if (!fg || !bg)
|
|
38967
|
+
return null;
|
|
38968
|
+
let r = Math.round(fg.r * fg.a + bg.r * (1 - fg.a));
|
|
38969
|
+
let g = Math.round(fg.g * fg.a + bg.g * (1 - fg.a));
|
|
38970
|
+
let b = Math.round(fg.b * fg.a + bg.b * (1 - fg.a));
|
|
38971
|
+
return rgbToHex(r, g, b);
|
|
38972
|
+
}
|
|
38919
38973
|
|
|
38920
38974
|
function SquidConfigProvider({ theme = lightTheme, children, themeType = 'light', }) {
|
|
38921
38975
|
const parsedStyle = parseSquidTheme(theme);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { BoostMode } from '../../types/components';
|
|
2
3
|
interface BoostButtonProps {
|
|
3
4
|
boostMode: BoostMode;
|
|
4
5
|
canToggleBoostMode?: boolean;
|
|
5
|
-
onToggleBoostMode?: ({ boostMode }: {
|
|
6
|
-
boostMode: BoostMode;
|
|
7
|
-
}) => void;
|
|
8
6
|
boostDisabledMessage?: string;
|
|
9
7
|
tooltipDisplayDelayMs?: number;
|
|
8
|
+
boostIndicatorRef: React.RefObject<HTMLDivElement>;
|
|
10
9
|
}
|
|
11
|
-
export declare function BoostButton({ boostMode,
|
|
10
|
+
export declare function BoostButton({ boostMode, canToggleBoostMode, boostDisabledMessage, tooltipDisplayDelayMs, boostIndicatorRef, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export declare function
|
|
1
|
+
export declare function SwapSuccessIcon(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function SwapErrorIcon(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function SwapWarningIcon(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,8 @@ interface DetailsToolbarProps {
|
|
|
7
7
|
}) => void;
|
|
8
8
|
onInvertSwapButtonClick?: () => void;
|
|
9
9
|
onFeeButtonClick?: () => void;
|
|
10
|
+
isFlipButtonDisabled?: boolean;
|
|
11
|
+
flipButtonDisabledMessage?: string;
|
|
10
12
|
feeInUsd?: string;
|
|
11
13
|
estimatedTime?: string;
|
|
12
14
|
canToggleBoostMode?: boolean;
|
|
@@ -19,5 +21,5 @@ interface DetailsToolbarProps {
|
|
|
19
21
|
};
|
|
20
22
|
boostTooltipDisplayDelayMs?: number;
|
|
21
23
|
}
|
|
22
|
-
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, isFlipButtonDisabled, flipButtonDisabledMessage, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export {};
|
|
@@ -9,9 +9,10 @@ type Token = {
|
|
|
9
9
|
logoUrl: string;
|
|
10
10
|
bgColor: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
12
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
13
13
|
steps: SwapStep[];
|
|
14
14
|
handleClose?: () => void;
|
|
15
|
+
handleComplete?: () => void;
|
|
15
16
|
isOpen?: boolean;
|
|
16
17
|
socialLink?: string;
|
|
17
18
|
supportLink?: string;
|
|
@@ -36,3 +36,4 @@ export declare function getContrastColor({ r, g, b, }: {
|
|
|
36
36
|
* @returns {string} The hexadecimal color with opacity.
|
|
37
37
|
*/
|
|
38
38
|
export declare function getHexColorFromOpacityPercentage(color: string, opacity: number): string;
|
|
39
|
+
export declare function blendColors(foreground: string, background: string): string | null;
|
|
@@ -3,7 +3,8 @@ import { Boost } from '../../components/layout/Boost';
|
|
|
3
3
|
declare const meta: Meta<typeof Boost>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Normal: Story;
|
|
7
7
|
export declare const Boosted: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const NormalDisabled: Story;
|
|
9
|
+
export declare const BoostedDisabled: Story;
|
|
9
10
|
export declare const DisabledWithDelayedTooltip: Story;
|
|
@@ -3,4 +3,12 @@ import { SwapProgressView } from '../../components/views/SwapProgressView';
|
|
|
3
3
|
declare const meta: Meta<typeof SwapProgressView>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const WithControls: Story;
|
|
7
|
+
export declare const Completed: Story;
|
|
8
|
+
export declare const Error: Story;
|
|
9
|
+
export declare const Confirm: Story;
|
|
10
|
+
export declare const ConfirmationRejected: Story;
|
|
11
|
+
export declare const ConfirmationTooLong: Story;
|
|
12
|
+
export declare const NeedsGas: Story;
|
|
13
|
+
export declare const PartialSuccess: Story;
|
|
14
|
+
export declare const Progress: Story;
|
|
@@ -23,6 +23,8 @@ export interface InternalSquidTheme {
|
|
|
23
23
|
'material-dark-thin': string;
|
|
24
24
|
'material-dark-average': string;
|
|
25
25
|
'material-dark-thick': string;
|
|
26
|
+
'grey-100-005': string;
|
|
27
|
+
'material-light-blend-grey-900': string;
|
|
26
28
|
}
|
|
27
29
|
export type SquidTheme = {
|
|
28
30
|
'content-100': string;
|
package/dist/index.css
CHANGED
|
@@ -960,6 +960,10 @@ video {
|
|
|
960
960
|
height: 60px;
|
|
961
961
|
}
|
|
962
962
|
|
|
963
|
+
.tw-h-\[640px\] {
|
|
964
|
+
height: 640px;
|
|
965
|
+
}
|
|
966
|
+
|
|
963
967
|
.tw-h-\[660px\] {
|
|
964
968
|
height: 660px;
|
|
965
969
|
}
|
|
@@ -2200,10 +2204,6 @@ video {
|
|
|
2200
2204
|
padding-right: 0.625rem;
|
|
2201
2205
|
}
|
|
2202
2206
|
|
|
2203
|
-
.tw-pr-squid-xxs {
|
|
2204
|
-
padding-right: 0.3125rem;
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
2207
|
.tw-pt-\[5px\] {
|
|
2208
2208
|
padding-top: 5px;
|
|
2209
2209
|
}
|
|
@@ -2746,6 +2746,10 @@ input[type='number'] {
|
|
|
2746
2746
|
outline-offset: 2px;
|
|
2747
2747
|
}
|
|
2748
2748
|
|
|
2749
|
+
.disabled\:tw-cursor-not-allowed:disabled {
|
|
2750
|
+
cursor: not-allowed;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2749
2753
|
.tw-group\/base-button:hover .group-hover\/base-button\:tw-block {
|
|
2750
2754
|
display: block;
|
|
2751
2755
|
}
|
|
@@ -2754,11 +2758,17 @@ input[type='number'] {
|
|
|
2754
2758
|
display: none;
|
|
2755
2759
|
}
|
|
2756
2760
|
|
|
2757
|
-
.tw-group\/
|
|
2761
|
+
.tw-group\/flip-button:hover .group-hover\/flip-button\:tw-rotate-180 {
|
|
2758
2762
|
--tw-rotate: 180deg;
|
|
2759
2763
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2760
2764
|
}
|
|
2761
2765
|
|
|
2766
|
+
.tw-group\/boost-toggle:hover .group-hover\/boost-toggle\:tw-from-material-light-blend-grey-900 {
|
|
2767
|
+
--tw-gradient-from: var(--squid-theme-material-light-blend-grey-900) var(--tw-gradient-from-position);
|
|
2768
|
+
--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);
|
|
2769
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2762
2772
|
.tw-group\/swap-step-item-button:hover .group-hover\/swap-step-item-button\:tw-from-grey-700 {
|
|
2763
2773
|
--tw-gradient-from: var(--squid-theme-grey-700) var(--tw-gradient-from-position);
|
|
2764
2774
|
--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);
|
|
@@ -2781,7 +2791,7 @@ input[type='number'] {
|
|
|
2781
2791
|
opacity: 1;
|
|
2782
2792
|
}
|
|
2783
2793
|
|
|
2784
|
-
.tw-group:disabled .group-disabled\:tw-grayscale {
|
|
2794
|
+
.tw-group\/boost-toggle:disabled .group-disabled\/boost-toggle\:tw-grayscale {
|
|
2785
2795
|
--tw-grayscale: grayscale(100%);
|
|
2786
2796
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
|
2787
2797
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -79,13 +79,11 @@ type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
|
|
|
79
79
|
interface BoostButtonProps {
|
|
80
80
|
boostMode: BoostMode;
|
|
81
81
|
canToggleBoostMode?: boolean;
|
|
82
|
-
onToggleBoostMode?: ({ boostMode }: {
|
|
83
|
-
boostMode: BoostMode;
|
|
84
|
-
}) => void;
|
|
85
82
|
boostDisabledMessage?: string;
|
|
86
83
|
tooltipDisplayDelayMs?: number;
|
|
84
|
+
boostIndicatorRef: React.RefObject<HTMLDivElement>;
|
|
87
85
|
}
|
|
88
|
-
declare function BoostButton({ boostMode,
|
|
86
|
+
declare function BoostButton({ boostMode, canToggleBoostMode, boostDisabledMessage, tooltipDisplayDelayMs, boostIndicatorRef, }: BoostButtonProps): react_jsx_runtime.JSX.Element;
|
|
89
87
|
|
|
90
88
|
interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
91
89
|
label?: string;
|
|
@@ -189,6 +187,8 @@ interface DetailsToolbarProps {
|
|
|
189
187
|
}) => void;
|
|
190
188
|
onInvertSwapButtonClick?: () => void;
|
|
191
189
|
onFeeButtonClick?: () => void;
|
|
190
|
+
isFlipButtonDisabled?: boolean;
|
|
191
|
+
flipButtonDisabledMessage?: string;
|
|
192
192
|
feeInUsd?: string;
|
|
193
193
|
estimatedTime?: string;
|
|
194
194
|
canToggleBoostMode?: boolean;
|
|
@@ -201,7 +201,7 @@ interface DetailsToolbarProps {
|
|
|
201
201
|
};
|
|
202
202
|
boostTooltipDisplayDelayMs?: number;
|
|
203
203
|
}
|
|
204
|
-
declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
204
|
+
declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, isFlipButtonDisabled, flipButtonDisabledMessage, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
205
205
|
|
|
206
206
|
interface DropdownMenuItemProps {
|
|
207
207
|
label: string;
|
|
@@ -491,9 +491,10 @@ type Token = {
|
|
|
491
491
|
logoUrl: string;
|
|
492
492
|
bgColor: string;
|
|
493
493
|
};
|
|
494
|
-
declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
494
|
+
declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
495
495
|
steps: SwapStep[];
|
|
496
496
|
handleClose?: () => void;
|
|
497
|
+
handleComplete?: () => void;
|
|
497
498
|
isOpen?: boolean;
|
|
498
499
|
socialLink?: string;
|
|
499
500
|
supportLink?: string;
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { BoostButton } from '../../components/buttons/BoostButton';
|
|
3
|
-
declare const meta: Meta<typeof BoostButton>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const Normal: Story;
|
|
7
|
-
export declare const Boost: Story;
|
|
8
|
-
export declare const Disabled: Story;
|
|
9
|
-
export declare const DisabledWithDelayedTooltip: Story;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { BoostButton } from '../../components/buttons/BoostButton';
|
|
3
|
-
declare const meta: Meta<typeof BoostButton>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const Normal: Story;
|
|
7
|
-
export declare const Boost: Story;
|
|
8
|
-
export declare const Disabled: Story;
|
|
9
|
-
export declare const DisabledWithDelayedTooltip: Story;
|