@0xsquid/ui 0.19.4 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +382 -321
- package/dist/cjs/types/components/buttons/AssetsButton.d.ts +3 -1
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +1 -3
- package/dist/cjs/types/components/buttons/FeeButton.d.ts +3 -1
- package/dist/cjs/types/components/controls/NumericInput.d.ts +10 -2
- package/dist/cjs/types/components/controls/Tooltip.d.ts +1 -1
- package/dist/cjs/types/components/icons/Loader.d.ts +2 -1
- package/dist/cjs/types/components/layout/Boost.d.ts +3 -3
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +18 -14
- package/dist/cjs/types/components/layout/NavigationBar.d.ts +2 -0
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +21 -7
- package/dist/cjs/types/components/lists/HistoryItem.d.ts +1 -1
- package/dist/cjs/types/stories/buttons/AssetsButton.stories.d.ts +1 -0
- package/dist/cjs/types/stories/buttons/FeeButton.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/Boost.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/DetailsToolbar.stories.d.ts +4 -1
- package/dist/cjs/types/stories/layout/SwapConfiguration.stories.d.ts +1 -0
- package/dist/esm/index.js +382 -321
- package/dist/esm/types/components/buttons/AssetsButton.d.ts +3 -1
- package/dist/esm/types/components/buttons/BoostButton.d.ts +1 -3
- package/dist/esm/types/components/buttons/FeeButton.d.ts +3 -1
- package/dist/esm/types/components/controls/NumericInput.d.ts +10 -2
- package/dist/esm/types/components/controls/Tooltip.d.ts +1 -1
- package/dist/esm/types/components/icons/Loader.d.ts +2 -1
- package/dist/esm/types/components/layout/Boost.d.ts +3 -3
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +18 -14
- package/dist/esm/types/components/layout/NavigationBar.d.ts +2 -0
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +21 -7
- package/dist/esm/types/components/lists/HistoryItem.d.ts +1 -1
- package/dist/esm/types/stories/buttons/AssetsButton.stories.d.ts +1 -0
- package/dist/esm/types/stories/buttons/FeeButton.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/Boost.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/DetailsToolbar.stories.d.ts +4 -1
- package/dist/esm/types/stories/layout/SwapConfiguration.stories.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +125 -102
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2781,31 +2781,11 @@ function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
|
|
2783
2783
|
function Loader(_a) {
|
|
2784
|
-
var { size = '24', strokeWidth = '
|
|
2785
|
-
return (jsxs("svg", Object.assign({
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
@keyframes squid-animated-loader-dash-grow {
|
|
2790
|
-
0% {
|
|
2791
|
-
stroke-dasharray: 10, 5;
|
|
2792
|
-
}
|
|
2793
|
-
100% {
|
|
2794
|
-
stroke-dasharray: 5, 20;
|
|
2795
|
-
}
|
|
2796
|
-
}
|
|
2797
|
-
@keyframes squid-animated-loader-rotate {
|
|
2798
|
-
from {
|
|
2799
|
-
transform: rotate(0deg);
|
|
2800
|
-
}
|
|
2801
|
-
to {
|
|
2802
|
-
transform: rotate(-360deg);
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
.squid-animated-loader {
|
|
2806
|
-
animation: squid-animated-loader-rotate 1s linear infinite;
|
|
2807
|
-
transform-origin: center;
|
|
2808
|
-
}` }), jsxs("g", { clipPath: "url(#clip0_1387_2296)", children: [jsx("circle", { cx: "7.99967", cy: "8.00004", r: "6.66667", stroke: "currentColor", className: "tw-opacity-10", strokeWidth: strokeWidth }), jsx("path", { className: "squid-animated-loader-dash", d: "M14.6663 8.00004C14.6663 7.12456 14.4939 6.25766 14.1589 5.44882C13.8238 4.63998 13.3328 3.90505 12.7137 3.286C12.0947 2.66694 11.3597 2.17588 10.5509 1.84084C9.74206 1.50581 8.87515 1.33337 7.99967 1.33337", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round" })] }), jsx("defs", { children: jsx("clipPath", { id: "clip0_1387_2296", children: jsx("rect", { width: "16", height: "16", fill: "white" }) }) })] })));
|
|
2784
|
+
var { size = '24', strokeWidth = '2', className, rotateDuration = '0.8s' } = _a, props = __rest$1(_a, ["size", "strokeWidth", "className", "rotateDuration"]);
|
|
2785
|
+
return (jsxs("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32", fill: "none" }, props, { style: {
|
|
2786
|
+
'--squid-loader-rotate-duration': rotateDuration,
|
|
2787
|
+
}, className: cn('squid-animated-loader', className), children: [jsx("style", { children: `
|
|
2788
|
+
` }), jsxs("g", { id: "Spinner", children: [jsx("circle", { id: "Groove", cx: "16.0001", cy: "16", r: "13.3333", stroke: "currentColor", strokeOpacity: "0.1", strokeWidth: strokeWidth }), jsx("path", { className: "squid-animated-loader-dash", d: "M16,2.66666 A13.3334,13.3334 0 0,1 16,29.3334", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round" })] })] })));
|
|
2809
2789
|
}
|
|
2810
2790
|
|
|
2811
2791
|
function NotAllowedIcon() {
|
|
@@ -2859,7 +2839,7 @@ function renderIcon(status, variant) {
|
|
|
2859
2839
|
return jsx(NotAllowedIcon, {});
|
|
2860
2840
|
case 'ongoing':
|
|
2861
2841
|
const size = { full: '20', compact: '16' }[variant];
|
|
2862
|
-
return jsx(Loader, { size: size, strokeWidth: "
|
|
2842
|
+
return jsx(Loader, { size: size, strokeWidth: "4" });
|
|
2863
2843
|
case 'waiting':
|
|
2864
2844
|
return jsx(DotGrid1x3HorizontalIcon, {});
|
|
2865
2845
|
case 'warning':
|
|
@@ -3075,92 +3055,6 @@ const themeTypesKeys = {
|
|
|
3075
3055
|
},
|
|
3076
3056
|
};
|
|
3077
3057
|
|
|
3078
|
-
function PlusIcon() {
|
|
3079
|
-
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
3080
|
-
}
|
|
3081
|
-
|
|
3082
|
-
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
3083
|
-
const themeKeyVariantMap = {
|
|
3084
|
-
primary: 'grey-800',
|
|
3085
|
-
accent: 'royal-500',
|
|
3086
|
-
};
|
|
3087
|
-
const buttonTextClassNameMap = {
|
|
3088
|
-
primary: 'tw-text-grey-300',
|
|
3089
|
-
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
3090
|
-
};
|
|
3091
|
-
const emptyChainIconTextClassNameMap = {
|
|
3092
|
-
primary: 'tw-text-grey-100',
|
|
3093
|
-
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
3094
|
-
};
|
|
3095
|
-
function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, }) {
|
|
3096
|
-
var _a;
|
|
3097
|
-
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
3098
|
-
const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
|
|
3099
|
-
const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
|
|
3100
|
-
const bgGradient = useMemo(() => {
|
|
3101
|
-
if (!chain || isLoading) {
|
|
3102
|
-
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
3103
|
-
}
|
|
3104
|
-
if (!token) {
|
|
3105
|
-
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
3106
|
-
}
|
|
3107
|
-
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
3108
|
-
}, [chainBgColor, tokenBgColor, chain, token, isLoading]);
|
|
3109
|
-
const ButtonTag = isLoading ? 'div' : 'button';
|
|
3110
|
-
return (jsxs(ButtonTag, { onClick: isLoading ? undefined : onClick, disabled: isLoading, "aria-disabled": isLoading, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant], isLoading && 'tw-cursor-not-allowed'), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between', chain && token && !isLoading
|
|
3111
|
-
? 'tw-w-[90px]'
|
|
3112
|
-
: 'tw-w-full tw-max-w-[72px]'), style: {
|
|
3113
|
-
backgroundImage: bgGradient,
|
|
3114
|
-
}, children: jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
3115
|
-
backgroundColor: tokenBgColor,
|
|
3116
|
-
} }), jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && !isLoading && 'tw-pl-[7px]'), style: {
|
|
3117
|
-
backgroundColor: tokenBgColor,
|
|
3118
|
-
color: token === null || token === void 0 ? void 0 : token.textColor,
|
|
3119
|
-
}, children: [jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
|
|
3120
|
-
? token.symbol
|
|
3121
|
-
: !isLoading && 'Select token' }), !isLoading && jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
|
|
3122
|
-
}
|
|
3123
|
-
|
|
3124
|
-
const CSS_VARS = {
|
|
3125
|
-
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
3126
|
-
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
3127
|
-
COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
|
|
3128
|
-
EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
|
|
3129
|
-
FADE_IN_DURATION: '--squid-animation-fade-in-duration',
|
|
3130
|
-
FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
|
|
3131
|
-
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
3132
|
-
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
3133
|
-
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
3134
|
-
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
3135
|
-
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
3136
|
-
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
3137
|
-
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
3138
|
-
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
3139
|
-
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
3140
|
-
};
|
|
3141
|
-
const ANIMATION_DURATIONS = {
|
|
3142
|
-
SHOW_ROUTE: 300,
|
|
3143
|
-
HIDE_ROUTE: 300,
|
|
3144
|
-
CHANGE_SWAP_STEP: 300,
|
|
3145
|
-
SHOW_MODAL: 400,
|
|
3146
|
-
HIDE_MODAL: 400,
|
|
3147
|
-
BOOST_BUTTON: 500,
|
|
3148
|
-
};
|
|
3149
|
-
const ANIMATION_TIMINGS = {
|
|
3150
|
-
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
3151
|
-
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
3152
|
-
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
3153
|
-
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
3154
|
-
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
3155
|
-
};
|
|
3156
|
-
const MEDIA_QUERIES = {
|
|
3157
|
-
MOBILE_LG: {
|
|
3158
|
-
media: '(min-width: 480px)',
|
|
3159
|
-
key: 'mobile-lg',
|
|
3160
|
-
value: '480px',
|
|
3161
|
-
},
|
|
3162
|
-
};
|
|
3163
|
-
|
|
3164
3058
|
function SearchIcon() {
|
|
3165
3059
|
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M20 20L16.05 16.05M18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
3166
3060
|
}
|
|
@@ -16721,12 +16615,73 @@ AppContainer.Content = (props) => (jsx(motion.div, Object.assign({ transformTemp
|
|
|
16721
16615
|
}, layout: "position", layoutDependency: useContext(LayoutDependencyContext), layoutId: "app-container-content" }, props)));
|
|
16722
16616
|
const elementKey = (child) => isValidElement(child) ? child.key : null;
|
|
16723
16617
|
|
|
16618
|
+
const CSS_VARS = {
|
|
16619
|
+
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
16620
|
+
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
16621
|
+
COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
|
|
16622
|
+
EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
|
|
16623
|
+
FADE_IN_DURATION: '--squid-animation-fade-in-duration',
|
|
16624
|
+
FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
|
|
16625
|
+
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
16626
|
+
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
16627
|
+
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
16628
|
+
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
16629
|
+
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
16630
|
+
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
16631
|
+
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
16632
|
+
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
16633
|
+
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
16634
|
+
};
|
|
16635
|
+
const ANIMATION_DURATIONS = {
|
|
16636
|
+
SHOW_ROUTE: 300,
|
|
16637
|
+
HIDE_ROUTE: 300,
|
|
16638
|
+
CHANGE_SWAP_STEP: 300,
|
|
16639
|
+
SHOW_MODAL: 400,
|
|
16640
|
+
HIDE_MODAL: 400,
|
|
16641
|
+
BOOST_BUTTON: 500,
|
|
16642
|
+
};
|
|
16643
|
+
const ANIMATION_TIMINGS = {
|
|
16644
|
+
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
16645
|
+
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
16646
|
+
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
16647
|
+
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
16648
|
+
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
16649
|
+
};
|
|
16650
|
+
const MEDIA_QUERIES = {
|
|
16651
|
+
MOBILE_LG: {
|
|
16652
|
+
media: '(min-width: 480px)',
|
|
16653
|
+
key: 'mobile-lg',
|
|
16654
|
+
value: '480px',
|
|
16655
|
+
},
|
|
16656
|
+
};
|
|
16657
|
+
|
|
16658
|
+
function BoostButton({ boostMode, canToggleBoostMode = true, boostIndicatorRef, }) {
|
|
16659
|
+
return (jsx("div", { className: "tw-w-[106.5px] tw-pr-squid-xxs mobile-lg:tw-w-[140px]", children: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-full 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 &&
|
|
16660
|
+
'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 &&
|
|
16661
|
+
'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-relative -tw-left-[20px] tw-flex tw-h-full tw-w-[140px] 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 mobile-lg:-tw-left-[3px]", children: [jsx("div", { className: "tw-w-[70px] 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-[70px] 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: {
|
|
16662
|
+
boxShadow: generateMarkerLines(40),
|
|
16663
|
+
} })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-2px)] 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: {
|
|
16664
|
+
transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
|
|
16665
|
+
} })] }) }));
|
|
16666
|
+
}
|
|
16667
|
+
function generateMarkerLines(count) {
|
|
16668
|
+
const halfCount = Math.ceil(count / 2);
|
|
16669
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
16670
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
16671
|
+
});
|
|
16672
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
16673
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
16674
|
+
});
|
|
16675
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
16676
|
+
return allShadows.join(', ');
|
|
16677
|
+
}
|
|
16678
|
+
|
|
16724
16679
|
function Chip(_a) {
|
|
16725
16680
|
var { label, icon } = _a, props = __rest$1(_a, ["label", "icon"]);
|
|
16726
16681
|
return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-text-nowrap tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
16727
16682
|
}
|
|
16728
16683
|
|
|
16729
|
-
function Boost({ boostMode, onToggleBoostMode, estimatedTime,
|
|
16684
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, canToggleBoostMode = true, tooltip, }) {
|
|
16730
16685
|
const boostIndicatorRef = useRef(null);
|
|
16731
16686
|
function handleToggleBoostMode() {
|
|
16732
16687
|
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
@@ -16743,9 +16698,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
|
|
|
16743
16698
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
16744
16699
|
}
|
|
16745
16700
|
}
|
|
16746
|
-
return (jsx(
|
|
16701
|
+
return (jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-w-[157px] mobile-lg:tw-w-[190px] tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: cn('tw-group/boost-toggle tw-flex tw-h-squid-xl tw-w-full tw-items-center 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, canToggleBoostMode: canToggleBoostMode }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
16747
16702
|
? 'tw-bg-grey-300'
|
|
16748
|
-
: 'tw-bg-status-positive') })] }) }));
|
|
16703
|
+
: 'tw-bg-status-positive') })] }) })));
|
|
16749
16704
|
}
|
|
16750
16705
|
|
|
16751
16706
|
function Join({ children, glue }) {
|
|
@@ -16857,8 +16812,8 @@ function EthereumIcon() {
|
|
|
16857
16812
|
}
|
|
16858
16813
|
|
|
16859
16814
|
function FeeButton(_a) {
|
|
16860
|
-
var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className"]);
|
|
16861
|
-
return (jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
|
|
16815
|
+
var { feeInUsd = '0', chipLabel = 'Fee', className, tooltip } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className", "tooltip"]);
|
|
16816
|
+
return (jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })) })));
|
|
16862
16817
|
}
|
|
16863
16818
|
|
|
16864
16819
|
function EmojiSadIcon({ className, size = '20', }) {
|
|
@@ -16878,7 +16833,8 @@ const detailStateClassMap = {
|
|
|
16878
16833
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
16879
16834
|
full: '',
|
|
16880
16835
|
};
|
|
16881
|
-
function DetailsToolbar({ errorMessage,
|
|
16836
|
+
function DetailsToolbar({ errorMessage, estimatedTime, helpButton, isLoading, isEmpty, flipButton, feeButton, boostButton, }) {
|
|
16837
|
+
var _a;
|
|
16882
16838
|
const state = useMemo(() => {
|
|
16883
16839
|
if (errorMessage)
|
|
16884
16840
|
return 'error';
|
|
@@ -16891,10 +16847,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
16891
16847
|
const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
|
|
16892
16848
|
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-full tw-items-center tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500 mobile-lg:tw-w-card-large', state === 'error'
|
|
16893
16849
|
? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
|
|
16894
|
-
: 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {
|
|
16895
|
-
|
|
16896
|
-
: undefined, tooltipWidth: "max", displayDelayMs: flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltipDisplayDelayMs, children: jsx("button", { disabled: flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled, 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', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
|
|
16897
|
-
'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 }) })] })) }));
|
|
16850
|
+
: 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, Object.assign({}, feeButton)) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, Object.assign({}, flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltip, { tooltipWidth: "max", containerClassName: "tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsx("button", { disabled: flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled, onClick: flipButton === null || flipButton === void 0 ? void 0 : flipButton.onClick, 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', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
|
|
16851
|
+
'group-hover/flip-button:tw-rotate-180') }) }) }))) }), jsx("div", { className: detailClassName, children: jsx(Boost, { tooltip: boostButton === null || boostButton === void 0 ? void 0 : boostButton.tooltip, estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: (_a = boostButton === null || boostButton === void 0 ? void 0 : boostButton.boostMode) !== null && _a !== void 0 ? _a : 'normal', onToggleBoostMode: boostButton === null || boostButton === void 0 ? void 0 : boostButton.onClick, canToggleBoostMode: state === 'loading' ? false : boostButton === null || boostButton === void 0 ? void 0 : boostButton.canToggleBoostMode }) })] })) }));
|
|
16898
16852
|
}
|
|
16899
16853
|
|
|
16900
16854
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -16997,7 +16951,7 @@ const dropdownPositionClassMap = {
|
|
|
16997
16951
|
const statusBadge = {
|
|
16998
16952
|
completed: {},
|
|
16999
16953
|
pending: {
|
|
17000
|
-
badge: jsx(Loader, { size: "16", strokeWidth: "
|
|
16954
|
+
badge: jsx(Loader, { size: "16", strokeWidth: "4" }),
|
|
17001
16955
|
containerClassName: 'tw-bg-royal-400',
|
|
17002
16956
|
},
|
|
17003
16957
|
failed: {
|
|
@@ -17232,7 +17186,7 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
17232
17186
|
case 'pending':
|
|
17233
17187
|
return null;
|
|
17234
17188
|
case 'ongoing':
|
|
17235
|
-
return jsx(Loader, { size: "16", strokeWidth: "
|
|
17189
|
+
return jsx(Loader, { size: "16", strokeWidth: "4" });
|
|
17236
17190
|
default:
|
|
17237
17191
|
return null;
|
|
17238
17192
|
}
|
|
@@ -17248,7 +17202,7 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
17248
17202
|
return (jsx("li", { style: {
|
|
17249
17203
|
maxHeight: `${STEP_ITEM_HEIGHT}px`,
|
|
17250
17204
|
minHeight: `${STEP_ITEM_HEIGHT}px`,
|
|
17251
|
-
}, className: "
|
|
17205
|
+
}, className: "tw-relative tw-flex tw-w-list-item-compact tw-flex-col tw-items-start tw-justify-center tw-text-grey-300 tw-transition-colors tw-duration-1000 mobile-lg:tw-w-list-item-large", children: jsxs("a", { href: link, target: "_blank", style: Object.assign(Object.assign({}, transitionStyle), { maxHeight: `${STEP_ITEM_HEIGHT}px` }), className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs tw-py-squid-xxs', !!link && 'hover:tw-bg-material-light-thin', statusTextClass), children: [jsxs("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: [jsx(Chip, { style: transitionStyle, className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: chipContent }), showStepSeparator && (jsx("span", { className: cn(separatorClassMap[status], 'tw-absolute tw-left-0 tw-top-full tw-mt-0.5'), style: transitionStyle, children: jsx(SwapStepSeparator, {}) }))] }), jsx(DescriptionBlocks, { className: "tw-min-h-squid-l tw-py-squid-xxs tw-pr-squid-xs", blocks: descriptionBlocks })] }) }));
|
|
17252
17206
|
}
|
|
17253
17207
|
|
|
17254
17208
|
function Timeline(_a) {
|
|
@@ -17305,7 +17259,7 @@ function renderStatusIcon(status, defaultIcon) {
|
|
|
17305
17259
|
case 'error':
|
|
17306
17260
|
return jsx(EmojiSadIcon, { className: "tw-text-status-negative" });
|
|
17307
17261
|
case 'ongoing':
|
|
17308
|
-
return (jsx(Loader, { className: statusTextClassMap.ongoing, strokeWidth: "
|
|
17262
|
+
return (jsx(Loader, { className: statusTextClassMap.ongoing, strokeWidth: "4", size: "20" }));
|
|
17309
17263
|
case 'waiting':
|
|
17310
17264
|
return jsx(TransactionState, { status: "waiting", variant: "compact" });
|
|
17311
17265
|
case 'warning':
|
|
@@ -17513,11 +17467,11 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
|
|
|
17513
17467
|
? 'tw-px-squid-m'
|
|
17514
17468
|
: 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsx(Button$1, { className: displayButtonShadows
|
|
17515
17469
|
? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
|
|
17516
|
-
: undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17470
|
+
: undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsx(Tooltip, Object.assign({}, action.tooltip, { childrenClassName: "tw-rounded-squid-m", containerClassName: "tw-rounded-squid-m", tooltipWidth: "max", children: jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
|
|
17471
|
+
? action.labelOrIcon
|
|
17472
|
+
: undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
|
|
17473
|
+
? null
|
|
17474
|
+
: action.labelOrIcon, onClick: action.onClick }) }), action.id))) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-m tw-py-squid-xxs mobile-lg:tw-px-squid-l", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
|
|
17521
17475
|
}
|
|
17522
17476
|
|
|
17523
17477
|
const createStoreImpl = (createState) => {
|
|
@@ -18106,21 +18060,27 @@ function LogoContainer({ children }) {
|
|
|
18106
18060
|
return (jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
|
|
18107
18061
|
}
|
|
18108
18062
|
|
|
18109
|
-
function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange,
|
|
18110
|
-
var _a, _b;
|
|
18111
|
-
const isWalletButtonInteractive = !isLoading && !!
|
|
18063
|
+
function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, maxUsdDecimals, isInputInteractive = true, isLoading = false, inputModeButton, balanceButton, assetsButton, walletButton, }) {
|
|
18064
|
+
var _a, _b, _c;
|
|
18065
|
+
const isWalletButtonInteractive = !isLoading && !!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick);
|
|
18112
18066
|
const WalletButtonTag = isWalletButtonInteractive ? 'button' : 'div';
|
|
18113
18067
|
const isFetching = isFetchingProp || isLoading;
|
|
18114
|
-
return (jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-
|
|
18115
|
-
|
|
18116
|
-
|
|
18068
|
+
return (jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsx(Tooltip, Object.assign({}, walletButton === null || walletButton === void 0 ? void 0 : walletButton.tooltip, { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(WalletButtonTag, { onClick: isWalletButtonInteractive ? walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick : undefined, className: cn('-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600', isWalletButtonInteractive && 'hover:tw-bg-material-light-thin', isLoading && 'tw-opacity-50'), children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), !isLoading && (jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18069
|
+
? 'tw-text-grey-300'
|
|
18070
|
+
: 'tw-text-royal-400', children: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18071
|
+
? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
|
|
18072
|
+
: (_a = walletButton === null || walletButton === void 0 ? void 0 : walletButton.emptyAddressLabel) !== null && _a !== void 0 ? _a : 'Connect wallet' }), jsx(ChevronArrowIcon, { className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18073
|
+
? 'tw-text-grey-600'
|
|
18074
|
+
: 'tw-text-royal-400' })] }))] }) })) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
|
|
18075
|
+
decimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18,
|
|
18076
|
+
symbol: (_c = token === null || token === void 0 ? void 0 : token.symbol) !== null && _c !== void 0 ? _c : '',
|
|
18117
18077
|
price: tokenPrice,
|
|
18118
18078
|
}, onAmountChange: (value) => {
|
|
18119
18079
|
onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value);
|
|
18120
18080
|
}, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
|
|
18121
18081
|
token: '0.001',
|
|
18122
18082
|
usd: '0.01',
|
|
18123
|
-
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount,
|
|
18083
|
+
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading })] }));
|
|
18124
18084
|
}
|
|
18125
18085
|
|
|
18126
18086
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -18179,7 +18139,7 @@ const SwapStepsCollapsed = forwardRef((props, ref) => {
|
|
|
18179
18139
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
18180
18140
|
}
|
|
18181
18141
|
};
|
|
18182
|
-
return (jsx("div", { className: "
|
|
18142
|
+
return (jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-modal-compact tw-rounded-squid-l mobile-lg:tw-min-w-modal-large", children: jsx("div", { className: cn('tw-absolute tw-bottom-0 tw-z-10 tw-flex tw-w-full tw-max-w-modal-compact tw-flex-col tw-justify-end tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l mobile-lg:tw-max-w-modal-large', isRouteVisible ? 'tw-h-[535px]' : 'tw-h-[60px]'), children: jsxs("div", { className: "tw-flex tw-flex-col tw-justify-end", children: [!isRouteVisible && (jsxs(Fragment, { children: [jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" }), jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" })] })), jsx("div", { onClick: handleToggleRouteSteps, style: {
|
|
18183
18143
|
[CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
18184
18144
|
[CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
18185
18145
|
}, className: cn('tw-absolute tw-top-0 tw-h-[535px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-backdrop-blur/10 ', isShowRouteAnimationRunning
|
|
@@ -18196,7 +18156,7 @@ const SwapStepsCollapsed = forwardRef((props, ref) => {
|
|
|
18196
18156
|
: 'tw-animate-collapse-route')), children: jsxs("div", { className: cn('tw-flex tw-flex-col tw-gap-squid-xxs', isRouteVisible || isShowRouteAnimationRunning
|
|
18197
18157
|
? 'tw-max-h-[535px]'
|
|
18198
18158
|
: ''), style: {
|
|
18199
|
-
paddingTop: `${STEP_ITEM_HEIGHT}px`,
|
|
18159
|
+
paddingTop: `${STEP_ITEM_HEIGHT / 2}px`,
|
|
18200
18160
|
transition: isShowRouteAnimationRunning
|
|
18201
18161
|
? `transform ${ANIMATION_DURATIONS.SHOW_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
18202
18162
|
: isRouteVisible
|
|
@@ -18205,13 +18165,10 @@ const SwapStepsCollapsed = forwardRef((props, ref) => {
|
|
|
18205
18165
|
transform: isShowRouteAnimationRunning
|
|
18206
18166
|
? 'translateY(0)'
|
|
18207
18167
|
: `translateY(calc(-100% + 69px + ${(newStepIndex + 1) * STEP_ITEM_HEIGHT}px))`,
|
|
18208
|
-
}, children: [jsx("
|
|
18209
|
-
display: isRouteVisible ? 'flex' : 'none',
|
|
18210
|
-
height: `${STEP_ITEM_HEIGHT}px`,
|
|
18211
|
-
}, className: cn('tw-absolute tw-top-0 tw-z-10 tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-grey-800 tw-p-squid-xs'), children: jsx("button", { onClick: handleToggleRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { ref: routeStepsListRef, style: {
|
|
18168
|
+
}, children: [jsx("ul", { ref: routeStepsListRef, style: {
|
|
18212
18169
|
zIndex: isRouteVisible ? 0 : -10,
|
|
18213
18170
|
scrollbarWidth: 'none',
|
|
18214
|
-
}, className: "
|
|
18171
|
+
}, className: "tw-relative tw-flex tw-w-modal-compact tw-flex-1 tw-grow-0 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs tw-pb-squid-xxs mobile-lg:tw-w-modal-large", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks,
|
|
18215
18172
|
// show separator for all steps except the first one
|
|
18216
18173
|
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? 'pending' : step.status }, index))) }), jsx("footer", { className: "tw-flex tw-max-h-[55px] tw-min-h-[55px] tw-w-full tw-justify-center tw-gap-squid-xs tw-self-stretch tw-px-squid-s tw-pb-squid-s", children: jsx(Button$1, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full" }) })] }) })] }) }) }));
|
|
18217
18174
|
});
|
|
@@ -24228,11 +24185,159 @@ function Toast({ headerContent, actionsContent, description, chipLabel, title, }
|
|
|
24228
24185
|
return (jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", contentWrapperClassName: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs", rounded: "sm", children: [headerContent, jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
|
|
24229
24186
|
}
|
|
24230
24187
|
|
|
24188
|
+
const gapBetweenTooltipAndContainer = 10;
|
|
24189
|
+
const tooltipWidthClassMap = {
|
|
24190
|
+
max: 'tw-w-max',
|
|
24191
|
+
container: 'tw-w-full',
|
|
24192
|
+
};
|
|
24193
|
+
const tooltipThresholdPaddingMap = {
|
|
24194
|
+
xxs: '5px',
|
|
24195
|
+
xs: '10px',
|
|
24196
|
+
s: '15px',
|
|
24197
|
+
m: '20px',
|
|
24198
|
+
l: '30px',
|
|
24199
|
+
xl: '40px',
|
|
24200
|
+
xxl: '60px',
|
|
24201
|
+
};
|
|
24202
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: containerRefProp, }) {
|
|
24203
|
+
const containerRefState = useContainerStore((state) => state.containerRef);
|
|
24204
|
+
const containerRef = (containerRefProp === null || containerRefProp === void 0 ? void 0 : containerRefProp.current)
|
|
24205
|
+
? containerRefProp
|
|
24206
|
+
: containerRefState;
|
|
24207
|
+
const [tooltipPositionStyle, setTooltipPositionStyle] = useState({});
|
|
24208
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
24209
|
+
const [isTooltipVisibleDelayed, setIsTooltipVisibleDelayed] = useState(false);
|
|
24210
|
+
const tooltipRef = useRef(null);
|
|
24211
|
+
const tooltipTriggerRef = useRef(null);
|
|
24212
|
+
const delayTimeoutRef = useRef(null);
|
|
24213
|
+
useEffect(() => {
|
|
24214
|
+
const adjustTooltipPosition = () => {
|
|
24215
|
+
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
24216
|
+
!tooltipRef.current ||
|
|
24217
|
+
!tooltipTriggerRef.current) {
|
|
24218
|
+
// if any of the refs is not defined, we can't calculate the position
|
|
24219
|
+
// so we just try to center the tooltip
|
|
24220
|
+
return setTooltipPositionStyle({
|
|
24221
|
+
bottom: '100%',
|
|
24222
|
+
left: '50%',
|
|
24223
|
+
transform: 'translateX(-50%)',
|
|
24224
|
+
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24225
|
+
});
|
|
24226
|
+
}
|
|
24227
|
+
// get the bounding rects of the container, tooltip and trigger
|
|
24228
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
24229
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
24230
|
+
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
24231
|
+
// check if the tooltip fits below the trigger
|
|
24232
|
+
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
24233
|
+
// check if the tooltip fits above the trigger
|
|
24234
|
+
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
24235
|
+
// get the y position of the center of the tooltip trigger
|
|
24236
|
+
const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
|
|
24237
|
+
// get the x position of the center of the tooltip trigger
|
|
24238
|
+
const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
|
|
24239
|
+
let tooltipYPosition = 'top';
|
|
24240
|
+
if (tooltipFitsAbove) {
|
|
24241
|
+
tooltipYPosition = 'top';
|
|
24242
|
+
}
|
|
24243
|
+
else if (tooltipFitsBelow) {
|
|
24244
|
+
tooltipYPosition = 'bottom';
|
|
24245
|
+
}
|
|
24246
|
+
else if (
|
|
24247
|
+
// if the tooltip doesn't fit above or below the trigger,
|
|
24248
|
+
// we just place it where there's more space available
|
|
24249
|
+
triggerMiddleY - containerRect.top >
|
|
24250
|
+
containerRect.bottom - triggerMiddleY) {
|
|
24251
|
+
tooltipYPosition = 'top';
|
|
24252
|
+
}
|
|
24253
|
+
else {
|
|
24254
|
+
tooltipYPosition = 'bottom';
|
|
24255
|
+
}
|
|
24256
|
+
const top = tooltipYPosition === 'top'
|
|
24257
|
+
? -tooltipRect.height
|
|
24258
|
+
: tooltipTriggerRect.height;
|
|
24259
|
+
const paddingStyles = tooltipYPosition === 'top'
|
|
24260
|
+
? {
|
|
24261
|
+
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24262
|
+
}
|
|
24263
|
+
: {
|
|
24264
|
+
paddingTop: tooltipThresholdPaddingMap[threshold],
|
|
24265
|
+
};
|
|
24266
|
+
let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
24267
|
+
const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
|
|
24268
|
+
const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
|
|
24269
|
+
const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
|
|
24270
|
+
const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
|
|
24271
|
+
// if the tooltip is too far to the left, we need to move it to the right the amount of pixels overflowing the container + the gap between the tooltip and the container
|
|
24272
|
+
if (tooltipOverflowsContainerLeft) {
|
|
24273
|
+
left =
|
|
24274
|
+
-(tooltipTriggerRect.left - containerRect.left) +
|
|
24275
|
+
gapBetweenTooltipAndContainer;
|
|
24276
|
+
}
|
|
24277
|
+
else if (tooltipOverflowsContainerRight) {
|
|
24278
|
+
left =
|
|
24279
|
+
-(containerRect.right - tooltipTriggerRect.right) +
|
|
24280
|
+
gapBetweenTooltipAndContainer;
|
|
24281
|
+
}
|
|
24282
|
+
setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
|
|
24283
|
+
? { left }
|
|
24284
|
+
: tooltipOverflowsContainerRight
|
|
24285
|
+
? { right: left }
|
|
24286
|
+
: // if the tooltip doesn't overflow the container, we just center it
|
|
24287
|
+
{
|
|
24288
|
+
left: '50%',
|
|
24289
|
+
transform: 'translateX(-50%)',
|
|
24290
|
+
})), paddingStyles));
|
|
24291
|
+
};
|
|
24292
|
+
adjustTooltipPosition();
|
|
24293
|
+
const timeoutId = setTimeout(() => {
|
|
24294
|
+
adjustTooltipPosition();
|
|
24295
|
+
}, 300);
|
|
24296
|
+
window.addEventListener('resize', adjustTooltipPosition);
|
|
24297
|
+
return () => {
|
|
24298
|
+
clearTimeout(timeoutId);
|
|
24299
|
+
window.removeEventListener('resize', adjustTooltipPosition);
|
|
24300
|
+
};
|
|
24301
|
+
}, [
|
|
24302
|
+
containerRef,
|
|
24303
|
+
tooltipContent,
|
|
24304
|
+
threshold,
|
|
24305
|
+
tooltipWidth,
|
|
24306
|
+
displayDelayMs,
|
|
24307
|
+
isTooltipVisible,
|
|
24308
|
+
]);
|
|
24309
|
+
const handleMouseEnter = useCallback((e) => {
|
|
24310
|
+
var _a;
|
|
24311
|
+
if (e.target === tooltipRef.current ||
|
|
24312
|
+
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
24313
|
+
return;
|
|
24314
|
+
}
|
|
24315
|
+
setIsTooltipVisible(true);
|
|
24316
|
+
if (delayTimeoutRef.current) {
|
|
24317
|
+
clearTimeout(delayTimeoutRef.current);
|
|
24318
|
+
}
|
|
24319
|
+
delayTimeoutRef.current = setTimeout(() => {
|
|
24320
|
+
setIsTooltipVisibleDelayed(true);
|
|
24321
|
+
}, displayDelayMs);
|
|
24322
|
+
}, [displayDelayMs, tooltipRef, delayTimeoutRef]);
|
|
24323
|
+
const handleMouseLeave = useCallback(() => {
|
|
24324
|
+
setIsTooltipVisible(false);
|
|
24325
|
+
setIsTooltipVisibleDelayed(false);
|
|
24326
|
+
if (delayTimeoutRef.current) {
|
|
24327
|
+
clearTimeout(delayTimeoutRef.current);
|
|
24328
|
+
}
|
|
24329
|
+
}, [delayTimeoutRef]);
|
|
24330
|
+
return (jsxs("div", { className: cn('tw-relative', containerClassName), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [jsx("div", { ref: tooltipTriggerRef, className: childrenClassName, children: children }), tooltipContent ? (jsx(Menu, { style: tooltipPositionStyle, menuRef: tooltipRef, containerClassName: cn('tw-absolute tw-flex tw-items-center tw-justify-center', isTooltipVisibleDelayed
|
|
24331
|
+
? '!tw-opacity-100 tw-z-40 tw-visible'
|
|
24332
|
+
: 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none tw-invisible', tooltipWidthClassMap[tooltipWidth], tooltipClassName), children: tooltipContent })) : null] }));
|
|
24333
|
+
}
|
|
24334
|
+
|
|
24231
24335
|
const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
|
|
24232
24336
|
// checks that the value includes at least one character different than `0` (zero), or `.` (dot)
|
|
24233
24337
|
const RegExpNonZeroValue = /[^0.]/;
|
|
24234
24338
|
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
24235
|
-
const
|
|
24339
|
+
const notInteractiveChipClassName = 'tw-cursor-not-allowed';
|
|
24340
|
+
const loadingClassName = 'tw-opacity-50';
|
|
24236
24341
|
var InputMode;
|
|
24237
24342
|
(function (InputMode) {
|
|
24238
24343
|
InputMode[InputMode["TOKEN"] = 0] = "TOKEN";
|
|
@@ -24241,7 +24346,7 @@ var InputMode;
|
|
|
24241
24346
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24242
24347
|
token: '0.001',
|
|
24243
24348
|
usd: '0.01',
|
|
24244
|
-
}, showDetails = true, isLoading = false, direction,
|
|
24349
|
+
}, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, }) {
|
|
24245
24350
|
var _a;
|
|
24246
24351
|
const [inputValue, setInputValue] = useState('');
|
|
24247
24352
|
const [inputMode, setInputMode] = useState(InputMode.TOKEN);
|
|
@@ -24339,6 +24444,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24339
24444
|
};
|
|
24340
24445
|
const { isTokenAmountVerySmall, isUsdAmountVerySmall } = getRawAmounts(inputValue);
|
|
24341
24446
|
const amountFormatted = useMemo(() => {
|
|
24447
|
+
var _a;
|
|
24342
24448
|
if (inputValue === '')
|
|
24343
24449
|
return '0';
|
|
24344
24450
|
if (inputMode === InputMode.TOKEN) {
|
|
@@ -24346,13 +24452,19 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24346
24452
|
return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
|
|
24347
24453
|
}
|
|
24348
24454
|
else {
|
|
24349
|
-
return formatAmount(amountUsd !== null &&
|
|
24455
|
+
return formatAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : '0');
|
|
24350
24456
|
}
|
|
24351
24457
|
}
|
|
24352
24458
|
else {
|
|
24353
24459
|
return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
24354
24460
|
}
|
|
24355
|
-
}, [
|
|
24461
|
+
}, [
|
|
24462
|
+
inputValue,
|
|
24463
|
+
inputMode,
|
|
24464
|
+
token.price,
|
|
24465
|
+
direction,
|
|
24466
|
+
inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
|
|
24467
|
+
]);
|
|
24356
24468
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
24357
24469
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
24358
24470
|
? 'tw-text-status-negative'
|
|
@@ -24363,11 +24475,21 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24363
24475
|
}, [balance]);
|
|
24364
24476
|
return (jsxs(Fragment, { children: [isInteractive && !isLoading ? (jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
|
|
24365
24477
|
e.preventDefault();
|
|
24366
|
-
}, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading &&
|
|
24478
|
+
}, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsx(Tooltip, Object.assign({}, (isLoading
|
|
24479
|
+
? undefined
|
|
24480
|
+
: inputMode === InputMode.TOKEN
|
|
24481
|
+
? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
|
|
24482
|
+
: inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
|
|
24483
|
+
? interactiveChipClassName
|
|
24484
|
+
: notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
|
|
24485
|
+
? formatIfVerySmall.token
|
|
24486
|
+
: amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24367
24487
|
? formatIfVerySmall.token
|
|
24368
|
-
: amountFormatted })
|
|
24369
|
-
|
|
24370
|
-
|
|
24488
|
+
: amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0
|
|
24489
|
+
? 'tw-opacity-0'
|
|
24490
|
+
: '' }), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }) }))), jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
|
|
24491
|
+
? interactiveChipClassName
|
|
24492
|
+
: notInteractiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balanceFormatted }), jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
24371
24493
|
}
|
|
24372
24494
|
|
|
24373
24495
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
@@ -24469,172 +24591,50 @@ function Switch({ checked = false, onChange, size, disabled = false, }) {
|
|
|
24469
24591
|
: 'tw-bg-grey-500') })] }));
|
|
24470
24592
|
}
|
|
24471
24593
|
|
|
24472
|
-
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24594
|
+
function PlusIcon() {
|
|
24595
|
+
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
24596
|
+
}
|
|
24597
|
+
|
|
24598
|
+
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
24599
|
+
const themeKeyVariantMap = {
|
|
24600
|
+
primary: 'grey-800',
|
|
24601
|
+
accent: 'royal-500',
|
|
24476
24602
|
};
|
|
24477
|
-
const
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
s: '15px',
|
|
24481
|
-
m: '20px',
|
|
24482
|
-
l: '30px',
|
|
24483
|
-
xl: '40px',
|
|
24484
|
-
xxl: '60px',
|
|
24603
|
+
const buttonTextClassNameMap = {
|
|
24604
|
+
primary: 'tw-text-grey-300',
|
|
24605
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
24485
24606
|
};
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
const
|
|
24493
|
-
const
|
|
24494
|
-
const
|
|
24495
|
-
const
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
const adjustTooltipPosition = () => {
|
|
24499
|
-
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
24500
|
-
!tooltipRef.current ||
|
|
24501
|
-
!tooltipTriggerRef.current) {
|
|
24502
|
-
// if any of the refs is not defined, we can't calculate the position
|
|
24503
|
-
// so we just try to center the tooltip
|
|
24504
|
-
return setTooltipPositionStyle({
|
|
24505
|
-
bottom: '100%',
|
|
24506
|
-
left: '50%',
|
|
24507
|
-
transform: 'translateX(-50%)',
|
|
24508
|
-
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24509
|
-
});
|
|
24510
|
-
}
|
|
24511
|
-
// get the bounding rects of the container, tooltip and trigger
|
|
24512
|
-
const containerRect = containerRef.current.getBoundingClientRect();
|
|
24513
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
24514
|
-
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
24515
|
-
// check if the tooltip fits below the trigger
|
|
24516
|
-
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
24517
|
-
// check if the tooltip fits above the trigger
|
|
24518
|
-
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
24519
|
-
// get the y position of the center of the tooltip trigger
|
|
24520
|
-
const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
|
|
24521
|
-
// get the x position of the center of the tooltip trigger
|
|
24522
|
-
const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
|
|
24523
|
-
let tooltipYPosition = 'top';
|
|
24524
|
-
if (tooltipFitsAbove) {
|
|
24525
|
-
tooltipYPosition = 'top';
|
|
24526
|
-
}
|
|
24527
|
-
else if (tooltipFitsBelow) {
|
|
24528
|
-
tooltipYPosition = 'bottom';
|
|
24529
|
-
}
|
|
24530
|
-
else if (
|
|
24531
|
-
// if the tooltip doesn't fit above or below the trigger,
|
|
24532
|
-
// we just place it where there's more space available
|
|
24533
|
-
triggerMiddleY - containerRect.top >
|
|
24534
|
-
containerRect.bottom - triggerMiddleY) {
|
|
24535
|
-
tooltipYPosition = 'top';
|
|
24536
|
-
}
|
|
24537
|
-
else {
|
|
24538
|
-
tooltipYPosition = 'bottom';
|
|
24539
|
-
}
|
|
24540
|
-
const top = tooltipYPosition === 'top'
|
|
24541
|
-
? -tooltipRect.height
|
|
24542
|
-
: tooltipTriggerRect.height;
|
|
24543
|
-
const paddingStyles = tooltipYPosition === 'top'
|
|
24544
|
-
? {
|
|
24545
|
-
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24546
|
-
}
|
|
24547
|
-
: {
|
|
24548
|
-
paddingTop: tooltipThresholdPaddingMap[threshold],
|
|
24549
|
-
};
|
|
24550
|
-
let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
24551
|
-
const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
|
|
24552
|
-
const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
|
|
24553
|
-
const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
|
|
24554
|
-
const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
|
|
24555
|
-
// if the tooltip is too far to the left, we need to move it to the right the amount of pixels overflowing the container + the gap between the tooltip and the container
|
|
24556
|
-
if (tooltipOverflowsContainerLeft) {
|
|
24557
|
-
left =
|
|
24558
|
-
-(tooltipTriggerRect.left - containerRect.left) +
|
|
24559
|
-
gapBetweenTooltipAndContainer;
|
|
24560
|
-
}
|
|
24561
|
-
else if (tooltipOverflowsContainerRight) {
|
|
24562
|
-
left =
|
|
24563
|
-
-(containerRect.right - tooltipTriggerRect.right) +
|
|
24564
|
-
gapBetweenTooltipAndContainer;
|
|
24565
|
-
}
|
|
24566
|
-
setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
|
|
24567
|
-
? { left }
|
|
24568
|
-
: tooltipOverflowsContainerRight
|
|
24569
|
-
? { right: left }
|
|
24570
|
-
: // if the tooltip doesn't overflow the container, we just center it
|
|
24571
|
-
{
|
|
24572
|
-
left: '50%',
|
|
24573
|
-
transform: 'translateX(-50%)',
|
|
24574
|
-
})), paddingStyles));
|
|
24575
|
-
};
|
|
24576
|
-
adjustTooltipPosition();
|
|
24577
|
-
const timeoutId = setTimeout(() => {
|
|
24578
|
-
adjustTooltipPosition();
|
|
24579
|
-
}, 300);
|
|
24580
|
-
window.addEventListener('resize', adjustTooltipPosition);
|
|
24581
|
-
return () => {
|
|
24582
|
-
clearTimeout(timeoutId);
|
|
24583
|
-
window.removeEventListener('resize', adjustTooltipPosition);
|
|
24584
|
-
};
|
|
24585
|
-
}, [
|
|
24586
|
-
containerRef,
|
|
24587
|
-
tooltipContent,
|
|
24588
|
-
threshold,
|
|
24589
|
-
tooltipWidth,
|
|
24590
|
-
displayDelayMs,
|
|
24591
|
-
isTooltipVisible,
|
|
24592
|
-
]);
|
|
24593
|
-
const handleMouseEnter = useCallback((e) => {
|
|
24594
|
-
var _a;
|
|
24595
|
-
if (e.target === tooltipRef.current ||
|
|
24596
|
-
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
24597
|
-
return;
|
|
24598
|
-
}
|
|
24599
|
-
setIsTooltipVisible(true);
|
|
24600
|
-
if (delayTimeoutRef.current) {
|
|
24601
|
-
clearTimeout(delayTimeoutRef.current);
|
|
24607
|
+
const emptyChainIconTextClassNameMap = {
|
|
24608
|
+
primary: 'tw-text-grey-100',
|
|
24609
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
24610
|
+
};
|
|
24611
|
+
function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, tooltip, }) {
|
|
24612
|
+
var _a;
|
|
24613
|
+
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
24614
|
+
const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
|
|
24615
|
+
const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
|
|
24616
|
+
const bgGradient = useMemo(() => {
|
|
24617
|
+
if (!chain || isLoading) {
|
|
24618
|
+
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
24602
24619
|
}
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
}, displayDelayMs);
|
|
24606
|
-
}, [displayDelayMs, tooltipRef, delayTimeoutRef]);
|
|
24607
|
-
const handleMouseLeave = useCallback(() => {
|
|
24608
|
-
setIsTooltipVisible(false);
|
|
24609
|
-
setIsTooltipVisibleDelayed(false);
|
|
24610
|
-
if (delayTimeoutRef.current) {
|
|
24611
|
-
clearTimeout(delayTimeoutRef.current);
|
|
24620
|
+
if (!token) {
|
|
24621
|
+
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
24612
24622
|
}
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
}
|
|
24628
|
-
function generateMarkerLines(count) {
|
|
24629
|
-
const halfCount = Math.ceil(count / 2);
|
|
24630
|
-
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
24631
|
-
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
24632
|
-
});
|
|
24633
|
-
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
24634
|
-
return `${(index + 1) * 6}px 0 currentColor`;
|
|
24635
|
-
});
|
|
24636
|
-
const allShadows = [...rightShadows, ...leftShadows];
|
|
24637
|
-
return allShadows.join(', ');
|
|
24623
|
+
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
24624
|
+
}, [chainBgColor, tokenBgColor, chain, token, isLoading]);
|
|
24625
|
+
const ButtonTag = isLoading ? 'div' : 'button';
|
|
24626
|
+
return (jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-w-fit", children: jsxs(ButtonTag, { onClick: isLoading ? undefined : onClick, disabled: isLoading, "aria-disabled": isLoading, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant], isLoading && 'tw-cursor-not-allowed'), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between', chain && token && !isLoading
|
|
24627
|
+
? 'tw-w-[90px]'
|
|
24628
|
+
: 'tw-w-full tw-max-w-[72px]'), style: {
|
|
24629
|
+
backgroundImage: bgGradient,
|
|
24630
|
+
}, children: jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
24631
|
+
backgroundColor: tokenBgColor,
|
|
24632
|
+
} }), jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && !isLoading && 'tw-pl-[7px]'), style: {
|
|
24633
|
+
backgroundColor: tokenBgColor,
|
|
24634
|
+
color: token === null || token === void 0 ? void 0 : token.textColor,
|
|
24635
|
+
}, children: [jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
|
|
24636
|
+
? token.symbol
|
|
24637
|
+
: !isLoading && 'Select token' }), !isLoading && jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }) })));
|
|
24638
24638
|
}
|
|
24639
24639
|
|
|
24640
24640
|
function FilterIcon() {
|
|
@@ -24686,10 +24686,16 @@ function MainView({ isLoading }) {
|
|
|
24686
24686
|
{
|
|
24687
24687
|
labelOrIcon: jsx(ClockOutlineIcon, {}),
|
|
24688
24688
|
id: 'history',
|
|
24689
|
+
tooltip: {
|
|
24690
|
+
tooltipContent: 'Swap history',
|
|
24691
|
+
},
|
|
24689
24692
|
},
|
|
24690
24693
|
{
|
|
24691
24694
|
labelOrIcon: jsx(SettingsGearIcon, {}),
|
|
24692
24695
|
id: 'settings',
|
|
24696
|
+
tooltip: {
|
|
24697
|
+
tooltipContent: 'Swap preferences',
|
|
24698
|
+
},
|
|
24693
24699
|
},
|
|
24694
24700
|
] }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
|
|
24695
24701
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
|
|
@@ -24700,11 +24706,45 @@ function MainView({ isLoading }) {
|
|
|
24700
24706
|
bgColor: '#627eea',
|
|
24701
24707
|
textColor: '#fff',
|
|
24702
24708
|
decimals: 18,
|
|
24703
|
-
}, priceImpactPercentage: '0.3', balance: '4.57',
|
|
24709
|
+
}, priceImpactPercentage: '0.3', balance: '4.57', walletButton: {
|
|
24710
|
+
address: 'so-so.eth',
|
|
24711
|
+
onClick: () => { },
|
|
24712
|
+
tooltip: {
|
|
24713
|
+
tooltipContent: 'Connect wallet',
|
|
24714
|
+
},
|
|
24715
|
+
}, assetsButton: {
|
|
24716
|
+
tooltip: {
|
|
24717
|
+
tooltipContent: 'Select token',
|
|
24718
|
+
},
|
|
24719
|
+
}, balanceButton: {
|
|
24720
|
+
tooltip: {
|
|
24721
|
+
tooltipContent: 'Max balance',
|
|
24722
|
+
},
|
|
24723
|
+
}, inputModeButton: {
|
|
24724
|
+
usdModeTooltip: {
|
|
24725
|
+
tooltipContent: 'Enter token amount',
|
|
24726
|
+
},
|
|
24727
|
+
tokenModeTooltip: {
|
|
24728
|
+
tooltipContent: 'Enter in USD',
|
|
24729
|
+
},
|
|
24730
|
+
} }), jsx(DetailsToolbar, { flipButton: {
|
|
24704
24731
|
isDisabled: true,
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24732
|
+
tooltip: {
|
|
24733
|
+
tooltipContent: 'Not enough USDC to flip the swap',
|
|
24734
|
+
displayDelayMs: 0,
|
|
24735
|
+
},
|
|
24736
|
+
}, boostButton: {
|
|
24737
|
+
canToggleBoostMode: false,
|
|
24738
|
+
tooltip: {
|
|
24739
|
+
tooltipContent: 'Boost not supported for this route',
|
|
24740
|
+
},
|
|
24741
|
+
}, feeButton: {
|
|
24742
|
+
feeInUsd: '0.4',
|
|
24743
|
+
onClick: () => { },
|
|
24744
|
+
tooltip: {
|
|
24745
|
+
tooltipContent: 'View fees',
|
|
24746
|
+
},
|
|
24747
|
+
}, isLoading: isLoading, isEmpty: isLoading }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
|
|
24708
24748
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
|
|
24709
24749
|
bgColor: '#e84142',
|
|
24710
24750
|
}, token: {
|
|
@@ -24713,7 +24753,28 @@ function MainView({ isLoading }) {
|
|
|
24713
24753
|
bgColor: '#2775ca',
|
|
24714
24754
|
textColor: '#fff',
|
|
24715
24755
|
decimals: 6,
|
|
24716
|
-
}, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854',
|
|
24756
|
+
}, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', walletButton: {
|
|
24757
|
+
address: 'so-so.eth',
|
|
24758
|
+
onClick: () => { },
|
|
24759
|
+
tooltip: {
|
|
24760
|
+
tooltipContent: 'Connect wallet',
|
|
24761
|
+
},
|
|
24762
|
+
}, amount: isLoading ? undefined : '100', assetsButton: {
|
|
24763
|
+
tooltip: {
|
|
24764
|
+
tooltipContent: 'Select token',
|
|
24765
|
+
},
|
|
24766
|
+
}, balanceButton: {
|
|
24767
|
+
tooltip: {
|
|
24768
|
+
tooltipContent: 'Max balance',
|
|
24769
|
+
},
|
|
24770
|
+
}, inputModeButton: {
|
|
24771
|
+
usdModeTooltip: {
|
|
24772
|
+
tooltipContent: 'Enter token amount',
|
|
24773
|
+
},
|
|
24774
|
+
tokenModeTooltip: {
|
|
24775
|
+
tooltipContent: 'Enter in USD',
|
|
24776
|
+
},
|
|
24777
|
+
} }), jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsx(Button$1, { variant: isLoading ? 'tertiary' : 'primary', size: "lg", label: "Swap", isLoading: isLoading }) })] }));
|
|
24717
24778
|
}
|
|
24718
24779
|
|
|
24719
24780
|
function PunkIcon({ size = '16' }) {
|
|
@@ -59844,7 +59905,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
59844
59905
|
}, secondToken: {
|
|
59845
59906
|
bgColor: toToken.bgColor,
|
|
59846
59907
|
logoURI: toToken.logoUrl,
|
|
59847
|
-
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(PropertyListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(Transfer, { from: jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsx(PropertyListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsx(Transfer, { from: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(PropertyListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsx(PropertyListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsx(Button$1, { size: "lg", variant: "
|
|
59908
|
+
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(PropertyListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(Transfer, { from: jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsx(PropertyListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsx(Transfer, { from: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(PropertyListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsx(PropertyListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsx(Button$1, { size: "lg", variant: "secondary", label: "Close", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsx(Button$1, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }), jsx(Button$1, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsx(Button$1, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }))] }));
|
|
59848
59909
|
}
|
|
59849
59910
|
const TrackTransactionView = forwardRef((props, ref) => {
|
|
59850
59911
|
const { swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, footerButton, } = props;
|