@0xsquid/ui 0.19.5 → 0.20.1-beta.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 +393 -296
- package/dist/cjs/types/components/badges/BadgeImage.d.ts +6 -1
- 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/index.d.ts +1 -0
- package/dist/cjs/types/components/index.d.ts +1 -0
- 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/ListItem.d.ts +2 -1
- package/dist/cjs/types/stories/badges/BadgeImage.stories.d.ts +4 -0
- 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 +393 -297
- package/dist/esm/types/components/badges/BadgeImage.d.ts +6 -1
- 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/index.d.ts +1 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- 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/ListItem.d.ts +2 -1
- package/dist/esm/types/stories/badges/BadgeImage.stories.d.ts +4 -0
- 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.d.ts +141 -105
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2637,24 +2637,41 @@ const mainImageSizeClassMap = {
|
|
|
2637
2637
|
md: 'tw-w-10 tw-h-10',
|
|
2638
2638
|
};
|
|
2639
2639
|
const loadingSkeletonClassName = 'tw-bg-grey-500';
|
|
2640
|
-
|
|
2640
|
+
var ImageState;
|
|
2641
|
+
(function (ImageState) {
|
|
2642
|
+
ImageState[ImageState["LOADING"] = 0] = "LOADING";
|
|
2643
|
+
ImageState[ImageState["LOADED"] = 1] = "LOADED";
|
|
2644
|
+
ImageState[ImageState["ERROR"] = 2] = "ERROR";
|
|
2645
|
+
})(ImageState || (ImageState = {}));
|
|
2646
|
+
function BadgeImage({ imageUrl: _imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, rounded = false, placeholderImageUrl, }) {
|
|
2647
|
+
const imageUrl = (_imageUrl === null || _imageUrl === void 0 ? void 0 : _imageUrl.trim()) || placeholderImageUrl;
|
|
2641
2648
|
const [imagesLoadState, setImageLoadState] = React.useState({
|
|
2642
|
-
|
|
2643
|
-
|
|
2649
|
+
badge: ImageState.LOADING,
|
|
2650
|
+
mainImage: ImageState.LOADING,
|
|
2644
2651
|
});
|
|
2645
2652
|
const badgeImageClassName = cn('tw-absolute -tw-right-1/3 tw-bottom-0 tw-z-10 tw-m-0 -tw-translate-x-1/3 tw-rounded-md tw-border-[1px] tw-border-grey-800', badgeSizeClassMap[size]);
|
|
2646
2653
|
const mainImageClassName = cn('tw-h-full tw-w-full tw-absolute', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs');
|
|
2647
|
-
return imageUrl ? (jsxRuntime.jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [
|
|
2654
|
+
return imageUrl ? (jsxRuntime.jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [imagesLoadState.mainImage !== ImageState.LOADED &&
|
|
2655
|
+
(placeholderImageUrl ? (jsxRuntime.jsx("img", { src: placeholderImageUrl, alt: "", className: mainImageClassName })) : (jsxRuntime.jsx("div", { className: cn(mainImageClassName, loadingSkeletonClassName) }))), jsxRuntime.jsx("img", { src: imageUrl, alt: "", onError: () => {
|
|
2656
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { mainImage: ImageState.ERROR })));
|
|
2657
|
+
}, onLoad: () => {
|
|
2648
2658
|
// update state when image is fully loaded
|
|
2649
|
-
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), {
|
|
2659
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { mainImage: ImageState.LOADED })));
|
|
2650
2660
|
}, className: cn(mainImageClassName,
|
|
2651
2661
|
// hide main image while it is loading, and display it when it is loaded
|
|
2652
|
-
imagesLoadState.
|
|
2662
|
+
imagesLoadState.mainImage === ImageState.LOADED
|
|
2663
|
+
? 'tw-block'
|
|
2664
|
+
: 'tw-hidden') }), badgeUrl ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [imagesLoadState.badge !== ImageState.LOADED &&
|
|
2665
|
+
(placeholderImageUrl ? (jsxRuntime.jsx("img", { src: placeholderImageUrl, alt: "", className: badgeImageClassName })) : (jsxRuntime.jsx("div", { className: cn(badgeImageClassName, loadingSkeletonClassName) }))), jsxRuntime.jsx("img", { src: badgeUrl, alt: "", onError: () => {
|
|
2666
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { badge: ImageState.ERROR })));
|
|
2667
|
+
}, onLoad: () => {
|
|
2653
2668
|
// update state when badge image is fully loaded
|
|
2654
|
-
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), {
|
|
2669
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { badge: ImageState.LOADED })));
|
|
2655
2670
|
}, className: cn(badgeImageClassName,
|
|
2656
2671
|
// hide badge image while it is loading, and display it when it is loaded
|
|
2657
|
-
imagesLoadState.
|
|
2672
|
+
imagesLoadState.badge === ImageState.LOADED
|
|
2673
|
+
? 'tw-block'
|
|
2674
|
+
: 'tw-hidden') })] })) : null] })) : null;
|
|
2658
2675
|
}
|
|
2659
2676
|
|
|
2660
2677
|
/******************************************************************************
|
|
@@ -3075,92 +3092,6 @@ const themeTypesKeys = {
|
|
|
3075
3092
|
},
|
|
3076
3093
|
};
|
|
3077
3094
|
|
|
3078
|
-
function PlusIcon() {
|
|
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: "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 = React.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 (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
|
|
3111
|
-
? 'tw-w-[90px]'
|
|
3112
|
-
: 'tw-w-full tw-max-w-[72px]'), style: {
|
|
3113
|
-
backgroundImage: bgGradient,
|
|
3114
|
-
}, 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: {
|
|
3115
|
-
backgroundColor: tokenBgColor,
|
|
3116
|
-
} }), 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: {
|
|
3117
|
-
backgroundColor: tokenBgColor,
|
|
3118
|
-
color: token === null || token === void 0 ? void 0 : token.textColor,
|
|
3119
|
-
}, children: [jsxRuntime.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 && jsxRuntime.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
3095
|
function SearchIcon() {
|
|
3165
3096
|
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" }) }));
|
|
3166
3097
|
}
|
|
@@ -16721,12 +16652,73 @@ AppContainer.Content = (props) => (jsxRuntime.jsx(motion.div, Object.assign({ tr
|
|
|
16721
16652
|
}, layout: "position", layoutDependency: React.useContext(LayoutDependencyContext), layoutId: "app-container-content" }, props)));
|
|
16722
16653
|
const elementKey = (child) => React.isValidElement(child) ? child.key : null;
|
|
16723
16654
|
|
|
16655
|
+
const CSS_VARS = {
|
|
16656
|
+
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
16657
|
+
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
16658
|
+
COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
|
|
16659
|
+
EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
|
|
16660
|
+
FADE_IN_DURATION: '--squid-animation-fade-in-duration',
|
|
16661
|
+
FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
|
|
16662
|
+
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
16663
|
+
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
16664
|
+
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
16665
|
+
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
16666
|
+
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
16667
|
+
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
16668
|
+
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
16669
|
+
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
16670
|
+
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
16671
|
+
};
|
|
16672
|
+
const ANIMATION_DURATIONS = {
|
|
16673
|
+
SHOW_ROUTE: 300,
|
|
16674
|
+
HIDE_ROUTE: 300,
|
|
16675
|
+
CHANGE_SWAP_STEP: 300,
|
|
16676
|
+
SHOW_MODAL: 400,
|
|
16677
|
+
HIDE_MODAL: 400,
|
|
16678
|
+
BOOST_BUTTON: 500,
|
|
16679
|
+
};
|
|
16680
|
+
const ANIMATION_TIMINGS = {
|
|
16681
|
+
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
16682
|
+
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
16683
|
+
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
16684
|
+
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
16685
|
+
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
16686
|
+
};
|
|
16687
|
+
const MEDIA_QUERIES = {
|
|
16688
|
+
MOBILE_LG: {
|
|
16689
|
+
media: '(min-width: 480px)',
|
|
16690
|
+
key: 'mobile-lg',
|
|
16691
|
+
value: '480px',
|
|
16692
|
+
},
|
|
16693
|
+
};
|
|
16694
|
+
|
|
16695
|
+
function BoostButton({ boostMode, canToggleBoostMode = true, boostIndicatorRef, }) {
|
|
16696
|
+
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 &&
|
|
16697
|
+
'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 &&
|
|
16698
|
+
'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: {
|
|
16699
|
+
boxShadow: generateMarkerLines(40),
|
|
16700
|
+
} })] }), 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: {
|
|
16701
|
+
transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
|
|
16702
|
+
} })] }) }));
|
|
16703
|
+
}
|
|
16704
|
+
function generateMarkerLines(count) {
|
|
16705
|
+
const halfCount = Math.ceil(count / 2);
|
|
16706
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
16707
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
16708
|
+
});
|
|
16709
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
16710
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
16711
|
+
});
|
|
16712
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
16713
|
+
return allShadows.join(', ');
|
|
16714
|
+
}
|
|
16715
|
+
|
|
16724
16716
|
function Chip(_a) {
|
|
16725
16717
|
var { label, icon } = _a, props = __rest$1(_a, ["label", "icon"]);
|
|
16726
16718
|
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) })));
|
|
16727
16719
|
}
|
|
16728
16720
|
|
|
16729
|
-
function Boost({ boostMode, onToggleBoostMode, estimatedTime,
|
|
16721
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, canToggleBoostMode = true, tooltip, }) {
|
|
16730
16722
|
const boostIndicatorRef = React.useRef(null);
|
|
16731
16723
|
function handleToggleBoostMode() {
|
|
16732
16724
|
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
@@ -16743,9 +16735,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
|
|
|
16743
16735
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
16744
16736
|
}
|
|
16745
16737
|
}
|
|
16746
|
-
return (jsxRuntime.jsx(
|
|
16738
|
+
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
|
|
16747
16739
|
? 'tw-bg-grey-300'
|
|
16748
|
-
: 'tw-bg-status-positive') })] }) }));
|
|
16740
|
+
: 'tw-bg-status-positive') })] }) })));
|
|
16749
16741
|
}
|
|
16750
16742
|
|
|
16751
16743
|
function Join({ children, glue }) {
|
|
@@ -16857,8 +16849,8 @@ function EthereumIcon() {
|
|
|
16857
16849
|
}
|
|
16858
16850
|
|
|
16859
16851
|
function FeeButton(_a) {
|
|
16860
|
-
var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className"]);
|
|
16861
|
-
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 })] })] })));
|
|
16852
|
+
var { feeInUsd = '0', chipLabel = 'Fee', className, tooltip } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className", "tooltip"]);
|
|
16853
|
+
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 })] })] })) })));
|
|
16862
16854
|
}
|
|
16863
16855
|
|
|
16864
16856
|
function EmojiSadIcon({ className, size = '20', }) {
|
|
@@ -16878,7 +16870,8 @@ const detailStateClassMap = {
|
|
|
16878
16870
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
16879
16871
|
full: '',
|
|
16880
16872
|
};
|
|
16881
|
-
function DetailsToolbar({ errorMessage,
|
|
16873
|
+
function DetailsToolbar({ errorMessage, estimatedTime, helpButton, isLoading, isEmpty, flipButton, feeButton, boostButton, }) {
|
|
16874
|
+
var _a;
|
|
16882
16875
|
const state = React.useMemo(() => {
|
|
16883
16876
|
if (errorMessage)
|
|
16884
16877
|
return 'error';
|
|
@@ -16891,10 +16884,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
16891
16884
|
const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
|
|
16892
16885
|
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'
|
|
16893
16886
|
? '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 ? (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, {
|
|
16895
|
-
|
|
16896
|
-
: 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) &&
|
|
16897
|
-
'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 }) })] })) }));
|
|
16887
|
+
: '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) &&
|
|
16888
|
+
'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 }) })] })) }));
|
|
16898
16889
|
}
|
|
16899
16890
|
|
|
16900
16891
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -17094,7 +17085,7 @@ const collapsedListItemClassMap = {
|
|
|
17094
17085
|
large: 'tw-w-[80px]',
|
|
17095
17086
|
};
|
|
17096
17087
|
function ListItem(_a) {
|
|
17097
|
-
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading, containerProps, compactOnMobile } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile"]);
|
|
17088
|
+
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading, containerProps, compactOnMobile } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile"]);
|
|
17098
17089
|
const subtitleClassName = cn('tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500', compactOnMobile ? 'tw-hidden mobile-lg:tw-block' : 'tw-block');
|
|
17099
17090
|
// 'small' variant does not have detail
|
|
17100
17091
|
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
@@ -17127,7 +17118,7 @@ function ListItem(_a) {
|
|
|
17127
17118
|
const itemProps = isInteractive ? props : {};
|
|
17128
17119
|
return (jsxRuntime.jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], compactOnMobile
|
|
17129
17120
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
17130
|
-
: 'tw-w-full', className), children: jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isSelected && 'tw-bg-material-light-thin', isInteractive && 'hover:tw-bg-material-light-thin'), children: [size === 'large' ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs',
|
|
17121
|
+
: 'tw-w-full', className), children: jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isSelected && 'tw-bg-material-light-thin', isInteractive && 'hover:tw-bg-material-light-thin'), children: [size === 'large' ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, placeholderImageUrl: placeholderImageUrl, size: "md", rounded: rounded })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs',
|
|
17131
17122
|
// 'large' variant has extra padding
|
|
17132
17123
|
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-max-w-full tw-truncate', subtitle && 'tw-h-[17px] !tw-leading-[17px]', compactOnMobile ? 'tw-hidden mobile-lg:tw-block' : 'tw-block'), children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
17133
17124
|
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (loadingComponent()) : subtitle ? (jsxRuntime.jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsxRuntime.jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxRuntime.jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
@@ -17513,11 +17504,11 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
|
|
|
17513
17504
|
? 'tw-px-squid-m'
|
|
17514
17505
|
: 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsxRuntime.jsx(Button$1, { className: displayButtonShadows
|
|
17515
17506
|
? '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: 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'
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17507
|
+
: 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'
|
|
17508
|
+
? action.labelOrIcon
|
|
17509
|
+
: undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
|
|
17510
|
+
? null
|
|
17511
|
+
: 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] }));
|
|
17521
17512
|
}
|
|
17522
17513
|
|
|
17523
17514
|
const createStoreImpl = (createState) => {
|
|
@@ -18106,21 +18097,27 @@ function LogoContainer({ children }) {
|
|
|
18106
18097
|
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
|
|
18107
18098
|
}
|
|
18108
18099
|
|
|
18109
|
-
function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange,
|
|
18110
|
-
var _a, _b;
|
|
18111
|
-
const isWalletButtonInteractive = !isLoading && !!
|
|
18100
|
+
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, }) {
|
|
18101
|
+
var _a, _b, _c;
|
|
18102
|
+
const isWalletButtonInteractive = !isLoading && !!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick);
|
|
18112
18103
|
const WalletButtonTag = isWalletButtonInteractive ? 'button' : 'div';
|
|
18113
18104
|
const isFetching = isFetchingProp || isLoading;
|
|
18114
|
-
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-
|
|
18115
|
-
|
|
18116
|
-
|
|
18105
|
+
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)
|
|
18106
|
+
? 'tw-text-grey-300'
|
|
18107
|
+
: 'tw-text-royal-400', children: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18108
|
+
? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
|
|
18109
|
+
: (_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)
|
|
18110
|
+
? 'tw-text-grey-600'
|
|
18111
|
+
: '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: {
|
|
18112
|
+
decimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18,
|
|
18113
|
+
symbol: (_c = token === null || token === void 0 ? void 0 : token.symbol) !== null && _c !== void 0 ? _c : '',
|
|
18117
18114
|
price: tokenPrice,
|
|
18118
18115
|
}, onAmountChange: (value) => {
|
|
18119
18116
|
onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value);
|
|
18120
18117
|
}, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
|
|
18121
18118
|
token: '0.001',
|
|
18122
18119
|
usd: '0.01',
|
|
18123
|
-
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount,
|
|
18120
|
+
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading })] }));
|
|
18124
18121
|
}
|
|
18125
18122
|
|
|
18126
18123
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -24225,6 +24222,153 @@ function Toast({ headerContent, actionsContent, description, chipLabel, title, }
|
|
|
24225
24222
|
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" }))] }));
|
|
24226
24223
|
}
|
|
24227
24224
|
|
|
24225
|
+
const gapBetweenTooltipAndContainer = 10;
|
|
24226
|
+
const tooltipWidthClassMap = {
|
|
24227
|
+
max: 'tw-w-max',
|
|
24228
|
+
container: 'tw-w-full',
|
|
24229
|
+
};
|
|
24230
|
+
const tooltipThresholdPaddingMap = {
|
|
24231
|
+
xxs: '5px',
|
|
24232
|
+
xs: '10px',
|
|
24233
|
+
s: '15px',
|
|
24234
|
+
m: '20px',
|
|
24235
|
+
l: '30px',
|
|
24236
|
+
xl: '40px',
|
|
24237
|
+
xxl: '60px',
|
|
24238
|
+
};
|
|
24239
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: containerRefProp, }) {
|
|
24240
|
+
const containerRefState = useContainerStore((state) => state.containerRef);
|
|
24241
|
+
const containerRef = (containerRefProp === null || containerRefProp === void 0 ? void 0 : containerRefProp.current)
|
|
24242
|
+
? containerRefProp
|
|
24243
|
+
: containerRefState;
|
|
24244
|
+
const [tooltipPositionStyle, setTooltipPositionStyle] = React.useState({});
|
|
24245
|
+
const [isTooltipVisible, setIsTooltipVisible] = React.useState(false);
|
|
24246
|
+
const [isTooltipVisibleDelayed, setIsTooltipVisibleDelayed] = React.useState(false);
|
|
24247
|
+
const tooltipRef = React.useRef(null);
|
|
24248
|
+
const tooltipTriggerRef = React.useRef(null);
|
|
24249
|
+
const delayTimeoutRef = React.useRef(null);
|
|
24250
|
+
React.useEffect(() => {
|
|
24251
|
+
const adjustTooltipPosition = () => {
|
|
24252
|
+
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
24253
|
+
!tooltipRef.current ||
|
|
24254
|
+
!tooltipTriggerRef.current) {
|
|
24255
|
+
// if any of the refs is not defined, we can't calculate the position
|
|
24256
|
+
// so we just try to center the tooltip
|
|
24257
|
+
return setTooltipPositionStyle({
|
|
24258
|
+
bottom: '100%',
|
|
24259
|
+
left: '50%',
|
|
24260
|
+
transform: 'translateX(-50%)',
|
|
24261
|
+
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24262
|
+
});
|
|
24263
|
+
}
|
|
24264
|
+
// get the bounding rects of the container, tooltip and trigger
|
|
24265
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
24266
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
24267
|
+
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
24268
|
+
// check if the tooltip fits below the trigger
|
|
24269
|
+
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
24270
|
+
// check if the tooltip fits above the trigger
|
|
24271
|
+
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
24272
|
+
// get the y position of the center of the tooltip trigger
|
|
24273
|
+
const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
|
|
24274
|
+
// get the x position of the center of the tooltip trigger
|
|
24275
|
+
const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
|
|
24276
|
+
let tooltipYPosition = 'top';
|
|
24277
|
+
if (tooltipFitsAbove) {
|
|
24278
|
+
tooltipYPosition = 'top';
|
|
24279
|
+
}
|
|
24280
|
+
else if (tooltipFitsBelow) {
|
|
24281
|
+
tooltipYPosition = 'bottom';
|
|
24282
|
+
}
|
|
24283
|
+
else if (
|
|
24284
|
+
// if the tooltip doesn't fit above or below the trigger,
|
|
24285
|
+
// we just place it where there's more space available
|
|
24286
|
+
triggerMiddleY - containerRect.top >
|
|
24287
|
+
containerRect.bottom - triggerMiddleY) {
|
|
24288
|
+
tooltipYPosition = 'top';
|
|
24289
|
+
}
|
|
24290
|
+
else {
|
|
24291
|
+
tooltipYPosition = 'bottom';
|
|
24292
|
+
}
|
|
24293
|
+
const top = tooltipYPosition === 'top'
|
|
24294
|
+
? -tooltipRect.height
|
|
24295
|
+
: tooltipTriggerRect.height;
|
|
24296
|
+
const paddingStyles = tooltipYPosition === 'top'
|
|
24297
|
+
? {
|
|
24298
|
+
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24299
|
+
}
|
|
24300
|
+
: {
|
|
24301
|
+
paddingTop: tooltipThresholdPaddingMap[threshold],
|
|
24302
|
+
};
|
|
24303
|
+
let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
24304
|
+
const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
|
|
24305
|
+
const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
|
|
24306
|
+
const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
|
|
24307
|
+
const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
|
|
24308
|
+
// 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
|
|
24309
|
+
if (tooltipOverflowsContainerLeft) {
|
|
24310
|
+
left =
|
|
24311
|
+
-(tooltipTriggerRect.left - containerRect.left) +
|
|
24312
|
+
gapBetweenTooltipAndContainer;
|
|
24313
|
+
}
|
|
24314
|
+
else if (tooltipOverflowsContainerRight) {
|
|
24315
|
+
left =
|
|
24316
|
+
-(containerRect.right - tooltipTriggerRect.right) +
|
|
24317
|
+
gapBetweenTooltipAndContainer;
|
|
24318
|
+
}
|
|
24319
|
+
setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
|
|
24320
|
+
? { left }
|
|
24321
|
+
: tooltipOverflowsContainerRight
|
|
24322
|
+
? { right: left }
|
|
24323
|
+
: // if the tooltip doesn't overflow the container, we just center it
|
|
24324
|
+
{
|
|
24325
|
+
left: '50%',
|
|
24326
|
+
transform: 'translateX(-50%)',
|
|
24327
|
+
})), paddingStyles));
|
|
24328
|
+
};
|
|
24329
|
+
adjustTooltipPosition();
|
|
24330
|
+
const timeoutId = setTimeout(() => {
|
|
24331
|
+
adjustTooltipPosition();
|
|
24332
|
+
}, 300);
|
|
24333
|
+
window.addEventListener('resize', adjustTooltipPosition);
|
|
24334
|
+
return () => {
|
|
24335
|
+
clearTimeout(timeoutId);
|
|
24336
|
+
window.removeEventListener('resize', adjustTooltipPosition);
|
|
24337
|
+
};
|
|
24338
|
+
}, [
|
|
24339
|
+
containerRef,
|
|
24340
|
+
tooltipContent,
|
|
24341
|
+
threshold,
|
|
24342
|
+
tooltipWidth,
|
|
24343
|
+
displayDelayMs,
|
|
24344
|
+
isTooltipVisible,
|
|
24345
|
+
]);
|
|
24346
|
+
const handleMouseEnter = React.useCallback((e) => {
|
|
24347
|
+
var _a;
|
|
24348
|
+
if (e.target === tooltipRef.current ||
|
|
24349
|
+
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
24350
|
+
return;
|
|
24351
|
+
}
|
|
24352
|
+
setIsTooltipVisible(true);
|
|
24353
|
+
if (delayTimeoutRef.current) {
|
|
24354
|
+
clearTimeout(delayTimeoutRef.current);
|
|
24355
|
+
}
|
|
24356
|
+
delayTimeoutRef.current = setTimeout(() => {
|
|
24357
|
+
setIsTooltipVisibleDelayed(true);
|
|
24358
|
+
}, displayDelayMs);
|
|
24359
|
+
}, [displayDelayMs, tooltipRef, delayTimeoutRef]);
|
|
24360
|
+
const handleMouseLeave = React.useCallback(() => {
|
|
24361
|
+
setIsTooltipVisible(false);
|
|
24362
|
+
setIsTooltipVisibleDelayed(false);
|
|
24363
|
+
if (delayTimeoutRef.current) {
|
|
24364
|
+
clearTimeout(delayTimeoutRef.current);
|
|
24365
|
+
}
|
|
24366
|
+
}, [delayTimeoutRef]);
|
|
24367
|
+
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
|
|
24368
|
+
? '!tw-opacity-100 tw-z-40 tw-visible'
|
|
24369
|
+
: 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none tw-invisible', tooltipWidthClassMap[tooltipWidth], tooltipClassName), children: tooltipContent })) : null] }));
|
|
24370
|
+
}
|
|
24371
|
+
|
|
24228
24372
|
const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
|
|
24229
24373
|
// checks that the value includes at least one character different than `0` (zero), or `.` (dot)
|
|
24230
24374
|
const RegExpNonZeroValue = /[^0.]/;
|
|
@@ -24239,7 +24383,7 @@ var InputMode;
|
|
|
24239
24383
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24240
24384
|
token: '0.001',
|
|
24241
24385
|
usd: '0.01',
|
|
24242
|
-
}, showDetails = true, isLoading = false, direction,
|
|
24386
|
+
}, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, }) {
|
|
24243
24387
|
var _a;
|
|
24244
24388
|
const [inputValue, setInputValue] = React.useState('');
|
|
24245
24389
|
const [inputMode, setInputMode] = React.useState(InputMode.TOKEN);
|
|
@@ -24337,6 +24481,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24337
24481
|
};
|
|
24338
24482
|
const { isTokenAmountVerySmall, isUsdAmountVerySmall } = getRawAmounts(inputValue);
|
|
24339
24483
|
const amountFormatted = React.useMemo(() => {
|
|
24484
|
+
var _a;
|
|
24340
24485
|
if (inputValue === '')
|
|
24341
24486
|
return '0';
|
|
24342
24487
|
if (inputMode === InputMode.TOKEN) {
|
|
@@ -24344,13 +24489,19 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24344
24489
|
return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
|
|
24345
24490
|
}
|
|
24346
24491
|
else {
|
|
24347
|
-
return formatAmount(amountUsd !== null &&
|
|
24492
|
+
return formatAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : '0');
|
|
24348
24493
|
}
|
|
24349
24494
|
}
|
|
24350
24495
|
else {
|
|
24351
24496
|
return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
24352
24497
|
}
|
|
24353
|
-
}, [
|
|
24498
|
+
}, [
|
|
24499
|
+
inputValue,
|
|
24500
|
+
inputMode,
|
|
24501
|
+
token.price,
|
|
24502
|
+
direction,
|
|
24503
|
+
inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
|
|
24504
|
+
]);
|
|
24354
24505
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
24355
24506
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
24356
24507
|
? 'tw-text-status-negative'
|
|
@@ -24361,15 +24512,21 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24361
24512
|
}, [balance]);
|
|
24362
24513
|
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) => {
|
|
24363
24514
|
e.preventDefault();
|
|
24364
|
-
}, 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.
|
|
24365
|
-
|
|
24366
|
-
|
|
24515
|
+
}, 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
|
|
24516
|
+
? undefined
|
|
24517
|
+
: inputMode === InputMode.TOKEN
|
|
24518
|
+
? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
|
|
24519
|
+
: 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
|
|
24520
|
+
? interactiveChipClassName
|
|
24521
|
+
: 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
|
|
24522
|
+
? formatIfVerySmall.token
|
|
24523
|
+
: amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24367
24524
|
? formatIfVerySmall.token
|
|
24368
|
-
: amountFormatted })
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
24372
|
-
|
|
24525
|
+
: 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
|
|
24526
|
+
? 'tw-opacity-0'
|
|
24527
|
+
: '' }), 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
|
|
24528
|
+
? interactiveChipClassName
|
|
24529
|
+
: notInteractiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balanceFormatted }), jsxRuntime.jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
24373
24530
|
}
|
|
24374
24531
|
|
|
24375
24532
|
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
@@ -24471,172 +24628,50 @@ function Switch({ checked = false, onChange, size, disabled = false, }) {
|
|
|
24471
24628
|
: 'tw-bg-grey-500') })] }));
|
|
24472
24629
|
}
|
|
24473
24630
|
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24631
|
+
function PlusIcon() {
|
|
24632
|
+
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" }) }));
|
|
24633
|
+
}
|
|
24634
|
+
|
|
24635
|
+
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
24636
|
+
const themeKeyVariantMap = {
|
|
24637
|
+
primary: 'grey-800',
|
|
24638
|
+
accent: 'royal-500',
|
|
24478
24639
|
};
|
|
24479
|
-
const
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
s: '15px',
|
|
24483
|
-
m: '20px',
|
|
24484
|
-
l: '30px',
|
|
24485
|
-
xl: '40px',
|
|
24486
|
-
xxl: '60px',
|
|
24640
|
+
const buttonTextClassNameMap = {
|
|
24641
|
+
primary: 'tw-text-grey-300',
|
|
24642
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
24487
24643
|
};
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
const
|
|
24495
|
-
const
|
|
24496
|
-
const
|
|
24497
|
-
const
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
const adjustTooltipPosition = () => {
|
|
24501
|
-
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
24502
|
-
!tooltipRef.current ||
|
|
24503
|
-
!tooltipTriggerRef.current) {
|
|
24504
|
-
// if any of the refs is not defined, we can't calculate the position
|
|
24505
|
-
// so we just try to center the tooltip
|
|
24506
|
-
return setTooltipPositionStyle({
|
|
24507
|
-
bottom: '100%',
|
|
24508
|
-
left: '50%',
|
|
24509
|
-
transform: 'translateX(-50%)',
|
|
24510
|
-
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24511
|
-
});
|
|
24512
|
-
}
|
|
24513
|
-
// get the bounding rects of the container, tooltip and trigger
|
|
24514
|
-
const containerRect = containerRef.current.getBoundingClientRect();
|
|
24515
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
24516
|
-
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
24517
|
-
// check if the tooltip fits below the trigger
|
|
24518
|
-
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
24519
|
-
// check if the tooltip fits above the trigger
|
|
24520
|
-
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
24521
|
-
// get the y position of the center of the tooltip trigger
|
|
24522
|
-
const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
|
|
24523
|
-
// get the x position of the center of the tooltip trigger
|
|
24524
|
-
const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
|
|
24525
|
-
let tooltipYPosition = 'top';
|
|
24526
|
-
if (tooltipFitsAbove) {
|
|
24527
|
-
tooltipYPosition = 'top';
|
|
24528
|
-
}
|
|
24529
|
-
else if (tooltipFitsBelow) {
|
|
24530
|
-
tooltipYPosition = 'bottom';
|
|
24531
|
-
}
|
|
24532
|
-
else if (
|
|
24533
|
-
// if the tooltip doesn't fit above or below the trigger,
|
|
24534
|
-
// we just place it where there's more space available
|
|
24535
|
-
triggerMiddleY - containerRect.top >
|
|
24536
|
-
containerRect.bottom - triggerMiddleY) {
|
|
24537
|
-
tooltipYPosition = 'top';
|
|
24538
|
-
}
|
|
24539
|
-
else {
|
|
24540
|
-
tooltipYPosition = 'bottom';
|
|
24541
|
-
}
|
|
24542
|
-
const top = tooltipYPosition === 'top'
|
|
24543
|
-
? -tooltipRect.height
|
|
24544
|
-
: tooltipTriggerRect.height;
|
|
24545
|
-
const paddingStyles = tooltipYPosition === 'top'
|
|
24546
|
-
? {
|
|
24547
|
-
paddingBottom: tooltipThresholdPaddingMap[threshold],
|
|
24548
|
-
}
|
|
24549
|
-
: {
|
|
24550
|
-
paddingTop: tooltipThresholdPaddingMap[threshold],
|
|
24551
|
-
};
|
|
24552
|
-
let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
24553
|
-
const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
|
|
24554
|
-
const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
|
|
24555
|
-
const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
|
|
24556
|
-
const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
|
|
24557
|
-
// 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
|
|
24558
|
-
if (tooltipOverflowsContainerLeft) {
|
|
24559
|
-
left =
|
|
24560
|
-
-(tooltipTriggerRect.left - containerRect.left) +
|
|
24561
|
-
gapBetweenTooltipAndContainer;
|
|
24562
|
-
}
|
|
24563
|
-
else if (tooltipOverflowsContainerRight) {
|
|
24564
|
-
left =
|
|
24565
|
-
-(containerRect.right - tooltipTriggerRect.right) +
|
|
24566
|
-
gapBetweenTooltipAndContainer;
|
|
24567
|
-
}
|
|
24568
|
-
setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
|
|
24569
|
-
? { left }
|
|
24570
|
-
: tooltipOverflowsContainerRight
|
|
24571
|
-
? { right: left }
|
|
24572
|
-
: // if the tooltip doesn't overflow the container, we just center it
|
|
24573
|
-
{
|
|
24574
|
-
left: '50%',
|
|
24575
|
-
transform: 'translateX(-50%)',
|
|
24576
|
-
})), paddingStyles));
|
|
24577
|
-
};
|
|
24578
|
-
adjustTooltipPosition();
|
|
24579
|
-
const timeoutId = setTimeout(() => {
|
|
24580
|
-
adjustTooltipPosition();
|
|
24581
|
-
}, 300);
|
|
24582
|
-
window.addEventListener('resize', adjustTooltipPosition);
|
|
24583
|
-
return () => {
|
|
24584
|
-
clearTimeout(timeoutId);
|
|
24585
|
-
window.removeEventListener('resize', adjustTooltipPosition);
|
|
24586
|
-
};
|
|
24587
|
-
}, [
|
|
24588
|
-
containerRef,
|
|
24589
|
-
tooltipContent,
|
|
24590
|
-
threshold,
|
|
24591
|
-
tooltipWidth,
|
|
24592
|
-
displayDelayMs,
|
|
24593
|
-
isTooltipVisible,
|
|
24594
|
-
]);
|
|
24595
|
-
const handleMouseEnter = React.useCallback((e) => {
|
|
24596
|
-
var _a;
|
|
24597
|
-
if (e.target === tooltipRef.current ||
|
|
24598
|
-
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
24599
|
-
return;
|
|
24600
|
-
}
|
|
24601
|
-
setIsTooltipVisible(true);
|
|
24602
|
-
if (delayTimeoutRef.current) {
|
|
24603
|
-
clearTimeout(delayTimeoutRef.current);
|
|
24644
|
+
const emptyChainIconTextClassNameMap = {
|
|
24645
|
+
primary: 'tw-text-grey-100',
|
|
24646
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
24647
|
+
};
|
|
24648
|
+
function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, tooltip, }) {
|
|
24649
|
+
var _a;
|
|
24650
|
+
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
24651
|
+
const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
|
|
24652
|
+
const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
|
|
24653
|
+
const bgGradient = React.useMemo(() => {
|
|
24654
|
+
if (!chain || isLoading) {
|
|
24655
|
+
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
24604
24656
|
}
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
}, displayDelayMs);
|
|
24608
|
-
}, [displayDelayMs, tooltipRef, delayTimeoutRef]);
|
|
24609
|
-
const handleMouseLeave = React.useCallback(() => {
|
|
24610
|
-
setIsTooltipVisible(false);
|
|
24611
|
-
setIsTooltipVisibleDelayed(false);
|
|
24612
|
-
if (delayTimeoutRef.current) {
|
|
24613
|
-
clearTimeout(delayTimeoutRef.current);
|
|
24657
|
+
if (!token) {
|
|
24658
|
+
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
24614
24659
|
}
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24628
|
-
|
|
24629
|
-
}
|
|
24630
|
-
function generateMarkerLines(count) {
|
|
24631
|
-
const halfCount = Math.ceil(count / 2);
|
|
24632
|
-
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
24633
|
-
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
24634
|
-
});
|
|
24635
|
-
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
24636
|
-
return `${(index + 1) * 6}px 0 currentColor`;
|
|
24637
|
-
});
|
|
24638
|
-
const allShadows = [...rightShadows, ...leftShadows];
|
|
24639
|
-
return allShadows.join(', ');
|
|
24660
|
+
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
24661
|
+
}, [chainBgColor, tokenBgColor, chain, token, isLoading]);
|
|
24662
|
+
const ButtonTag = isLoading ? 'div' : 'button';
|
|
24663
|
+
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
|
|
24664
|
+
? 'tw-w-[90px]'
|
|
24665
|
+
: 'tw-w-full tw-max-w-[72px]'), style: {
|
|
24666
|
+
backgroundImage: bgGradient,
|
|
24667
|
+
}, 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: {
|
|
24668
|
+
backgroundColor: tokenBgColor,
|
|
24669
|
+
} }), 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: {
|
|
24670
|
+
backgroundColor: tokenBgColor,
|
|
24671
|
+
color: token === null || token === void 0 ? void 0 : token.textColor,
|
|
24672
|
+
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
|
|
24673
|
+
? token.symbol
|
|
24674
|
+
: !isLoading && 'Select token' }), !isLoading && jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }) })));
|
|
24640
24675
|
}
|
|
24641
24676
|
|
|
24642
24677
|
function FilterIcon() {
|
|
@@ -24688,10 +24723,16 @@ function MainView({ isLoading }) {
|
|
|
24688
24723
|
{
|
|
24689
24724
|
labelOrIcon: jsxRuntime.jsx(ClockOutlineIcon, {}),
|
|
24690
24725
|
id: 'history',
|
|
24726
|
+
tooltip: {
|
|
24727
|
+
tooltipContent: 'Swap history',
|
|
24728
|
+
},
|
|
24691
24729
|
},
|
|
24692
24730
|
{
|
|
24693
24731
|
labelOrIcon: jsxRuntime.jsx(SettingsGearIcon, {}),
|
|
24694
24732
|
id: 'settings',
|
|
24733
|
+
tooltip: {
|
|
24734
|
+
tooltipContent: 'Swap preferences',
|
|
24735
|
+
},
|
|
24695
24736
|
},
|
|
24696
24737
|
] }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
|
|
24697
24738
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
|
|
@@ -24702,11 +24743,45 @@ function MainView({ isLoading }) {
|
|
|
24702
24743
|
bgColor: '#627eea',
|
|
24703
24744
|
textColor: '#fff',
|
|
24704
24745
|
decimals: 18,
|
|
24705
|
-
}, priceImpactPercentage: '0.3', balance: '4.57',
|
|
24746
|
+
}, priceImpactPercentage: '0.3', balance: '4.57', walletButton: {
|
|
24747
|
+
address: 'so-so.eth',
|
|
24748
|
+
onClick: () => { },
|
|
24749
|
+
tooltip: {
|
|
24750
|
+
tooltipContent: 'Connect wallet',
|
|
24751
|
+
},
|
|
24752
|
+
}, assetsButton: {
|
|
24753
|
+
tooltip: {
|
|
24754
|
+
tooltipContent: 'Select token',
|
|
24755
|
+
},
|
|
24756
|
+
}, balanceButton: {
|
|
24757
|
+
tooltip: {
|
|
24758
|
+
tooltipContent: 'Max balance',
|
|
24759
|
+
},
|
|
24760
|
+
}, inputModeButton: {
|
|
24761
|
+
usdModeTooltip: {
|
|
24762
|
+
tooltipContent: 'Enter token amount',
|
|
24763
|
+
},
|
|
24764
|
+
tokenModeTooltip: {
|
|
24765
|
+
tooltipContent: 'Enter in USD',
|
|
24766
|
+
},
|
|
24767
|
+
} }), jsxRuntime.jsx(DetailsToolbar, { flipButton: {
|
|
24706
24768
|
isDisabled: true,
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24769
|
+
tooltip: {
|
|
24770
|
+
tooltipContent: 'Not enough USDC to flip the swap',
|
|
24771
|
+
displayDelayMs: 0,
|
|
24772
|
+
},
|
|
24773
|
+
}, boostButton: {
|
|
24774
|
+
canToggleBoostMode: false,
|
|
24775
|
+
tooltip: {
|
|
24776
|
+
tooltipContent: 'Boost not supported for this route',
|
|
24777
|
+
},
|
|
24778
|
+
}, feeButton: {
|
|
24779
|
+
feeInUsd: '0.4',
|
|
24780
|
+
onClick: () => { },
|
|
24781
|
+
tooltip: {
|
|
24782
|
+
tooltipContent: 'View fees',
|
|
24783
|
+
},
|
|
24784
|
+
}, isLoading: isLoading, isEmpty: isLoading }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
|
|
24710
24785
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
|
|
24711
24786
|
bgColor: '#e84142',
|
|
24712
24787
|
}, token: {
|
|
@@ -24715,7 +24790,28 @@ function MainView({ isLoading }) {
|
|
|
24715
24790
|
bgColor: '#2775ca',
|
|
24716
24791
|
textColor: '#fff',
|
|
24717
24792
|
decimals: 6,
|
|
24718
|
-
}, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854',
|
|
24793
|
+
}, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', walletButton: {
|
|
24794
|
+
address: 'so-so.eth',
|
|
24795
|
+
onClick: () => { },
|
|
24796
|
+
tooltip: {
|
|
24797
|
+
tooltipContent: 'Connect wallet',
|
|
24798
|
+
},
|
|
24799
|
+
}, amount: isLoading ? undefined : '100', assetsButton: {
|
|
24800
|
+
tooltip: {
|
|
24801
|
+
tooltipContent: 'Select token',
|
|
24802
|
+
},
|
|
24803
|
+
}, balanceButton: {
|
|
24804
|
+
tooltip: {
|
|
24805
|
+
tooltipContent: 'Max balance',
|
|
24806
|
+
},
|
|
24807
|
+
}, inputModeButton: {
|
|
24808
|
+
usdModeTooltip: {
|
|
24809
|
+
tooltipContent: 'Enter token amount',
|
|
24810
|
+
},
|
|
24811
|
+
tokenModeTooltip: {
|
|
24812
|
+
tooltipContent: 'Enter in USD',
|
|
24813
|
+
},
|
|
24814
|
+
} }), 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 }) })] }));
|
|
24719
24815
|
}
|
|
24720
24816
|
|
|
24721
24817
|
function PunkIcon({ size = '16' }) {
|
|
@@ -60194,6 +60290,7 @@ exports.InteractionTransactionView = InteractionTransactionView;
|
|
|
60194
60290
|
exports.Join = Join;
|
|
60195
60291
|
exports.List = List;
|
|
60196
60292
|
exports.ListItem = ListItem;
|
|
60293
|
+
exports.Loader = Loader;
|
|
60197
60294
|
exports.LoadingProvider = LoadingProvider;
|
|
60198
60295
|
exports.LoadingSkeleton = LoadingSkeleton;
|
|
60199
60296
|
exports.MEDIA_QUERIES = MEDIA_QUERIES;
|