@0xsquid/ui 0.19.5 → 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.
Files changed (32) hide show
  1. package/dist/cjs/index.js +365 -286
  2. package/dist/cjs/types/components/buttons/AssetsButton.d.ts +3 -1
  3. package/dist/cjs/types/components/buttons/BoostButton.d.ts +1 -3
  4. package/dist/cjs/types/components/buttons/FeeButton.d.ts +3 -1
  5. package/dist/cjs/types/components/controls/NumericInput.d.ts +10 -2
  6. package/dist/cjs/types/components/controls/Tooltip.d.ts +1 -1
  7. package/dist/cjs/types/components/layout/Boost.d.ts +3 -3
  8. package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +18 -14
  9. package/dist/cjs/types/components/layout/NavigationBar.d.ts +2 -0
  10. package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +21 -7
  11. package/dist/cjs/types/stories/buttons/AssetsButton.stories.d.ts +1 -0
  12. package/dist/cjs/types/stories/buttons/FeeButton.stories.d.ts +1 -0
  13. package/dist/cjs/types/stories/layout/Boost.stories.d.ts +1 -0
  14. package/dist/cjs/types/stories/layout/DetailsToolbar.stories.d.ts +4 -1
  15. package/dist/cjs/types/stories/layout/SwapConfiguration.stories.d.ts +1 -0
  16. package/dist/esm/index.js +365 -286
  17. package/dist/esm/types/components/buttons/AssetsButton.d.ts +3 -1
  18. package/dist/esm/types/components/buttons/BoostButton.d.ts +1 -3
  19. package/dist/esm/types/components/buttons/FeeButton.d.ts +3 -1
  20. package/dist/esm/types/components/controls/NumericInput.d.ts +10 -2
  21. package/dist/esm/types/components/controls/Tooltip.d.ts +1 -1
  22. package/dist/esm/types/components/layout/Boost.d.ts +3 -3
  23. package/dist/esm/types/components/layout/DetailsToolbar.d.ts +18 -14
  24. package/dist/esm/types/components/layout/NavigationBar.d.ts +2 -0
  25. package/dist/esm/types/components/layout/SwapConfiguration.d.ts +21 -7
  26. package/dist/esm/types/stories/buttons/AssetsButton.stories.d.ts +1 -0
  27. package/dist/esm/types/stories/buttons/FeeButton.stories.d.ts +1 -0
  28. package/dist/esm/types/stories/layout/Boost.stories.d.ts +1 -0
  29. package/dist/esm/types/stories/layout/DetailsToolbar.stories.d.ts +4 -1
  30. package/dist/esm/types/stories/layout/SwapConfiguration.stories.d.ts +1 -0
  31. package/dist/index.d.ts +125 -102
  32. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -3075,92 +3075,6 @@ const themeTypesKeys = {
3075
3075
  },
3076
3076
  };
3077
3077
 
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
3078
  function SearchIcon() {
3165
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" }) }));
3166
3080
  }
@@ -16721,12 +16635,73 @@ AppContainer.Content = (props) => (jsxRuntime.jsx(motion.div, Object.assign({ tr
16721
16635
  }, layout: "position", layoutDependency: React.useContext(LayoutDependencyContext), layoutId: "app-container-content" }, props)));
16722
16636
  const elementKey = (child) => React.isValidElement(child) ? child.key : null;
16723
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
+
16724
16699
  function Chip(_a) {
16725
16700
  var { label, icon } = _a, props = __rest$1(_a, ["label", "icon"]);
16726
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) })));
16727
16702
  }
16728
16703
 
16729
- function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
16704
+ function Boost({ boostMode, onToggleBoostMode, estimatedTime, canToggleBoostMode = true, tooltip, }) {
16730
16705
  const boostIndicatorRef = React.useRef(null);
16731
16706
  function handleToggleBoostMode() {
16732
16707
  if (!boostIndicatorRef.current || !canToggleBoostMode)
@@ -16743,9 +16718,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
16743
16718
  onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
16744
16719
  }
16745
16720
  }
16746
- return (jsxRuntime.jsx("div", { className: "mobile-lg:tw-w-[190px] tw-w-[157px]", 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, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, tooltipDisplayDelayMs: boostTooltipDisplayDelayMs }), jsxRuntime.jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
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
16747
16722
  ? 'tw-bg-grey-300'
16748
- : 'tw-bg-status-positive') })] }) }));
16723
+ : 'tw-bg-status-positive') })] }) })));
16749
16724
  }
16750
16725
 
16751
16726
  function Join({ children, glue }) {
@@ -16857,8 +16832,8 @@ function EthereumIcon() {
16857
16832
  }
16858
16833
 
16859
16834
  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 })] })] })));
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 })] })] })) })));
16862
16837
  }
16863
16838
 
16864
16839
  function EmojiSadIcon({ className, size = '20', }) {
@@ -16878,7 +16853,8 @@ const detailStateClassMap = {
16878
16853
  error: 'tw-opacity-33 tw-pointer-events-none',
16879
16854
  full: '',
16880
16855
  };
16881
- function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, flipButton, }) {
16856
+ function DetailsToolbar({ errorMessage, estimatedTime, helpButton, isLoading, isEmpty, flipButton, feeButton, boostButton, }) {
16857
+ var _a;
16882
16858
  const state = React.useMemo(() => {
16883
16859
  if (errorMessage)
16884
16860
  return 'error';
@@ -16891,10 +16867,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
16891
16867
  const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
16892
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'
16893
16869
  ? '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, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Tooltip, { tooltipContent: (flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled)
16895
- ? flipButton.disabledMessage
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 }) })] })) }));
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 }) })] })) }));
16898
16872
  }
16899
16873
 
16900
16874
  function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
@@ -17513,11 +17487,11 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
17513
17487
  ? 'tw-px-squid-m'
17514
17488
  : 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsxRuntime.jsx(Button$1, { className: displayButtonShadows
17515
17489
  ? '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
- ? action.labelOrIcon
17518
- : undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
17519
- ? null
17520
- : 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] }));
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] }));
17521
17495
  }
17522
17496
 
17523
17497
  const createStoreImpl = (createState) => {
@@ -18106,21 +18080,27 @@ function LogoContainer({ children }) {
18106
18080
  return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
18107
18081
  }
18108
18082
 
18109
- function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = false, }) {
18110
- var _a, _b;
18111
- const isWalletButtonInteractive = !isLoading && !!onWalletButtonClick;
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);
18112
18086
  const WalletButtonTag = isWalletButtonInteractive ? 'button' : 'div';
18113
18087
  const isFetching = isFetchingProp || isLoading;
18114
- return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxRuntime.jsxs(WalletButtonTag, { onClick: isWalletButtonInteractive ? onWalletButtonClick : 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: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsxRuntime.jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] }))] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { onClick: onAssetsButtonClick, chain: chain, token: token, isLoading: isLoading, variant: assetsButtonVariant }) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
18115
- decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
18116
- symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
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 : '',
18117
18097
  price: tokenPrice,
18118
18098
  }, onAmountChange: (value) => {
18119
18099
  onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value);
18120
18100
  }, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
18121
18101
  token: '0.001',
18122
18102
  usd: '0.01',
18123
- }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive && !isLoading })] }));
18103
+ }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading })] }));
18124
18104
  }
18125
18105
 
18126
18106
  function SwapProgressViewHeader({ title, description, }) {
@@ -24225,6 +24205,153 @@ function Toast({ headerContent, actionsContent, description, chipLabel, title, }
24225
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" }))] }));
24226
24206
  }
24227
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
+
24228
24355
  const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
24229
24356
  // checks that the value includes at least one character different than `0` (zero), or `.` (dot)
24230
24357
  const RegExpNonZeroValue = /[^0.]/;
@@ -24239,7 +24366,7 @@ var InputMode;
24239
24366
  function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
24240
24367
  token: '0.001',
24241
24368
  usd: '0.01',
24242
- }, showDetails = true, isLoading = false, direction, amountUsd, isInteractive = false, }) {
24369
+ }, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, }) {
24243
24370
  var _a;
24244
24371
  const [inputValue, setInputValue] = React.useState('');
24245
24372
  const [inputMode, setInputMode] = React.useState(InputMode.TOKEN);
@@ -24337,6 +24464,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24337
24464
  };
24338
24465
  const { isTokenAmountVerySmall, isUsdAmountVerySmall } = getRawAmounts(inputValue);
24339
24466
  const amountFormatted = React.useMemo(() => {
24467
+ var _a;
24340
24468
  if (inputValue === '')
24341
24469
  return '0';
24342
24470
  if (inputMode === InputMode.TOKEN) {
@@ -24344,13 +24472,19 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24344
24472
  return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
24345
24473
  }
24346
24474
  else {
24347
- return formatAmount(amountUsd !== null && amountUsd !== void 0 ? amountUsd : '0');
24475
+ return formatAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : '0');
24348
24476
  }
24349
24477
  }
24350
24478
  else {
24351
24479
  return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
24352
24480
  }
24353
- }, [inputValue, inputMode, token.price, direction, amountUsd]);
24481
+ }, [
24482
+ inputValue,
24483
+ inputMode,
24484
+ token.price,
24485
+ direction,
24486
+ inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
24487
+ ]);
24354
24488
  const AmountChip = isInteractive ? 'button' : 'div';
24355
24489
  const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
24356
24490
  ? 'tw-text-status-negative'
@@ -24361,15 +24495,21 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24361
24495
  }, [balance]);
24362
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) => {
24363
24497
  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.jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
24365
- ? interactiveChipClassName
24366
- : 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
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
24367
24507
  ? formatIfVerySmall.token
24368
- : amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
24369
- ? formatIfVerySmall.token
24370
- : amountFormatted }), ' ', jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0 ? 'tw-opacity-0' : '' }), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
24371
- ? interactiveChipClassName
24372
- : notInteractiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balanceFormatted }), jsxRuntime.jsx(Chip, { label: "Max" })] })] }))] }));
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" })] }) }))] }))] }));
24373
24513
  }
24374
24514
 
24375
24515
  function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
@@ -24471,172 +24611,50 @@ function Switch({ checked = false, onChange, size, disabled = false, }) {
24471
24611
  : 'tw-bg-grey-500') })] }));
24472
24612
  }
24473
24613
 
24474
- const gapBetweenTooltipAndContainer = 10;
24475
- const tooltipWidthClassMap = {
24476
- max: 'tw-w-max',
24477
- container: 'tw-w-full',
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',
24478
24622
  };
24479
- const tooltipThresholdPaddingMap = {
24480
- xxs: '5px',
24481
- xs: '10px',
24482
- s: '15px',
24483
- m: '20px',
24484
- l: '30px',
24485
- xl: '40px',
24486
- 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',
24487
24626
  };
24488
- function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: containerRefProp, }) {
24489
- const containerRefState = useContainerStore((state) => state.containerRef);
24490
- const containerRef = (containerRefProp === null || containerRefProp === void 0 ? void 0 : containerRefProp.current)
24491
- ? containerRefProp
24492
- : containerRefState;
24493
- const [tooltipPositionStyle, setTooltipPositionStyle] = React.useState({});
24494
- const [isTooltipVisible, setIsTooltipVisible] = React.useState(false);
24495
- const [isTooltipVisibleDelayed, setIsTooltipVisibleDelayed] = React.useState(false);
24496
- const tooltipRef = React.useRef(null);
24497
- const tooltipTriggerRef = React.useRef(null);
24498
- const delayTimeoutRef = React.useRef(null);
24499
- React.useEffect(() => {
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);
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})`;
24604
24639
  }
24605
- delayTimeoutRef.current = setTimeout(() => {
24606
- setIsTooltipVisibleDelayed(true);
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);
24640
+ if (!token) {
24641
+ return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
24614
24642
  }
24615
- }, [delayTimeoutRef]);
24616
- 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
24617
- ? '!tw-opacity-100 tw-z-40 tw-visible'
24618
- : 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none tw-invisible', tooltipWidthClassMap[tooltipWidth], tooltipClassName), children: tooltipContent })) : null] }));
24619
- }
24620
-
24621
- function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
24622
- return (jsxRuntime.jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, containerClassName: "tw-pr-squid-xxs mobile-lg:tw-w-[140px] tw-w-[106.5px]", tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, 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 &&
24623
- '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 &&
24624
- '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: {
24625
- boxShadow: generateMarkerLines(40),
24626
- } })] }), 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: {
24627
- transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
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(', ');
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" })] })] }) })));
24640
24658
  }
24641
24659
 
24642
24660
  function FilterIcon() {
@@ -24688,10 +24706,16 @@ function MainView({ isLoading }) {
24688
24706
  {
24689
24707
  labelOrIcon: jsxRuntime.jsx(ClockOutlineIcon, {}),
24690
24708
  id: 'history',
24709
+ tooltip: {
24710
+ tooltipContent: 'Swap history',
24711
+ },
24691
24712
  },
24692
24713
  {
24693
24714
  labelOrIcon: jsxRuntime.jsx(SettingsGearIcon, {}),
24694
24715
  id: 'settings',
24716
+ tooltip: {
24717
+ tooltipContent: 'Swap preferences',
24718
+ },
24695
24719
  },
24696
24720
  ] }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
24697
24721
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
@@ -24702,11 +24726,45 @@ function MainView({ isLoading }) {
24702
24726
  bgColor: '#627eea',
24703
24727
  textColor: '#fff',
24704
24728
  decimals: 18,
24705
- }, priceImpactPercentage: '0.3', balance: '4.57', address: "so-so.eth" }), jsxRuntime.jsx(DetailsToolbar, { canToggleBoostMode: false, flipButton: {
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: {
24706
24751
  isDisabled: true,
24707
- disabledMessage: 'Not enough USDC to flip the swap',
24708
- tooltipDisplayDelayMs: 0,
24709
- }, boostDisabledMessage: "Boost not supported for this route", isLoading: isLoading, isEmpty: isLoading }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
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: {
24710
24768
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
24711
24769
  bgColor: '#e84142',
24712
24770
  }, token: {
@@ -24715,7 +24773,28 @@ function MainView({ isLoading }) {
24715
24773
  bgColor: '#2775ca',
24716
24774
  textColor: '#fff',
24717
24775
  decimals: 6,
24718
- }, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', address: "so-so.eth", amount: isLoading ? undefined : '100' }), 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 }) })] }));
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 }) })] }));
24719
24798
  }
24720
24799
 
24721
24800
  function PunkIcon({ size = '16' }) {