@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/cjs/index.js
CHANGED
|
@@ -2801,31 +2801,11 @@ function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
|
|
|
2801
2801
|
}
|
|
2802
2802
|
|
|
2803
2803
|
function Loader(_a) {
|
|
2804
|
-
var { size = '24', strokeWidth = '
|
|
2805
|
-
return (jsxRuntime.jsxs("svg", Object.assign({
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
@keyframes squid-animated-loader-dash-grow {
|
|
2810
|
-
0% {
|
|
2811
|
-
stroke-dasharray: 10, 5;
|
|
2812
|
-
}
|
|
2813
|
-
100% {
|
|
2814
|
-
stroke-dasharray: 5, 20;
|
|
2815
|
-
}
|
|
2816
|
-
}
|
|
2817
|
-
@keyframes squid-animated-loader-rotate {
|
|
2818
|
-
from {
|
|
2819
|
-
transform: rotate(0deg);
|
|
2820
|
-
}
|
|
2821
|
-
to {
|
|
2822
|
-
transform: rotate(-360deg);
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
.squid-animated-loader {
|
|
2826
|
-
animation: squid-animated-loader-rotate 1s linear infinite;
|
|
2827
|
-
transform-origin: center;
|
|
2828
|
-
}` }), jsxRuntime.jsxs("g", { clipPath: "url(#clip0_1387_2296)", children: [jsxRuntime.jsx("circle", { cx: "7.99967", cy: "8.00004", r: "6.66667", stroke: "currentColor", className: "tw-opacity-10", strokeWidth: strokeWidth }), jsxRuntime.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" })] }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_1387_2296", children: jsxRuntime.jsx("rect", { width: "16", height: "16", fill: "white" }) }) })] })));
|
|
2804
|
+
var { size = '24', strokeWidth = '2', className, rotateDuration = '0.8s' } = _a, props = __rest$1(_a, ["size", "strokeWidth", "className", "rotateDuration"]);
|
|
2805
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ width: size, height: size, viewBox: "0 0 32 32", fill: "none" }, props, { style: {
|
|
2806
|
+
'--squid-loader-rotate-duration': rotateDuration,
|
|
2807
|
+
}, className: cn('squid-animated-loader', className), children: [jsxRuntime.jsx("style", { children: `
|
|
2808
|
+
` }), jsxRuntime.jsxs("g", { id: "Spinner", children: [jsxRuntime.jsx("circle", { id: "Groove", cx: "16.0001", cy: "16", r: "13.3333", stroke: "currentColor", strokeOpacity: "0.1", strokeWidth: strokeWidth }), jsxRuntime.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" })] })] })));
|
|
2829
2809
|
}
|
|
2830
2810
|
|
|
2831
2811
|
function NotAllowedIcon() {
|
|
@@ -2879,7 +2859,7 @@ function renderIcon(status, variant) {
|
|
|
2879
2859
|
return jsxRuntime.jsx(NotAllowedIcon, {});
|
|
2880
2860
|
case 'ongoing':
|
|
2881
2861
|
const size = { full: '20', compact: '16' }[variant];
|
|
2882
|
-
return jsxRuntime.jsx(Loader, { size: size, strokeWidth: "
|
|
2862
|
+
return jsxRuntime.jsx(Loader, { size: size, strokeWidth: "4" });
|
|
2883
2863
|
case 'waiting':
|
|
2884
2864
|
return jsxRuntime.jsx(DotGrid1x3HorizontalIcon, {});
|
|
2885
2865
|
case 'warning':
|
|
@@ -3095,92 +3075,6 @@ const themeTypesKeys = {
|
|
|
3095
3075
|
},
|
|
3096
3076
|
};
|
|
3097
3077
|
|
|
3098
|
-
function PlusIcon() {
|
|
3099
|
-
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
3103
|
-
const themeKeyVariantMap = {
|
|
3104
|
-
primary: 'grey-800',
|
|
3105
|
-
accent: 'royal-500',
|
|
3106
|
-
};
|
|
3107
|
-
const buttonTextClassNameMap = {
|
|
3108
|
-
primary: 'tw-text-grey-300',
|
|
3109
|
-
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
3110
|
-
};
|
|
3111
|
-
const emptyChainIconTextClassNameMap = {
|
|
3112
|
-
primary: 'tw-text-grey-100',
|
|
3113
|
-
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
3114
|
-
};
|
|
3115
|
-
function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, }) {
|
|
3116
|
-
var _a;
|
|
3117
|
-
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
3118
|
-
const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
|
|
3119
|
-
const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
|
|
3120
|
-
const bgGradient = React.useMemo(() => {
|
|
3121
|
-
if (!chain || isLoading) {
|
|
3122
|
-
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
3123
|
-
}
|
|
3124
|
-
if (!token) {
|
|
3125
|
-
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
3126
|
-
}
|
|
3127
|
-
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
3128
|
-
}, [chainBgColor, tokenBgColor, chain, token, isLoading]);
|
|
3129
|
-
const ButtonTag = isLoading ? 'div' : 'button';
|
|
3130
|
-
return (jsxRuntime.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: [jsxRuntime.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: jsxRuntime.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" }) }), jsxRuntime.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
|
|
3131
|
-
? 'tw-w-[90px]'
|
|
3132
|
-
: 'tw-w-full tw-max-w-[72px]'), style: {
|
|
3133
|
-
backgroundImage: bgGradient,
|
|
3134
|
-
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsxRuntime.jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxRuntime.jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
3135
|
-
backgroundColor: tokenBgColor,
|
|
3136
|
-
} }), jsxRuntime.jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsxRuntime.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, jsxRuntime.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: {
|
|
3137
|
-
backgroundColor: tokenBgColor,
|
|
3138
|
-
color: token === null || token === void 0 ? void 0 : token.textColor,
|
|
3139
|
-
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
|
|
3140
|
-
? token.symbol
|
|
3141
|
-
: !isLoading && 'Select token' }), !isLoading && jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
|
-
const CSS_VARS = {
|
|
3145
|
-
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
3146
|
-
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
3147
|
-
COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
|
|
3148
|
-
EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
|
|
3149
|
-
FADE_IN_DURATION: '--squid-animation-fade-in-duration',
|
|
3150
|
-
FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
|
|
3151
|
-
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
3152
|
-
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
3153
|
-
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
3154
|
-
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
3155
|
-
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
3156
|
-
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
3157
|
-
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
3158
|
-
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
3159
|
-
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
3160
|
-
};
|
|
3161
|
-
const ANIMATION_DURATIONS = {
|
|
3162
|
-
SHOW_ROUTE: 300,
|
|
3163
|
-
HIDE_ROUTE: 300,
|
|
3164
|
-
CHANGE_SWAP_STEP: 300,
|
|
3165
|
-
SHOW_MODAL: 400,
|
|
3166
|
-
HIDE_MODAL: 400,
|
|
3167
|
-
BOOST_BUTTON: 500,
|
|
3168
|
-
};
|
|
3169
|
-
const ANIMATION_TIMINGS = {
|
|
3170
|
-
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
3171
|
-
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
3172
|
-
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
3173
|
-
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
3174
|
-
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
3175
|
-
};
|
|
3176
|
-
const MEDIA_QUERIES = {
|
|
3177
|
-
MOBILE_LG: {
|
|
3178
|
-
media: '(min-width: 480px)',
|
|
3179
|
-
key: 'mobile-lg',
|
|
3180
|
-
value: '480px',
|
|
3181
|
-
},
|
|
3182
|
-
};
|
|
3183
|
-
|
|
3184
3078
|
function SearchIcon() {
|
|
3185
3079
|
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.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" }) }));
|
|
3186
3080
|
}
|
|
@@ -16741,12 +16635,73 @@ AppContainer.Content = (props) => (jsxRuntime.jsx(motion.div, Object.assign({ tr
|
|
|
16741
16635
|
}, layout: "position", layoutDependency: React.useContext(LayoutDependencyContext), layoutId: "app-container-content" }, props)));
|
|
16742
16636
|
const elementKey = (child) => React.isValidElement(child) ? child.key : null;
|
|
16743
16637
|
|
|
16638
|
+
const CSS_VARS = {
|
|
16639
|
+
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
16640
|
+
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
16641
|
+
COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
|
|
16642
|
+
EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
|
|
16643
|
+
FADE_IN_DURATION: '--squid-animation-fade-in-duration',
|
|
16644
|
+
FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
|
|
16645
|
+
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
16646
|
+
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
16647
|
+
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
16648
|
+
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
16649
|
+
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
16650
|
+
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
16651
|
+
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
16652
|
+
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
16653
|
+
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
16654
|
+
};
|
|
16655
|
+
const ANIMATION_DURATIONS = {
|
|
16656
|
+
SHOW_ROUTE: 300,
|
|
16657
|
+
HIDE_ROUTE: 300,
|
|
16658
|
+
CHANGE_SWAP_STEP: 300,
|
|
16659
|
+
SHOW_MODAL: 400,
|
|
16660
|
+
HIDE_MODAL: 400,
|
|
16661
|
+
BOOST_BUTTON: 500,
|
|
16662
|
+
};
|
|
16663
|
+
const ANIMATION_TIMINGS = {
|
|
16664
|
+
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
16665
|
+
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
16666
|
+
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
16667
|
+
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
16668
|
+
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
16669
|
+
};
|
|
16670
|
+
const MEDIA_QUERIES = {
|
|
16671
|
+
MOBILE_LG: {
|
|
16672
|
+
media: '(min-width: 480px)',
|
|
16673
|
+
key: 'mobile-lg',
|
|
16674
|
+
value: '480px',
|
|
16675
|
+
},
|
|
16676
|
+
};
|
|
16677
|
+
|
|
16678
|
+
function BoostButton({ boostMode, canToggleBoostMode = true, boostIndicatorRef, }) {
|
|
16679
|
+
return (jsxRuntime.jsx("div", { className: "tw-w-[106.5px] tw-pr-squid-xxs mobile-lg:tw-w-[140px]", children: jsxRuntime.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: [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 &&
|
|
16680
|
+
'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 &&
|
|
16681
|
+
'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-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: [jsxRuntime.jsx("div", { className: "tw-w-[70px] 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-[70px] 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: {
|
|
16682
|
+
boxShadow: generateMarkerLines(40),
|
|
16683
|
+
} })] }), jsxRuntime.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: {
|
|
16684
|
+
transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
|
|
16685
|
+
} })] }) }));
|
|
16686
|
+
}
|
|
16687
|
+
function generateMarkerLines(count) {
|
|
16688
|
+
const halfCount = Math.ceil(count / 2);
|
|
16689
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
16690
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
16691
|
+
});
|
|
16692
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
16693
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
16694
|
+
});
|
|
16695
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
16696
|
+
return allShadows.join(', ');
|
|
16697
|
+
}
|
|
16698
|
+
|
|
16744
16699
|
function Chip(_a) {
|
|
16745
16700
|
var { label, icon } = _a, props = __rest$1(_a, ["label", "icon"]);
|
|
16746
16701
|
return (jsxRuntime.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 ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-text-nowrap tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
16747
16702
|
}
|
|
16748
16703
|
|
|
16749
|
-
function Boost({ boostMode, onToggleBoostMode, estimatedTime,
|
|
16704
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, canToggleBoostMode = true, tooltip, }) {
|
|
16750
16705
|
const boostIndicatorRef = React.useRef(null);
|
|
16751
16706
|
function handleToggleBoostMode() {
|
|
16752
16707
|
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
@@ -16763,9 +16718,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
|
|
|
16763
16718
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
16764
16719
|
}
|
|
16765
16720
|
}
|
|
16766
|
-
return (jsxRuntime.jsx(
|
|
16721
|
+
return (jsxRuntime.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: jsxRuntime.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: [jsxRuntime.jsx(BoostButton, { boostIndicatorRef: boostIndicatorRef, boostMode: boostMode, canToggleBoostMode: canToggleBoostMode }), jsxRuntime.jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
16767
16722
|
? 'tw-bg-grey-300'
|
|
16768
|
-
: 'tw-bg-status-positive') })] }) }));
|
|
16723
|
+
: 'tw-bg-status-positive') })] }) })));
|
|
16769
16724
|
}
|
|
16770
16725
|
|
|
16771
16726
|
function Join({ children, glue }) {
|
|
@@ -16877,8 +16832,8 @@ function EthereumIcon() {
|
|
|
16877
16832
|
}
|
|
16878
16833
|
|
|
16879
16834
|
function FeeButton(_a) {
|
|
16880
|
-
var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className"]);
|
|
16881
|
-
return (jsxRuntime.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: [jsxRuntime.jsx(Chip, { label: chipLabel }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
|
|
16835
|
+
var { feeInUsd = '0', chipLabel = 'Fee', className, tooltip } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className", "tooltip"]);
|
|
16836
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsxRuntime.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: [jsxRuntime.jsx(Chip, { label: chipLabel }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: feeInUsd })] })] })) })));
|
|
16882
16837
|
}
|
|
16883
16838
|
|
|
16884
16839
|
function EmojiSadIcon({ className, size = '20', }) {
|
|
@@ -16898,7 +16853,8 @@ const detailStateClassMap = {
|
|
|
16898
16853
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
16899
16854
|
full: '',
|
|
16900
16855
|
};
|
|
16901
|
-
function DetailsToolbar({ errorMessage,
|
|
16856
|
+
function DetailsToolbar({ errorMessage, estimatedTime, helpButton, isLoading, isEmpty, flipButton, feeButton, boostButton, }) {
|
|
16857
|
+
var _a;
|
|
16902
16858
|
const state = React.useMemo(() => {
|
|
16903
16859
|
if (errorMessage)
|
|
16904
16860
|
return 'error';
|
|
@@ -16911,10 +16867,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
16911
16867
|
const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
|
|
16912
16868
|
return (jsxRuntime.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'
|
|
16913
16869
|
? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
|
|
16914
|
-
: 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button$1, { 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, {
|
|
16915
|
-
|
|
16916
|
-
: undefined, tooltipWidth: "max", displayDelayMs: flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltipDisplayDelayMs, children: jsxRuntime.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: jsxRuntime.jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
|
|
16917
|
-
'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 }) })] })) }));
|
|
16870
|
+
: 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button$1, { 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, Object.assign({}, feeButton)) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.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: jsxRuntime.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: jsxRuntime.jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
|
|
16871
|
+
'group-hover/flip-button:tw-rotate-180') }) }) }))) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.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 }) })] })) }));
|
|
16918
16872
|
}
|
|
16919
16873
|
|
|
16920
16874
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -17017,7 +16971,7 @@ const dropdownPositionClassMap = {
|
|
|
17017
16971
|
const statusBadge = {
|
|
17018
16972
|
completed: {},
|
|
17019
16973
|
pending: {
|
|
17020
|
-
badge: jsxRuntime.jsx(Loader, { size: "16", strokeWidth: "
|
|
16974
|
+
badge: jsxRuntime.jsx(Loader, { size: "16", strokeWidth: "4" }),
|
|
17021
16975
|
containerClassName: 'tw-bg-royal-400',
|
|
17022
16976
|
},
|
|
17023
16977
|
failed: {
|
|
@@ -17252,7 +17206,7 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
17252
17206
|
case 'pending':
|
|
17253
17207
|
return null;
|
|
17254
17208
|
case 'ongoing':
|
|
17255
|
-
return jsxRuntime.jsx(Loader, { size: "16", strokeWidth: "
|
|
17209
|
+
return jsxRuntime.jsx(Loader, { size: "16", strokeWidth: "4" });
|
|
17256
17210
|
default:
|
|
17257
17211
|
return null;
|
|
17258
17212
|
}
|
|
@@ -17268,7 +17222,7 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
17268
17222
|
return (jsxRuntime.jsx("li", { style: {
|
|
17269
17223
|
maxHeight: `${STEP_ITEM_HEIGHT}px`,
|
|
17270
17224
|
minHeight: `${STEP_ITEM_HEIGHT}px`,
|
|
17271
|
-
}, className: "
|
|
17225
|
+
}, 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: jsxRuntime.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: [jsxRuntime.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: [jsxRuntime.jsx(Chip, { style: transitionStyle, className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: chipContent }), showStepSeparator && (jsxRuntime.jsx("span", { className: cn(separatorClassMap[status], 'tw-absolute tw-left-0 tw-top-full tw-mt-0.5'), style: transitionStyle, children: jsxRuntime.jsx(SwapStepSeparator, {}) }))] }), jsxRuntime.jsx(DescriptionBlocks, { className: "tw-min-h-squid-l tw-py-squid-xxs tw-pr-squid-xs", blocks: descriptionBlocks })] }) }));
|
|
17272
17226
|
}
|
|
17273
17227
|
|
|
17274
17228
|
function Timeline(_a) {
|
|
@@ -17325,7 +17279,7 @@ function renderStatusIcon(status, defaultIcon) {
|
|
|
17325
17279
|
case 'error':
|
|
17326
17280
|
return jsxRuntime.jsx(EmojiSadIcon, { className: "tw-text-status-negative" });
|
|
17327
17281
|
case 'ongoing':
|
|
17328
|
-
return (jsxRuntime.jsx(Loader, { className: statusTextClassMap.ongoing, strokeWidth: "
|
|
17282
|
+
return (jsxRuntime.jsx(Loader, { className: statusTextClassMap.ongoing, strokeWidth: "4", size: "20" }));
|
|
17329
17283
|
case 'waiting':
|
|
17330
17284
|
return jsxRuntime.jsx(TransactionState, { status: "waiting", variant: "compact" });
|
|
17331
17285
|
case 'warning':
|
|
@@ -17533,11 +17487,11 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
|
|
|
17533
17487
|
? 'tw-px-squid-m'
|
|
17534
17488
|
: 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsxRuntime.jsx(Button$1, { className: displayButtonShadows
|
|
17535
17489
|
? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
|
|
17536
|
-
: undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsxRuntime.jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsxRuntime.jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsxRuntime.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) => (jsxRuntime.jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17490
|
+
: undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsxRuntime.jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsxRuntime.jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsxRuntime.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) => (jsxRuntime.jsx(Tooltip, Object.assign({}, action.tooltip, { childrenClassName: "tw-rounded-squid-m", containerClassName: "tw-rounded-squid-m", tooltipWidth: "max", children: jsxRuntime.jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
|
|
17491
|
+
? action.labelOrIcon
|
|
17492
|
+
: undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
|
|
17493
|
+
? null
|
|
17494
|
+
: action.labelOrIcon, onClick: action.onClick }) }), action.id))) })] }), title ? (jsxRuntime.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: jsxRuntime.jsx(HeadingText, { size: "small", children: title }) })) : null] }));
|
|
17541
17495
|
}
|
|
17542
17496
|
|
|
17543
17497
|
const createStoreImpl = (createState) => {
|
|
@@ -18126,21 +18080,27 @@ function LogoContainer({ children }) {
|
|
|
18126
18080
|
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
|
|
18127
18081
|
}
|
|
18128
18082
|
|
|
18129
|
-
function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange,
|
|
18130
|
-
var _a, _b;
|
|
18131
|
-
const isWalletButtonInteractive = !isLoading && !!
|
|
18083
|
+
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, }) {
|
|
18084
|
+
var _a, _b, _c;
|
|
18085
|
+
const isWalletButtonInteractive = !isLoading && !!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick);
|
|
18132
18086
|
const WalletButtonTag = isWalletButtonInteractive ? 'button' : 'div';
|
|
18133
18087
|
const isFetching = isFetchingProp || isLoading;
|
|
18134
|
-
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-
|
|
18135
|
-
|
|
18136
|
-
|
|
18088
|
+
return (jsxRuntime.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: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxRuntime.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: jsxRuntime.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: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { size: "small", children: ":" }), !isLoading && (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18089
|
+
? 'tw-text-grey-300'
|
|
18090
|
+
: 'tw-text-royal-400', children: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18091
|
+
? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
|
|
18092
|
+
: (_a = walletButton === null || walletButton === void 0 ? void 0 : walletButton.emptyAddressLabel) !== null && _a !== void 0 ? _a : 'Connect wallet' }), jsxRuntime.jsx(ChevronArrowIcon, { className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18093
|
+
? 'tw-text-grey-600'
|
|
18094
|
+
: 'tw-text-royal-400' })] }))] }) })) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
|
|
18095
|
+
decimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18,
|
|
18096
|
+
symbol: (_c = token === null || token === void 0 ? void 0 : token.symbol) !== null && _c !== void 0 ? _c : '',
|
|
18137
18097
|
price: tokenPrice,
|
|
18138
18098
|
}, onAmountChange: (value) => {
|
|
18139
18099
|
onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value);
|
|
18140
18100
|
}, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
|
|
18141
18101
|
token: '0.001',
|
|
18142
18102
|
usd: '0.01',
|
|
18143
|
-
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount,
|
|
18103
|
+
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading })] }));
|
|
18144
18104
|
}
|
|
18145
18105
|
|
|
18146
18106
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -18199,7 +18159,7 @@ const SwapStepsCollapsed = React.forwardRef((props, ref) => {
|
|
|
18199
18159
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
18200
18160
|
}
|
|
18201
18161
|
};
|
|
18202
|
-
return (jsxRuntime.jsx("div", { className: "
|
|
18162
|
+
return (jsxRuntime.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: jsxRuntime.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: jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col tw-justify-end", children: [!isRouteVisible && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.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" }), jsxRuntime.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" })] })), jsxRuntime.jsx("div", { onClick: handleToggleRouteSteps, style: {
|
|
18203
18163
|
[CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
18204
18164
|
[CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
18205
18165
|
}, 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
|
|
@@ -18216,7 +18176,7 @@ const SwapStepsCollapsed = React.forwardRef((props, ref) => {
|
|
|
18216
18176
|
: 'tw-animate-collapse-route')), children: jsxRuntime.jsxs("div", { className: cn('tw-flex tw-flex-col tw-gap-squid-xxs', isRouteVisible || isShowRouteAnimationRunning
|
|
18217
18177
|
? 'tw-max-h-[535px]'
|
|
18218
18178
|
: ''), style: {
|
|
18219
|
-
paddingTop: `${STEP_ITEM_HEIGHT}px`,
|
|
18179
|
+
paddingTop: `${STEP_ITEM_HEIGHT / 2}px`,
|
|
18220
18180
|
transition: isShowRouteAnimationRunning
|
|
18221
18181
|
? `transform ${ANIMATION_DURATIONS.SHOW_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
18222
18182
|
: isRouteVisible
|
|
@@ -18225,13 +18185,10 @@ const SwapStepsCollapsed = React.forwardRef((props, ref) => {
|
|
|
18225
18185
|
transform: isShowRouteAnimationRunning
|
|
18226
18186
|
? 'translateY(0)'
|
|
18227
18187
|
: `translateY(calc(-100% + 69px + ${(newStepIndex + 1) * STEP_ITEM_HEIGHT}px))`,
|
|
18228
|
-
}, children: [jsxRuntime.jsx("
|
|
18229
|
-
display: isRouteVisible ? 'flex' : 'none',
|
|
18230
|
-
height: `${STEP_ITEM_HEIGHT}px`,
|
|
18231
|
-
}, 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: jsxRuntime.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: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { ref: routeStepsListRef, style: {
|
|
18188
|
+
}, children: [jsxRuntime.jsx("ul", { ref: routeStepsListRef, style: {
|
|
18232
18189
|
zIndex: isRouteVisible ? 0 : -10,
|
|
18233
18190
|
scrollbarWidth: 'none',
|
|
18234
|
-
}, className: "
|
|
18191
|
+
}, 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) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks,
|
|
18235
18192
|
// show separator for all steps except the first one
|
|
18236
18193
|
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? 'pending' : step.status }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-max-h-[55px] tw-min-h-[55px] tw-w-full tw-justify-center tw-gap-squid-xs tw-self-stretch tw-px-squid-s tw-pb-squid-s", children: jsxRuntime.jsx(Button$1, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full" }) })] }) })] }) }) }));
|
|
18237
18194
|
});
|
|
@@ -24248,11 +24205,159 @@ function Toast({ headerContent, actionsContent, description, chipLabel, title, }
|
|
|
24248
24205
|
return (jsxRuntime.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, jsxRuntime.jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsxRuntime.jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsxRuntime.jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsxRuntime.jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
|
|
24249
24206
|
}
|
|
24250
24207
|
|
|
24208
|
+
const gapBetweenTooltipAndContainer = 10;
|
|
24209
|
+
const tooltipWidthClassMap = {
|
|
24210
|
+
max: 'tw-w-max',
|
|
24211
|
+
container: 'tw-w-full',
|
|
24212
|
+
};
|
|
24213
|
+
const tooltipThresholdPaddingMap = {
|
|
24214
|
+
xxs: '5px',
|
|
24215
|
+
xs: '10px',
|
|
24216
|
+
s: '15px',
|
|
24217
|
+
m: '20px',
|
|
24218
|
+
l: '30px',
|
|
24219
|
+
xl: '40px',
|
|
24220
|
+
xxl: '60px',
|
|
24221
|
+
};
|
|
24222
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: containerRefProp, }) {
|
|
24223
|
+
const containerRefState = useContainerStore((state) => state.containerRef);
|
|
24224
|
+
const containerRef = (containerRefProp === null || containerRefProp === void 0 ? void 0 : containerRefProp.current)
|
|
24225
|
+
? containerRefProp
|
|
24226
|
+
: containerRefState;
|
|
24227
|
+
const [tooltipPositionStyle, setTooltipPositionStyle] = React.useState({});
|
|
24228
|
+
const [isTooltipVisible, setIsTooltipVisible] = React.useState(false);
|
|
24229
|
+
const [isTooltipVisibleDelayed, setIsTooltipVisibleDelayed] = React.useState(false);
|
|
24230
|
+
const tooltipRef = React.useRef(null);
|
|
24231
|
+
const tooltipTriggerRef = React.useRef(null);
|
|
24232
|
+
const delayTimeoutRef = React.useRef(null);
|
|
24233
|
+
React.useEffect(() => {
|
|
24234
|
+
const adjustTooltipPosition = () => {
|
|
24235
|
+
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
24236
|
+
!tooltipRef.current ||
|
|
24237
|
+
!tooltipTriggerRef.current) {
|
|
24238
|
+
// if any of the refs is not defined, we can't calculate the position
|
|
24239
|
+
// so we just try to center the tooltip
|
|
24240
|
+
return setTooltipPositionStyle({
|
|
24241
|
+
bottom: '100%',
|
|
24242
|
+
left: '50%',
|
|
24243
|
+
transform: 'translateX(-50%)',
|
|
24244
|
+
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24245
|
+
});
|
|
24246
|
+
}
|
|
24247
|
+
// get the bounding rects of the container, tooltip and trigger
|
|
24248
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
24249
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
24250
|
+
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
24251
|
+
// check if the tooltip fits below the trigger
|
|
24252
|
+
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
24253
|
+
// check if the tooltip fits above the trigger
|
|
24254
|
+
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
24255
|
+
// get the y position of the center of the tooltip trigger
|
|
24256
|
+
const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
|
|
24257
|
+
// get the x position of the center of the tooltip trigger
|
|
24258
|
+
const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
|
|
24259
|
+
let tooltipYPosition = 'top';
|
|
24260
|
+
if (tooltipFitsAbove) {
|
|
24261
|
+
tooltipYPosition = 'top';
|
|
24262
|
+
}
|
|
24263
|
+
else if (tooltipFitsBelow) {
|
|
24264
|
+
tooltipYPosition = 'bottom';
|
|
24265
|
+
}
|
|
24266
|
+
else if (
|
|
24267
|
+
// if the tooltip doesn't fit above or below the trigger,
|
|
24268
|
+
// we just place it where there's more space available
|
|
24269
|
+
triggerMiddleY - containerRect.top >
|
|
24270
|
+
containerRect.bottom - triggerMiddleY) {
|
|
24271
|
+
tooltipYPosition = 'top';
|
|
24272
|
+
}
|
|
24273
|
+
else {
|
|
24274
|
+
tooltipYPosition = 'bottom';
|
|
24275
|
+
}
|
|
24276
|
+
const top = tooltipYPosition === 'top'
|
|
24277
|
+
? -tooltipRect.height
|
|
24278
|
+
: tooltipTriggerRect.height;
|
|
24279
|
+
const paddingStyles = tooltipYPosition === 'top'
|
|
24280
|
+
? {
|
|
24281
|
+
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24282
|
+
}
|
|
24283
|
+
: {
|
|
24284
|
+
paddingTop: tooltipThresholdPaddingMap[threshold],
|
|
24285
|
+
};
|
|
24286
|
+
let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
24287
|
+
const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
|
|
24288
|
+
const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
|
|
24289
|
+
const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
|
|
24290
|
+
const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
|
|
24291
|
+
// 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
|
|
24292
|
+
if (tooltipOverflowsContainerLeft) {
|
|
24293
|
+
left =
|
|
24294
|
+
-(tooltipTriggerRect.left - containerRect.left) +
|
|
24295
|
+
gapBetweenTooltipAndContainer;
|
|
24296
|
+
}
|
|
24297
|
+
else if (tooltipOverflowsContainerRight) {
|
|
24298
|
+
left =
|
|
24299
|
+
-(containerRect.right - tooltipTriggerRect.right) +
|
|
24300
|
+
gapBetweenTooltipAndContainer;
|
|
24301
|
+
}
|
|
24302
|
+
setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
|
|
24303
|
+
? { left }
|
|
24304
|
+
: tooltipOverflowsContainerRight
|
|
24305
|
+
? { right: left }
|
|
24306
|
+
: // if the tooltip doesn't overflow the container, we just center it
|
|
24307
|
+
{
|
|
24308
|
+
left: '50%',
|
|
24309
|
+
transform: 'translateX(-50%)',
|
|
24310
|
+
})), paddingStyles));
|
|
24311
|
+
};
|
|
24312
|
+
adjustTooltipPosition();
|
|
24313
|
+
const timeoutId = setTimeout(() => {
|
|
24314
|
+
adjustTooltipPosition();
|
|
24315
|
+
}, 300);
|
|
24316
|
+
window.addEventListener('resize', adjustTooltipPosition);
|
|
24317
|
+
return () => {
|
|
24318
|
+
clearTimeout(timeoutId);
|
|
24319
|
+
window.removeEventListener('resize', adjustTooltipPosition);
|
|
24320
|
+
};
|
|
24321
|
+
}, [
|
|
24322
|
+
containerRef,
|
|
24323
|
+
tooltipContent,
|
|
24324
|
+
threshold,
|
|
24325
|
+
tooltipWidth,
|
|
24326
|
+
displayDelayMs,
|
|
24327
|
+
isTooltipVisible,
|
|
24328
|
+
]);
|
|
24329
|
+
const handleMouseEnter = React.useCallback((e) => {
|
|
24330
|
+
var _a;
|
|
24331
|
+
if (e.target === tooltipRef.current ||
|
|
24332
|
+
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
24333
|
+
return;
|
|
24334
|
+
}
|
|
24335
|
+
setIsTooltipVisible(true);
|
|
24336
|
+
if (delayTimeoutRef.current) {
|
|
24337
|
+
clearTimeout(delayTimeoutRef.current);
|
|
24338
|
+
}
|
|
24339
|
+
delayTimeoutRef.current = setTimeout(() => {
|
|
24340
|
+
setIsTooltipVisibleDelayed(true);
|
|
24341
|
+
}, displayDelayMs);
|
|
24342
|
+
}, [displayDelayMs, tooltipRef, delayTimeoutRef]);
|
|
24343
|
+
const handleMouseLeave = React.useCallback(() => {
|
|
24344
|
+
setIsTooltipVisible(false);
|
|
24345
|
+
setIsTooltipVisibleDelayed(false);
|
|
24346
|
+
if (delayTimeoutRef.current) {
|
|
24347
|
+
clearTimeout(delayTimeoutRef.current);
|
|
24348
|
+
}
|
|
24349
|
+
}, [delayTimeoutRef]);
|
|
24350
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [jsxRuntime.jsx("div", { ref: tooltipTriggerRef, className: childrenClassName, children: children }), tooltipContent ? (jsxRuntime.jsx(Menu, { style: tooltipPositionStyle, menuRef: tooltipRef, containerClassName: cn('tw-absolute tw-flex tw-items-center tw-justify-center', isTooltipVisibleDelayed
|
|
24351
|
+
? '!tw-opacity-100 tw-z-40 tw-visible'
|
|
24352
|
+
: 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none tw-invisible', tooltipWidthClassMap[tooltipWidth], tooltipClassName), children: tooltipContent })) : null] }));
|
|
24353
|
+
}
|
|
24354
|
+
|
|
24251
24355
|
const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
|
|
24252
24356
|
// checks that the value includes at least one character different than `0` (zero), or `.` (dot)
|
|
24253
24357
|
const RegExpNonZeroValue = /[^0.]/;
|
|
24254
24358
|
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
24255
|
-
const
|
|
24359
|
+
const notInteractiveChipClassName = 'tw-cursor-not-allowed';
|
|
24360
|
+
const loadingClassName = 'tw-opacity-50';
|
|
24256
24361
|
var InputMode;
|
|
24257
24362
|
(function (InputMode) {
|
|
24258
24363
|
InputMode[InputMode["TOKEN"] = 0] = "TOKEN";
|
|
@@ -24261,7 +24366,7 @@ var InputMode;
|
|
|
24261
24366
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24262
24367
|
token: '0.001',
|
|
24263
24368
|
usd: '0.01',
|
|
24264
|
-
}, showDetails = true, isLoading = false, direction,
|
|
24369
|
+
}, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, }) {
|
|
24265
24370
|
var _a;
|
|
24266
24371
|
const [inputValue, setInputValue] = React.useState('');
|
|
24267
24372
|
const [inputMode, setInputMode] = React.useState(InputMode.TOKEN);
|
|
@@ -24359,6 +24464,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24359
24464
|
};
|
|
24360
24465
|
const { isTokenAmountVerySmall, isUsdAmountVerySmall } = getRawAmounts(inputValue);
|
|
24361
24466
|
const amountFormatted = React.useMemo(() => {
|
|
24467
|
+
var _a;
|
|
24362
24468
|
if (inputValue === '')
|
|
24363
24469
|
return '0';
|
|
24364
24470
|
if (inputMode === InputMode.TOKEN) {
|
|
@@ -24366,13 +24472,19 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24366
24472
|
return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
|
|
24367
24473
|
}
|
|
24368
24474
|
else {
|
|
24369
|
-
return formatAmount(amountUsd !== null &&
|
|
24475
|
+
return formatAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : '0');
|
|
24370
24476
|
}
|
|
24371
24477
|
}
|
|
24372
24478
|
else {
|
|
24373
24479
|
return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
24374
24480
|
}
|
|
24375
|
-
}, [
|
|
24481
|
+
}, [
|
|
24482
|
+
inputValue,
|
|
24483
|
+
inputMode,
|
|
24484
|
+
token.price,
|
|
24485
|
+
direction,
|
|
24486
|
+
inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
|
|
24487
|
+
]);
|
|
24376
24488
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
24377
24489
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
24378
24490
|
? 'tw-text-status-negative'
|
|
@@ -24383,11 +24495,21 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24383
24495
|
}, [balance]);
|
|
24384
24496
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInteractive && !isLoading ? (jsxRuntime.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) => {
|
|
24385
24497
|
e.preventDefault();
|
|
24386
|
-
}, children: [inputMode === InputMode.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.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]') })] })) : (jsxRuntime.jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading &&
|
|
24498
|
+
}, children: [inputMode === InputMode.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.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]') })] })) : (jsxRuntime.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: jsxRuntime.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: jsxRuntime.jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxRuntime.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 ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsx(Tooltip, Object.assign({}, (isLoading
|
|
24499
|
+
? undefined
|
|
24500
|
+
: inputMode === InputMode.TOKEN
|
|
24501
|
+
? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
|
|
24502
|
+
: inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxRuntime.jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
|
|
24503
|
+
? interactiveChipClassName
|
|
24504
|
+
: notInteractiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntime.jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsxRuntime.jsx(CaptionText, { children: isUsdAmountVerySmall
|
|
24505
|
+
? formatIfVerySmall.token
|
|
24506
|
+
: amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24387
24507
|
? formatIfVerySmall.token
|
|
24388
|
-
: amountFormatted })
|
|
24389
|
-
|
|
24390
|
-
|
|
24508
|
+
: amountFormatted }), ' ', jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0
|
|
24509
|
+
? 'tw-opacity-0'
|
|
24510
|
+
: '' }), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }) }))), jsxRuntime.jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
|
|
24511
|
+
? interactiveChipClassName
|
|
24512
|
+
: notInteractiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balanceFormatted }), jsxRuntime.jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
24391
24513
|
}
|
|
24392
24514
|
|
|
24393
24515
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
@@ -24489,172 +24611,50 @@ function Switch({ checked = false, onChange, size, disabled = false, }) {
|
|
|
24489
24611
|
: 'tw-bg-grey-500') })] }));
|
|
24490
24612
|
}
|
|
24491
24613
|
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24614
|
+
function PlusIcon() {
|
|
24615
|
+
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
24616
|
+
}
|
|
24617
|
+
|
|
24618
|
+
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
24619
|
+
const themeKeyVariantMap = {
|
|
24620
|
+
primary: 'grey-800',
|
|
24621
|
+
accent: 'royal-500',
|
|
24496
24622
|
};
|
|
24497
|
-
const
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
s: '15px',
|
|
24501
|
-
m: '20px',
|
|
24502
|
-
l: '30px',
|
|
24503
|
-
xl: '40px',
|
|
24504
|
-
xxl: '60px',
|
|
24623
|
+
const buttonTextClassNameMap = {
|
|
24624
|
+
primary: 'tw-text-grey-300',
|
|
24625
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
24505
24626
|
};
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
const
|
|
24513
|
-
const
|
|
24514
|
-
const
|
|
24515
|
-
const
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
const adjustTooltipPosition = () => {
|
|
24519
|
-
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
24520
|
-
!tooltipRef.current ||
|
|
24521
|
-
!tooltipTriggerRef.current) {
|
|
24522
|
-
// if any of the refs is not defined, we can't calculate the position
|
|
24523
|
-
// so we just try to center the tooltip
|
|
24524
|
-
return setTooltipPositionStyle({
|
|
24525
|
-
bottom: '100%',
|
|
24526
|
-
left: '50%',
|
|
24527
|
-
transform: 'translateX(-50%)',
|
|
24528
|
-
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24529
|
-
});
|
|
24530
|
-
}
|
|
24531
|
-
// get the bounding rects of the container, tooltip and trigger
|
|
24532
|
-
const containerRect = containerRef.current.getBoundingClientRect();
|
|
24533
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
24534
|
-
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
24535
|
-
// check if the tooltip fits below the trigger
|
|
24536
|
-
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
24537
|
-
// check if the tooltip fits above the trigger
|
|
24538
|
-
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
24539
|
-
// get the y position of the center of the tooltip trigger
|
|
24540
|
-
const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
|
|
24541
|
-
// get the x position of the center of the tooltip trigger
|
|
24542
|
-
const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
|
|
24543
|
-
let tooltipYPosition = 'top';
|
|
24544
|
-
if (tooltipFitsAbove) {
|
|
24545
|
-
tooltipYPosition = 'top';
|
|
24546
|
-
}
|
|
24547
|
-
else if (tooltipFitsBelow) {
|
|
24548
|
-
tooltipYPosition = 'bottom';
|
|
24549
|
-
}
|
|
24550
|
-
else if (
|
|
24551
|
-
// if the tooltip doesn't fit above or below the trigger,
|
|
24552
|
-
// we just place it where there's more space available
|
|
24553
|
-
triggerMiddleY - containerRect.top >
|
|
24554
|
-
containerRect.bottom - triggerMiddleY) {
|
|
24555
|
-
tooltipYPosition = 'top';
|
|
24556
|
-
}
|
|
24557
|
-
else {
|
|
24558
|
-
tooltipYPosition = 'bottom';
|
|
24559
|
-
}
|
|
24560
|
-
const top = tooltipYPosition === 'top'
|
|
24561
|
-
? -tooltipRect.height
|
|
24562
|
-
: tooltipTriggerRect.height;
|
|
24563
|
-
const paddingStyles = tooltipYPosition === 'top'
|
|
24564
|
-
? {
|
|
24565
|
-
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24566
|
-
}
|
|
24567
|
-
: {
|
|
24568
|
-
paddingTop: tooltipThresholdPaddingMap[threshold],
|
|
24569
|
-
};
|
|
24570
|
-
let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
24571
|
-
const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
|
|
24572
|
-
const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
|
|
24573
|
-
const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
|
|
24574
|
-
const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
|
|
24575
|
-
// 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
|
|
24576
|
-
if (tooltipOverflowsContainerLeft) {
|
|
24577
|
-
left =
|
|
24578
|
-
-(tooltipTriggerRect.left - containerRect.left) +
|
|
24579
|
-
gapBetweenTooltipAndContainer;
|
|
24580
|
-
}
|
|
24581
|
-
else if (tooltipOverflowsContainerRight) {
|
|
24582
|
-
left =
|
|
24583
|
-
-(containerRect.right - tooltipTriggerRect.right) +
|
|
24584
|
-
gapBetweenTooltipAndContainer;
|
|
24585
|
-
}
|
|
24586
|
-
setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
|
|
24587
|
-
? { left }
|
|
24588
|
-
: tooltipOverflowsContainerRight
|
|
24589
|
-
? { right: left }
|
|
24590
|
-
: // if the tooltip doesn't overflow the container, we just center it
|
|
24591
|
-
{
|
|
24592
|
-
left: '50%',
|
|
24593
|
-
transform: 'translateX(-50%)',
|
|
24594
|
-
})), paddingStyles));
|
|
24595
|
-
};
|
|
24596
|
-
adjustTooltipPosition();
|
|
24597
|
-
const timeoutId = setTimeout(() => {
|
|
24598
|
-
adjustTooltipPosition();
|
|
24599
|
-
}, 300);
|
|
24600
|
-
window.addEventListener('resize', adjustTooltipPosition);
|
|
24601
|
-
return () => {
|
|
24602
|
-
clearTimeout(timeoutId);
|
|
24603
|
-
window.removeEventListener('resize', adjustTooltipPosition);
|
|
24604
|
-
};
|
|
24605
|
-
}, [
|
|
24606
|
-
containerRef,
|
|
24607
|
-
tooltipContent,
|
|
24608
|
-
threshold,
|
|
24609
|
-
tooltipWidth,
|
|
24610
|
-
displayDelayMs,
|
|
24611
|
-
isTooltipVisible,
|
|
24612
|
-
]);
|
|
24613
|
-
const handleMouseEnter = React.useCallback((e) => {
|
|
24614
|
-
var _a;
|
|
24615
|
-
if (e.target === tooltipRef.current ||
|
|
24616
|
-
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
24617
|
-
return;
|
|
24618
|
-
}
|
|
24619
|
-
setIsTooltipVisible(true);
|
|
24620
|
-
if (delayTimeoutRef.current) {
|
|
24621
|
-
clearTimeout(delayTimeoutRef.current);
|
|
24627
|
+
const emptyChainIconTextClassNameMap = {
|
|
24628
|
+
primary: 'tw-text-grey-100',
|
|
24629
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
24630
|
+
};
|
|
24631
|
+
function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, tooltip, }) {
|
|
24632
|
+
var _a;
|
|
24633
|
+
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
24634
|
+
const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
|
|
24635
|
+
const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
|
|
24636
|
+
const bgGradient = React.useMemo(() => {
|
|
24637
|
+
if (!chain || isLoading) {
|
|
24638
|
+
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
24622
24639
|
}
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
}, displayDelayMs);
|
|
24626
|
-
}, [displayDelayMs, tooltipRef, delayTimeoutRef]);
|
|
24627
|
-
const handleMouseLeave = React.useCallback(() => {
|
|
24628
|
-
setIsTooltipVisible(false);
|
|
24629
|
-
setIsTooltipVisibleDelayed(false);
|
|
24630
|
-
if (delayTimeoutRef.current) {
|
|
24631
|
-
clearTimeout(delayTimeoutRef.current);
|
|
24640
|
+
if (!token) {
|
|
24641
|
+
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
24632
24642
|
}
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
}
|
|
24648
|
-
function generateMarkerLines(count) {
|
|
24649
|
-
const halfCount = Math.ceil(count / 2);
|
|
24650
|
-
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
24651
|
-
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
24652
|
-
});
|
|
24653
|
-
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
24654
|
-
return `${(index + 1) * 6}px 0 currentColor`;
|
|
24655
|
-
});
|
|
24656
|
-
const allShadows = [...rightShadows, ...leftShadows];
|
|
24657
|
-
return allShadows.join(', ');
|
|
24643
|
+
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
24644
|
+
}, [chainBgColor, tokenBgColor, chain, token, isLoading]);
|
|
24645
|
+
const ButtonTag = isLoading ? 'div' : 'button';
|
|
24646
|
+
return (jsxRuntime.jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-w-fit", children: jsxRuntime.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: [jsxRuntime.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: jsxRuntime.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" }) }), jsxRuntime.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
|
|
24647
|
+
? 'tw-w-[90px]'
|
|
24648
|
+
: 'tw-w-full tw-max-w-[72px]'), style: {
|
|
24649
|
+
backgroundImage: bgGradient,
|
|
24650
|
+
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsxRuntime.jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxRuntime.jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
24651
|
+
backgroundColor: tokenBgColor,
|
|
24652
|
+
} }), jsxRuntime.jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsxRuntime.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, jsxRuntime.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: {
|
|
24653
|
+
backgroundColor: tokenBgColor,
|
|
24654
|
+
color: token === null || token === void 0 ? void 0 : token.textColor,
|
|
24655
|
+
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
|
|
24656
|
+
? token.symbol
|
|
24657
|
+
: !isLoading && 'Select token' }), !isLoading && jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }) })));
|
|
24658
24658
|
}
|
|
24659
24659
|
|
|
24660
24660
|
function FilterIcon() {
|
|
@@ -24706,10 +24706,16 @@ function MainView({ isLoading }) {
|
|
|
24706
24706
|
{
|
|
24707
24707
|
labelOrIcon: jsxRuntime.jsx(ClockOutlineIcon, {}),
|
|
24708
24708
|
id: 'history',
|
|
24709
|
+
tooltip: {
|
|
24710
|
+
tooltipContent: 'Swap history',
|
|
24711
|
+
},
|
|
24709
24712
|
},
|
|
24710
24713
|
{
|
|
24711
24714
|
labelOrIcon: jsxRuntime.jsx(SettingsGearIcon, {}),
|
|
24712
24715
|
id: 'settings',
|
|
24716
|
+
tooltip: {
|
|
24717
|
+
tooltipContent: 'Swap preferences',
|
|
24718
|
+
},
|
|
24713
24719
|
},
|
|
24714
24720
|
] }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
|
|
24715
24721
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
|
|
@@ -24720,11 +24726,45 @@ function MainView({ isLoading }) {
|
|
|
24720
24726
|
bgColor: '#627eea',
|
|
24721
24727
|
textColor: '#fff',
|
|
24722
24728
|
decimals: 18,
|
|
24723
|
-
}, priceImpactPercentage: '0.3', balance: '4.57',
|
|
24729
|
+
}, priceImpactPercentage: '0.3', balance: '4.57', walletButton: {
|
|
24730
|
+
address: 'so-so.eth',
|
|
24731
|
+
onClick: () => { },
|
|
24732
|
+
tooltip: {
|
|
24733
|
+
tooltipContent: 'Connect wallet',
|
|
24734
|
+
},
|
|
24735
|
+
}, assetsButton: {
|
|
24736
|
+
tooltip: {
|
|
24737
|
+
tooltipContent: 'Select token',
|
|
24738
|
+
},
|
|
24739
|
+
}, balanceButton: {
|
|
24740
|
+
tooltip: {
|
|
24741
|
+
tooltipContent: 'Max balance',
|
|
24742
|
+
},
|
|
24743
|
+
}, inputModeButton: {
|
|
24744
|
+
usdModeTooltip: {
|
|
24745
|
+
tooltipContent: 'Enter token amount',
|
|
24746
|
+
},
|
|
24747
|
+
tokenModeTooltip: {
|
|
24748
|
+
tooltipContent: 'Enter in USD',
|
|
24749
|
+
},
|
|
24750
|
+
} }), jsxRuntime.jsx(DetailsToolbar, { flipButton: {
|
|
24724
24751
|
isDisabled: true,
|
|
24725
|
-
|
|
24726
|
-
|
|
24727
|
-
|
|
24752
|
+
tooltip: {
|
|
24753
|
+
tooltipContent: 'Not enough USDC to flip the swap',
|
|
24754
|
+
displayDelayMs: 0,
|
|
24755
|
+
},
|
|
24756
|
+
}, boostButton: {
|
|
24757
|
+
canToggleBoostMode: false,
|
|
24758
|
+
tooltip: {
|
|
24759
|
+
tooltipContent: 'Boost not supported for this route',
|
|
24760
|
+
},
|
|
24761
|
+
}, feeButton: {
|
|
24762
|
+
feeInUsd: '0.4',
|
|
24763
|
+
onClick: () => { },
|
|
24764
|
+
tooltip: {
|
|
24765
|
+
tooltipContent: 'View fees',
|
|
24766
|
+
},
|
|
24767
|
+
}, isLoading: isLoading, isEmpty: isLoading }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
|
|
24728
24768
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
|
|
24729
24769
|
bgColor: '#e84142',
|
|
24730
24770
|
}, token: {
|
|
@@ -24733,7 +24773,28 @@ function MainView({ isLoading }) {
|
|
|
24733
24773
|
bgColor: '#2775ca',
|
|
24734
24774
|
textColor: '#fff',
|
|
24735
24775
|
decimals: 6,
|
|
24736
|
-
}, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854',
|
|
24776
|
+
}, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', walletButton: {
|
|
24777
|
+
address: 'so-so.eth',
|
|
24778
|
+
onClick: () => { },
|
|
24779
|
+
tooltip: {
|
|
24780
|
+
tooltipContent: 'Connect wallet',
|
|
24781
|
+
},
|
|
24782
|
+
}, amount: isLoading ? undefined : '100', assetsButton: {
|
|
24783
|
+
tooltip: {
|
|
24784
|
+
tooltipContent: 'Select token',
|
|
24785
|
+
},
|
|
24786
|
+
}, balanceButton: {
|
|
24787
|
+
tooltip: {
|
|
24788
|
+
tooltipContent: 'Max balance',
|
|
24789
|
+
},
|
|
24790
|
+
}, inputModeButton: {
|
|
24791
|
+
usdModeTooltip: {
|
|
24792
|
+
tooltipContent: 'Enter token amount',
|
|
24793
|
+
},
|
|
24794
|
+
tokenModeTooltip: {
|
|
24795
|
+
tooltipContent: 'Enter in USD',
|
|
24796
|
+
},
|
|
24797
|
+
} }), jsxRuntime.jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsxRuntime.jsx(Button$1, { variant: isLoading ? 'tertiary' : 'primary', size: "lg", label: "Swap", isLoading: isLoading }) })] }));
|
|
24737
24798
|
}
|
|
24738
24799
|
|
|
24739
24800
|
function PunkIcon({ size = '16' }) {
|
|
@@ -59864,7 +59925,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
59864
59925
|
}, secondToken: {
|
|
59865
59926
|
bgColor: toToken.bgColor,
|
|
59866
59927
|
logoURI: toToken.logoUrl,
|
|
59867
|
-
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsxRuntime.jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsxRuntime.jsx(Button$1, { size: "lg", variant: "
|
|
59928
|
+
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsx(IconLabel, { src: fromToken.logoUrl, variant: "round", children: fromAmount }), to: jsxRuntime.jsx(IconLabel, { src: toToken.logoUrl, variant: "round", children: toAmount }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "2" }), label: "Chain", detail: jsxRuntime.jsx(Transfer, { from: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), to: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(Transfer, { from: fromAddressFormatted, to: toAddressFormatted }) }), jsxRuntime.jsx(PropertyListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(Transfer, { from: timer, to: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsxRuntime.jsx(Button$1, { size: "lg", variant: "secondary", label: "Close", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Button$1, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }), jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsxRuntime.jsx(Button$1, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: () => handleClose === null || handleClose === void 0 ? void 0 : handleClose(swapState), className: "tw-min-h-button" }))] }));
|
|
59868
59929
|
}
|
|
59869
59930
|
const TrackTransactionView = React.forwardRef((props, ref) => {
|
|
59870
59931
|
const { swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, footerButton, } = props;
|