@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/esm/index.js CHANGED
@@ -3055,92 +3055,6 @@ const themeTypesKeys = {
3055
3055
  },
3056
3056
  };
3057
3057
 
3058
- function PlusIcon() {
3059
- return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
3060
- }
3061
-
3062
- const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
3063
- const themeKeyVariantMap = {
3064
- primary: 'grey-800',
3065
- accent: 'royal-500',
3066
- };
3067
- const buttonTextClassNameMap = {
3068
- primary: 'tw-text-grey-300',
3069
- accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
3070
- };
3071
- const emptyChainIconTextClassNameMap = {
3072
- primary: 'tw-text-grey-100',
3073
- accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
3074
- };
3075
- function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, }) {
3076
- var _a;
3077
- const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
3078
- const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
3079
- const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
3080
- const bgGradient = useMemo(() => {
3081
- if (!chain || isLoading) {
3082
- return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
3083
- }
3084
- if (!token) {
3085
- return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
3086
- }
3087
- return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
3088
- }, [chainBgColor, tokenBgColor, chain, token, isLoading]);
3089
- const ButtonTag = isLoading ? 'div' : 'button';
3090
- return (jsxs(ButtonTag, { onClick: isLoading ? undefined : onClick, disabled: isLoading, "aria-disabled": isLoading, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant], isLoading && 'tw-cursor-not-allowed'), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between', chain && token && !isLoading
3091
- ? 'tw-w-[90px]'
3092
- : 'tw-w-full tw-max-w-[72px]'), style: {
3093
- backgroundImage: bgGradient,
3094
- }, children: jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
3095
- backgroundColor: tokenBgColor,
3096
- } }), jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && !isLoading && 'tw-pl-[7px]'), style: {
3097
- backgroundColor: tokenBgColor,
3098
- color: token === null || token === void 0 ? void 0 : token.textColor,
3099
- }, children: [jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
3100
- ? token.symbol
3101
- : !isLoading && 'Select token' }), !isLoading && jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
3102
- }
3103
-
3104
- const CSS_VARS = {
3105
- MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
3106
- DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
3107
- COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
3108
- EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
3109
- FADE_IN_DURATION: '--squid-animation-fade-in-duration',
3110
- FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
3111
- SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
3112
- SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
3113
- TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
3114
- SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
3115
- HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
3116
- SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
3117
- SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
3118
- BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
3119
- BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
3120
- };
3121
- const ANIMATION_DURATIONS = {
3122
- SHOW_ROUTE: 300,
3123
- HIDE_ROUTE: 300,
3124
- CHANGE_SWAP_STEP: 300,
3125
- SHOW_MODAL: 400,
3126
- HIDE_MODAL: 400,
3127
- BOOST_BUTTON: 500,
3128
- };
3129
- const ANIMATION_TIMINGS = {
3130
- EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
3131
- COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
3132
- CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
3133
- SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
3134
- HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
3135
- };
3136
- const MEDIA_QUERIES = {
3137
- MOBILE_LG: {
3138
- media: '(min-width: 480px)',
3139
- key: 'mobile-lg',
3140
- value: '480px',
3141
- },
3142
- };
3143
-
3144
3058
  function SearchIcon() {
3145
3059
  return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M20 20L16.05 16.05M18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
3146
3060
  }
@@ -16701,12 +16615,73 @@ AppContainer.Content = (props) => (jsx(motion.div, Object.assign({ transformTemp
16701
16615
  }, layout: "position", layoutDependency: useContext(LayoutDependencyContext), layoutId: "app-container-content" }, props)));
16702
16616
  const elementKey = (child) => isValidElement(child) ? child.key : null;
16703
16617
 
16618
+ const CSS_VARS = {
16619
+ MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
16620
+ DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
16621
+ COLLAPSE_ROUTE_DURATION: '--squid-animation-collapse-to-bottom-duration',
16622
+ EXPAND_ROUTE_DURATION: '--squid-animation-expand-to-top-duration',
16623
+ FADE_IN_DURATION: '--squid-animation-fade-in-duration',
16624
+ FADE_OUT_DURATION: '--squid-animation-fade-out-duration',
16625
+ SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
16626
+ SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
16627
+ TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
16628
+ SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
16629
+ HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
16630
+ SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
16631
+ SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
16632
+ BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
16633
+ BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
16634
+ };
16635
+ const ANIMATION_DURATIONS = {
16636
+ SHOW_ROUTE: 300,
16637
+ HIDE_ROUTE: 300,
16638
+ CHANGE_SWAP_STEP: 300,
16639
+ SHOW_MODAL: 400,
16640
+ HIDE_MODAL: 400,
16641
+ BOOST_BUTTON: 500,
16642
+ };
16643
+ const ANIMATION_TIMINGS = {
16644
+ EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
16645
+ COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
16646
+ CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
16647
+ SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
16648
+ HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
16649
+ };
16650
+ const MEDIA_QUERIES = {
16651
+ MOBILE_LG: {
16652
+ media: '(min-width: 480px)',
16653
+ key: 'mobile-lg',
16654
+ value: '480px',
16655
+ },
16656
+ };
16657
+
16658
+ function BoostButton({ boostMode, canToggleBoostMode = true, boostIndicatorRef, }) {
16659
+ return (jsx("div", { className: "tw-w-[106.5px] tw-pr-squid-xxs mobile-lg:tw-w-[140px]", children: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-full tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
16660
+ 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
16661
+ 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-relative -tw-left-[20px] tw-flex tw-h-full tw-w-[140px] tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce mobile-lg:-tw-left-[3px]", children: [jsx("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
16662
+ boxShadow: generateMarkerLines(40),
16663
+ } })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-2px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled/boost-toggle:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
16664
+ transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
16665
+ } })] }) }));
16666
+ }
16667
+ function generateMarkerLines(count) {
16668
+ const halfCount = Math.ceil(count / 2);
16669
+ const rightShadows = Array.from({ length: halfCount }, (_, index) => {
16670
+ return `-${(index + 1) * 6}px 0 currentColor`;
16671
+ });
16672
+ const leftShadows = Array.from({ length: halfCount }, (_, index) => {
16673
+ return `${(index + 1) * 6}px 0 currentColor`;
16674
+ });
16675
+ const allShadows = [...rightShadows, ...leftShadows];
16676
+ return allShadows.join(', ');
16677
+ }
16678
+
16704
16679
  function Chip(_a) {
16705
16680
  var { label, icon } = _a, props = __rest$1(_a, ["label", "icon"]);
16706
16681
  return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-text-nowrap tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
16707
16682
  }
16708
16683
 
16709
- function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
16684
+ function Boost({ boostMode, onToggleBoostMode, estimatedTime, canToggleBoostMode = true, tooltip, }) {
16710
16685
  const boostIndicatorRef = useRef(null);
16711
16686
  function handleToggleBoostMode() {
16712
16687
  if (!boostIndicatorRef.current || !canToggleBoostMode)
@@ -16723,9 +16698,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
16723
16698
  onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
16724
16699
  }
16725
16700
  }
16726
- return (jsx("div", { className: "mobile-lg:tw-w-[190px] tw-w-[157px]", children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: cn('tw-group/boost-toggle tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-rounded-squid-m tw-bg-grey-900 tw-pr-squid-xs', canToggleBoostMode && 'hover:tw-bg-material-light-thin'), children: [jsx(BoostButton, { boostIndicatorRef: boostIndicatorRef, boostMode: boostMode, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, tooltipDisplayDelayMs: boostTooltipDisplayDelayMs }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
16701
+ return (jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-w-[157px] mobile-lg:tw-w-[190px] tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: cn('tw-group/boost-toggle tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-rounded-squid-m tw-bg-grey-900 tw-pr-squid-xs', canToggleBoostMode && 'hover:tw-bg-material-light-thin'), children: [jsx(BoostButton, { boostIndicatorRef: boostIndicatorRef, boostMode: boostMode, canToggleBoostMode: canToggleBoostMode }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
16727
16702
  ? 'tw-bg-grey-300'
16728
- : 'tw-bg-status-positive') })] }) }));
16703
+ : 'tw-bg-status-positive') })] }) })));
16729
16704
  }
16730
16705
 
16731
16706
  function Join({ children, glue }) {
@@ -16837,8 +16812,8 @@ function EthereumIcon() {
16837
16812
  }
16838
16813
 
16839
16814
  function FeeButton(_a) {
16840
- var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className"]);
16841
- return (jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
16815
+ var { feeInUsd = '0', chipLabel = 'Fee', className, tooltip } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className", "tooltip"]);
16816
+ return (jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })) })));
16842
16817
  }
16843
16818
 
16844
16819
  function EmojiSadIcon({ className, size = '20', }) {
@@ -16858,7 +16833,8 @@ const detailStateClassMap = {
16858
16833
  error: 'tw-opacity-33 tw-pointer-events-none',
16859
16834
  full: '',
16860
16835
  };
16861
- function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, flipButton, }) {
16836
+ function DetailsToolbar({ errorMessage, estimatedTime, helpButton, isLoading, isEmpty, flipButton, feeButton, boostButton, }) {
16837
+ var _a;
16862
16838
  const state = useMemo(() => {
16863
16839
  if (errorMessage)
16864
16840
  return 'error';
@@ -16871,10 +16847,8 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
16871
16847
  const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
16872
16848
  return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-full tw-items-center tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500 mobile-lg:tw-w-card-large', state === 'error'
16873
16849
  ? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
16874
- : 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, { tooltipContent: (flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled)
16875
- ? flipButton.disabledMessage
16876
- : undefined, tooltipWidth: "max", displayDelayMs: flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltipDisplayDelayMs, children: jsx("button", { disabled: flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
16877
- 'group-hover/flip-button:tw-rotate-180') }) }) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
16850
+ : 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, Object.assign({}, feeButton)) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, Object.assign({}, flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltip, { tooltipWidth: "max", containerClassName: "tw-rounded-squid-m", childrenClassName: "tw-rounded-squid-m", children: jsx("button", { disabled: flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled, onClick: flipButton === null || flipButton === void 0 ? void 0 : flipButton.onClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
16851
+ 'group-hover/flip-button:tw-rotate-180') }) }) }))) }), jsx("div", { className: detailClassName, children: jsx(Boost, { tooltip: boostButton === null || boostButton === void 0 ? void 0 : boostButton.tooltip, estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: (_a = boostButton === null || boostButton === void 0 ? void 0 : boostButton.boostMode) !== null && _a !== void 0 ? _a : 'normal', onToggleBoostMode: boostButton === null || boostButton === void 0 ? void 0 : boostButton.onClick, canToggleBoostMode: state === 'loading' ? false : boostButton === null || boostButton === void 0 ? void 0 : boostButton.canToggleBoostMode }) })] })) }));
16878
16852
  }
16879
16853
 
16880
16854
  function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
@@ -17493,11 +17467,11 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
17493
17467
  ? 'tw-px-squid-m'
17494
17468
  : 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsx(Button$1, { className: displayButtonShadows
17495
17469
  ? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
17496
- : undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
17497
- ? action.labelOrIcon
17498
- : undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
17499
- ? null
17500
- : action.labelOrIcon, onClick: action.onClick }, action.id))) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-m tw-py-squid-xxs mobile-lg:tw-px-squid-l", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
17470
+ : undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsx(Tooltip, Object.assign({}, action.tooltip, { childrenClassName: "tw-rounded-squid-m", containerClassName: "tw-rounded-squid-m", tooltipWidth: "max", children: jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
17471
+ ? action.labelOrIcon
17472
+ : undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
17473
+ ? null
17474
+ : action.labelOrIcon, onClick: action.onClick }) }), action.id))) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-m tw-py-squid-xxs mobile-lg:tw-px-squid-l", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
17501
17475
  }
17502
17476
 
17503
17477
  const createStoreImpl = (createState) => {
@@ -18086,21 +18060,27 @@ function LogoContainer({ children }) {
18086
18060
  return (jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
18087
18061
  }
18088
18062
 
18089
- 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, }) {
18090
- var _a, _b;
18091
- const isWalletButtonInteractive = !isLoading && !!onWalletButtonClick;
18063
+ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, maxUsdDecimals, isInputInteractive = true, isLoading = false, inputModeButton, balanceButton, assetsButton, walletButton, }) {
18064
+ var _a, _b, _c;
18065
+ const isWalletButtonInteractive = !isLoading && !!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick);
18092
18066
  const WalletButtonTag = isWalletButtonInteractive ? 'button' : 'div';
18093
18067
  const isFetching = isFetchingProp || isLoading;
18094
- return (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: [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: 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: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), !isLoading && (jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] }))] }) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chain: chain, token: token, isLoading: isLoading, variant: assetsButtonVariant }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
18095
- decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
18096
- symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
18068
+ return (jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsx(Tooltip, Object.assign({}, walletButton === null || walletButton === void 0 ? void 0 : walletButton.tooltip, { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(WalletButtonTag, { onClick: isWalletButtonInteractive ? walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick : undefined, className: cn('-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600', isWalletButtonInteractive && 'hover:tw-bg-material-light-thin', isLoading && 'tw-opacity-50'), children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), !isLoading && (jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
18069
+ ? 'tw-text-grey-300'
18070
+ : 'tw-text-royal-400', children: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
18071
+ ? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
18072
+ : (_a = walletButton === null || walletButton === void 0 ? void 0 : walletButton.emptyAddressLabel) !== null && _a !== void 0 ? _a : 'Connect wallet' }), jsx(ChevronArrowIcon, { className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
18073
+ ? 'tw-text-grey-600'
18074
+ : 'tw-text-royal-400' })] }))] }) })) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
18075
+ decimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18,
18076
+ symbol: (_c = token === null || token === void 0 ? void 0 : token.symbol) !== null && _c !== void 0 ? _c : '',
18097
18077
  price: tokenPrice,
18098
18078
  }, onAmountChange: (value) => {
18099
18079
  onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value);
18100
18080
  }, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
18101
18081
  token: '0.001',
18102
18082
  usd: '0.01',
18103
- }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive && !isLoading })] }));
18083
+ }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading })] }));
18104
18084
  }
18105
18085
 
18106
18086
  function SwapProgressViewHeader({ title, description, }) {
@@ -24205,6 +24185,153 @@ function Toast({ headerContent, actionsContent, description, chipLabel, title, }
24205
24185
  return (jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", contentWrapperClassName: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs", rounded: "sm", children: [headerContent, jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
24206
24186
  }
24207
24187
 
24188
+ const gapBetweenTooltipAndContainer = 10;
24189
+ const tooltipWidthClassMap = {
24190
+ max: 'tw-w-max',
24191
+ container: 'tw-w-full',
24192
+ };
24193
+ const tooltipThresholdPaddingMap = {
24194
+ xxs: '5px',
24195
+ xs: '10px',
24196
+ s: '15px',
24197
+ m: '20px',
24198
+ l: '30px',
24199
+ xl: '40px',
24200
+ xxl: '60px',
24201
+ };
24202
+ function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: containerRefProp, }) {
24203
+ const containerRefState = useContainerStore((state) => state.containerRef);
24204
+ const containerRef = (containerRefProp === null || containerRefProp === void 0 ? void 0 : containerRefProp.current)
24205
+ ? containerRefProp
24206
+ : containerRefState;
24207
+ const [tooltipPositionStyle, setTooltipPositionStyle] = useState({});
24208
+ const [isTooltipVisible, setIsTooltipVisible] = useState(false);
24209
+ const [isTooltipVisibleDelayed, setIsTooltipVisibleDelayed] = useState(false);
24210
+ const tooltipRef = useRef(null);
24211
+ const tooltipTriggerRef = useRef(null);
24212
+ const delayTimeoutRef = useRef(null);
24213
+ useEffect(() => {
24214
+ const adjustTooltipPosition = () => {
24215
+ if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
24216
+ !tooltipRef.current ||
24217
+ !tooltipTriggerRef.current) {
24218
+ // if any of the refs is not defined, we can't calculate the position
24219
+ // so we just try to center the tooltip
24220
+ return setTooltipPositionStyle({
24221
+ bottom: '100%',
24222
+ left: '50%',
24223
+ transform: 'translateX(-50%)',
24224
+ paddingBottom: tooltipThresholdPaddingMap[threshold],
24225
+ });
24226
+ }
24227
+ // get the bounding rects of the container, tooltip and trigger
24228
+ const containerRect = containerRef.current.getBoundingClientRect();
24229
+ const tooltipRect = tooltipRef.current.getBoundingClientRect();
24230
+ const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
24231
+ // check if the tooltip fits below the trigger
24232
+ const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
24233
+ // check if the tooltip fits above the trigger
24234
+ const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
24235
+ // get the y position of the center of the tooltip trigger
24236
+ const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
24237
+ // get the x position of the center of the tooltip trigger
24238
+ const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
24239
+ let tooltipYPosition = 'top';
24240
+ if (tooltipFitsAbove) {
24241
+ tooltipYPosition = 'top';
24242
+ }
24243
+ else if (tooltipFitsBelow) {
24244
+ tooltipYPosition = 'bottom';
24245
+ }
24246
+ else if (
24247
+ // if the tooltip doesn't fit above or below the trigger,
24248
+ // we just place it where there's more space available
24249
+ triggerMiddleY - containerRect.top >
24250
+ containerRect.bottom - triggerMiddleY) {
24251
+ tooltipYPosition = 'top';
24252
+ }
24253
+ else {
24254
+ tooltipYPosition = 'bottom';
24255
+ }
24256
+ const top = tooltipYPosition === 'top'
24257
+ ? -tooltipRect.height
24258
+ : tooltipTriggerRect.height;
24259
+ const paddingStyles = tooltipYPosition === 'top'
24260
+ ? {
24261
+ paddingBottom: tooltipThresholdPaddingMap[threshold],
24262
+ }
24263
+ : {
24264
+ paddingTop: tooltipThresholdPaddingMap[threshold],
24265
+ };
24266
+ let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
24267
+ const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
24268
+ const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
24269
+ const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
24270
+ const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
24271
+ // if the tooltip is too far to the left, we need to move it to the right the amount of pixels overflowing the container + the gap between the tooltip and the container
24272
+ if (tooltipOverflowsContainerLeft) {
24273
+ left =
24274
+ -(tooltipTriggerRect.left - containerRect.left) +
24275
+ gapBetweenTooltipAndContainer;
24276
+ }
24277
+ else if (tooltipOverflowsContainerRight) {
24278
+ left =
24279
+ -(containerRect.right - tooltipTriggerRect.right) +
24280
+ gapBetweenTooltipAndContainer;
24281
+ }
24282
+ setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
24283
+ ? { left }
24284
+ : tooltipOverflowsContainerRight
24285
+ ? { right: left }
24286
+ : // if the tooltip doesn't overflow the container, we just center it
24287
+ {
24288
+ left: '50%',
24289
+ transform: 'translateX(-50%)',
24290
+ })), paddingStyles));
24291
+ };
24292
+ adjustTooltipPosition();
24293
+ const timeoutId = setTimeout(() => {
24294
+ adjustTooltipPosition();
24295
+ }, 300);
24296
+ window.addEventListener('resize', adjustTooltipPosition);
24297
+ return () => {
24298
+ clearTimeout(timeoutId);
24299
+ window.removeEventListener('resize', adjustTooltipPosition);
24300
+ };
24301
+ }, [
24302
+ containerRef,
24303
+ tooltipContent,
24304
+ threshold,
24305
+ tooltipWidth,
24306
+ displayDelayMs,
24307
+ isTooltipVisible,
24308
+ ]);
24309
+ const handleMouseEnter = useCallback((e) => {
24310
+ var _a;
24311
+ if (e.target === tooltipRef.current ||
24312
+ ((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
24313
+ return;
24314
+ }
24315
+ setIsTooltipVisible(true);
24316
+ if (delayTimeoutRef.current) {
24317
+ clearTimeout(delayTimeoutRef.current);
24318
+ }
24319
+ delayTimeoutRef.current = setTimeout(() => {
24320
+ setIsTooltipVisibleDelayed(true);
24321
+ }, displayDelayMs);
24322
+ }, [displayDelayMs, tooltipRef, delayTimeoutRef]);
24323
+ const handleMouseLeave = useCallback(() => {
24324
+ setIsTooltipVisible(false);
24325
+ setIsTooltipVisibleDelayed(false);
24326
+ if (delayTimeoutRef.current) {
24327
+ clearTimeout(delayTimeoutRef.current);
24328
+ }
24329
+ }, [delayTimeoutRef]);
24330
+ return (jsxs("div", { className: cn('tw-relative', containerClassName), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [jsx("div", { ref: tooltipTriggerRef, className: childrenClassName, children: children }), tooltipContent ? (jsx(Menu, { style: tooltipPositionStyle, menuRef: tooltipRef, containerClassName: cn('tw-absolute tw-flex tw-items-center tw-justify-center', isTooltipVisibleDelayed
24331
+ ? '!tw-opacity-100 tw-z-40 tw-visible'
24332
+ : 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none tw-invisible', tooltipWidthClassMap[tooltipWidth], tooltipClassName), children: tooltipContent })) : null] }));
24333
+ }
24334
+
24208
24335
  const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
24209
24336
  // checks that the value includes at least one character different than `0` (zero), or `.` (dot)
24210
24337
  const RegExpNonZeroValue = /[^0.]/;
@@ -24219,7 +24346,7 @@ var InputMode;
24219
24346
  function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
24220
24347
  token: '0.001',
24221
24348
  usd: '0.01',
24222
- }, showDetails = true, isLoading = false, direction, amountUsd, isInteractive = false, }) {
24349
+ }, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, }) {
24223
24350
  var _a;
24224
24351
  const [inputValue, setInputValue] = useState('');
24225
24352
  const [inputMode, setInputMode] = useState(InputMode.TOKEN);
@@ -24317,6 +24444,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24317
24444
  };
24318
24445
  const { isTokenAmountVerySmall, isUsdAmountVerySmall } = getRawAmounts(inputValue);
24319
24446
  const amountFormatted = useMemo(() => {
24447
+ var _a;
24320
24448
  if (inputValue === '')
24321
24449
  return '0';
24322
24450
  if (inputMode === InputMode.TOKEN) {
@@ -24324,13 +24452,19 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24324
24452
  return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
24325
24453
  }
24326
24454
  else {
24327
- return formatAmount(amountUsd !== null && amountUsd !== void 0 ? amountUsd : '0');
24455
+ return formatAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : '0');
24328
24456
  }
24329
24457
  }
24330
24458
  else {
24331
24459
  return formatAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
24332
24460
  }
24333
- }, [inputValue, inputMode, token.price, direction, amountUsd]);
24461
+ }, [
24462
+ inputValue,
24463
+ inputMode,
24464
+ token.price,
24465
+ direction,
24466
+ inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
24467
+ ]);
24334
24468
  const AmountChip = isInteractive ? 'button' : 'div';
24335
24469
  const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
24336
24470
  ? 'tw-text-status-negative'
@@ -24341,15 +24475,21 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24341
24475
  }, [balance]);
24342
24476
  return (jsxs(Fragment, { children: [isInteractive && !isLoading ? (jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
24343
24477
  e.preventDefault();
24344
- }, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
24345
- ? interactiveChipClassName
24346
- : notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
24478
+ }, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsx(Tooltip, Object.assign({}, (isLoading
24479
+ ? undefined
24480
+ : inputMode === InputMode.TOKEN
24481
+ ? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
24482
+ : inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
24483
+ ? interactiveChipClassName
24484
+ : notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
24485
+ ? formatIfVerySmall.token
24486
+ : amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
24347
24487
  ? formatIfVerySmall.token
24348
- : amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
24349
- ? formatIfVerySmall.token
24350
- : amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0 ? 'tw-opacity-0' : '' }), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
24351
- ? interactiveChipClassName
24352
- : notInteractiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balanceFormatted }), jsx(Chip, { label: "Max" })] })] }))] }));
24488
+ : amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0
24489
+ ? 'tw-opacity-0'
24490
+ : '' }), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }) }))), jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, balanceChipClickable
24491
+ ? interactiveChipClassName
24492
+ : notInteractiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balanceFormatted }), jsx(Chip, { label: "Max" })] }) }))] }))] }));
24353
24493
  }
24354
24494
 
24355
24495
  function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
@@ -24451,172 +24591,50 @@ function Switch({ checked = false, onChange, size, disabled = false, }) {
24451
24591
  : 'tw-bg-grey-500') })] }));
24452
24592
  }
24453
24593
 
24454
- const gapBetweenTooltipAndContainer = 10;
24455
- const tooltipWidthClassMap = {
24456
- max: 'tw-w-max',
24457
- container: 'tw-w-full',
24594
+ function PlusIcon() {
24595
+ return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
24596
+ }
24597
+
24598
+ const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
24599
+ const themeKeyVariantMap = {
24600
+ primary: 'grey-800',
24601
+ accent: 'royal-500',
24458
24602
  };
24459
- const tooltipThresholdPaddingMap = {
24460
- xxs: '5px',
24461
- xs: '10px',
24462
- s: '15px',
24463
- m: '20px',
24464
- l: '30px',
24465
- xl: '40px',
24466
- xxl: '60px',
24603
+ const buttonTextClassNameMap = {
24604
+ primary: 'tw-text-grey-300',
24605
+ accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
24467
24606
  };
24468
- function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: containerRefProp, }) {
24469
- const containerRefState = useContainerStore((state) => state.containerRef);
24470
- const containerRef = (containerRefProp === null || containerRefProp === void 0 ? void 0 : containerRefProp.current)
24471
- ? containerRefProp
24472
- : containerRefState;
24473
- const [tooltipPositionStyle, setTooltipPositionStyle] = useState({});
24474
- const [isTooltipVisible, setIsTooltipVisible] = useState(false);
24475
- const [isTooltipVisibleDelayed, setIsTooltipVisibleDelayed] = useState(false);
24476
- const tooltipRef = useRef(null);
24477
- const tooltipTriggerRef = useRef(null);
24478
- const delayTimeoutRef = useRef(null);
24479
- useEffect(() => {
24480
- const adjustTooltipPosition = () => {
24481
- if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
24482
- !tooltipRef.current ||
24483
- !tooltipTriggerRef.current) {
24484
- // if any of the refs is not defined, we can't calculate the position
24485
- // so we just try to center the tooltip
24486
- return setTooltipPositionStyle({
24487
- bottom: '100%',
24488
- left: '50%',
24489
- transform: 'translateX(-50%)',
24490
- paddingBottom: tooltipThresholdPaddingMap[threshold],
24491
- });
24492
- }
24493
- // get the bounding rects of the container, tooltip and trigger
24494
- const containerRect = containerRef.current.getBoundingClientRect();
24495
- const tooltipRect = tooltipRef.current.getBoundingClientRect();
24496
- const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
24497
- // check if the tooltip fits below the trigger
24498
- const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
24499
- // check if the tooltip fits above the trigger
24500
- const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
24501
- // get the y position of the center of the tooltip trigger
24502
- const triggerMiddleY = tooltipTriggerRect.y + tooltipTriggerRect.height / 2;
24503
- // get the x position of the center of the tooltip trigger
24504
- const triggerMiddleX = tooltipTriggerRect.x + tooltipTriggerRect.width / 2;
24505
- let tooltipYPosition = 'top';
24506
- if (tooltipFitsAbove) {
24507
- tooltipYPosition = 'top';
24508
- }
24509
- else if (tooltipFitsBelow) {
24510
- tooltipYPosition = 'bottom';
24511
- }
24512
- else if (
24513
- // if the tooltip doesn't fit above or below the trigger,
24514
- // we just place it where there's more space available
24515
- triggerMiddleY - containerRect.top >
24516
- containerRect.bottom - triggerMiddleY) {
24517
- tooltipYPosition = 'top';
24518
- }
24519
- else {
24520
- tooltipYPosition = 'bottom';
24521
- }
24522
- const top = tooltipYPosition === 'top'
24523
- ? -tooltipRect.height
24524
- : tooltipTriggerRect.height;
24525
- const paddingStyles = tooltipYPosition === 'top'
24526
- ? {
24527
- paddingBottom: tooltipThresholdPaddingMap[threshold],
24528
- }
24529
- : {
24530
- paddingTop: tooltipThresholdPaddingMap[threshold],
24531
- };
24532
- let left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
24533
- const tooltipLeftSideX = triggerMiddleX - tooltipRect.width / 2 - gapBetweenTooltipAndContainer;
24534
- const tooltipRightSideX = triggerMiddleX + tooltipRect.width / 2 + gapBetweenTooltipAndContainer;
24535
- const tooltipOverflowsContainerLeft = tooltipLeftSideX < containerRect.left;
24536
- const tooltipOverflowsContainerRight = tooltipRightSideX > containerRect.right;
24537
- // 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
24538
- if (tooltipOverflowsContainerLeft) {
24539
- left =
24540
- -(tooltipTriggerRect.left - containerRect.left) +
24541
- gapBetweenTooltipAndContainer;
24542
- }
24543
- else if (tooltipOverflowsContainerRight) {
24544
- left =
24545
- -(containerRect.right - tooltipTriggerRect.right) +
24546
- gapBetweenTooltipAndContainer;
24547
- }
24548
- setTooltipPositionStyle(Object.assign(Object.assign({ top }, (tooltipOverflowsContainerLeft
24549
- ? { left }
24550
- : tooltipOverflowsContainerRight
24551
- ? { right: left }
24552
- : // if the tooltip doesn't overflow the container, we just center it
24553
- {
24554
- left: '50%',
24555
- transform: 'translateX(-50%)',
24556
- })), paddingStyles));
24557
- };
24558
- adjustTooltipPosition();
24559
- const timeoutId = setTimeout(() => {
24560
- adjustTooltipPosition();
24561
- }, 300);
24562
- window.addEventListener('resize', adjustTooltipPosition);
24563
- return () => {
24564
- clearTimeout(timeoutId);
24565
- window.removeEventListener('resize', adjustTooltipPosition);
24566
- };
24567
- }, [
24568
- containerRef,
24569
- tooltipContent,
24570
- threshold,
24571
- tooltipWidth,
24572
- displayDelayMs,
24573
- isTooltipVisible,
24574
- ]);
24575
- const handleMouseEnter = useCallback((e) => {
24576
- var _a;
24577
- if (e.target === tooltipRef.current ||
24578
- ((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
24579
- return;
24580
- }
24581
- setIsTooltipVisible(true);
24582
- if (delayTimeoutRef.current) {
24583
- clearTimeout(delayTimeoutRef.current);
24607
+ const emptyChainIconTextClassNameMap = {
24608
+ primary: 'tw-text-grey-100',
24609
+ accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
24610
+ };
24611
+ function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, tooltip, }) {
24612
+ var _a;
24613
+ const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
24614
+ const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
24615
+ const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
24616
+ const bgGradient = useMemo(() => {
24617
+ if (!chain || isLoading) {
24618
+ return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
24584
24619
  }
24585
- delayTimeoutRef.current = setTimeout(() => {
24586
- setIsTooltipVisibleDelayed(true);
24587
- }, displayDelayMs);
24588
- }, [displayDelayMs, tooltipRef, delayTimeoutRef]);
24589
- const handleMouseLeave = useCallback(() => {
24590
- setIsTooltipVisible(false);
24591
- setIsTooltipVisibleDelayed(false);
24592
- if (delayTimeoutRef.current) {
24593
- clearTimeout(delayTimeoutRef.current);
24620
+ if (!token) {
24621
+ return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
24594
24622
  }
24595
- }, [delayTimeoutRef]);
24596
- return (jsxs("div", { className: cn('tw-relative', containerClassName), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [jsx("div", { ref: tooltipTriggerRef, className: childrenClassName, children: children }), tooltipContent ? (jsx(Menu, { style: tooltipPositionStyle, menuRef: tooltipRef, containerClassName: cn('tw-absolute tw-flex tw-items-center tw-justify-center', isTooltipVisibleDelayed
24597
- ? '!tw-opacity-100 tw-z-40 tw-visible'
24598
- : 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none tw-invisible', tooltipWidthClassMap[tooltipWidth], tooltipClassName), children: tooltipContent })) : null] }));
24599
- }
24600
-
24601
- function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
24602
- return (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: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-full tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
24603
- 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
24604
- 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-relative -tw-left-[20px] tw-flex tw-h-full tw-w-[140px] tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce mobile-lg:-tw-left-[3px]", children: [jsx("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
24605
- boxShadow: generateMarkerLines(40),
24606
- } })] }), 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: {
24607
- transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
24608
- } })] }) }));
24609
- }
24610
- function generateMarkerLines(count) {
24611
- const halfCount = Math.ceil(count / 2);
24612
- const rightShadows = Array.from({ length: halfCount }, (_, index) => {
24613
- return `-${(index + 1) * 6}px 0 currentColor`;
24614
- });
24615
- const leftShadows = Array.from({ length: halfCount }, (_, index) => {
24616
- return `${(index + 1) * 6}px 0 currentColor`;
24617
- });
24618
- const allShadows = [...rightShadows, ...leftShadows];
24619
- return allShadows.join(', ');
24623
+ return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
24624
+ }, [chainBgColor, tokenBgColor, chain, token, isLoading]);
24625
+ const ButtonTag = isLoading ? 'div' : 'button';
24626
+ return (jsx(Tooltip, Object.assign({}, tooltip, { tooltipWidth: "max", containerClassName: "tw-w-fit", children: jsxs(ButtonTag, { onClick: isLoading ? undefined : onClick, disabled: isLoading, "aria-disabled": isLoading, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant], isLoading && 'tw-cursor-not-allowed'), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between', chain && token && !isLoading
24627
+ ? 'tw-w-[90px]'
24628
+ : 'tw-w-full tw-max-w-[72px]'), style: {
24629
+ backgroundImage: bgGradient,
24630
+ }, children: jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
24631
+ backgroundColor: tokenBgColor,
24632
+ } }), jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && !isLoading && 'tw-pl-[7px]'), style: {
24633
+ backgroundColor: tokenBgColor,
24634
+ color: token === null || token === void 0 ? void 0 : token.textColor,
24635
+ }, children: [jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
24636
+ ? token.symbol
24637
+ : !isLoading && 'Select token' }), !isLoading && jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }) })));
24620
24638
  }
24621
24639
 
24622
24640
  function FilterIcon() {
@@ -24668,10 +24686,16 @@ function MainView({ isLoading }) {
24668
24686
  {
24669
24687
  labelOrIcon: jsx(ClockOutlineIcon, {}),
24670
24688
  id: 'history',
24689
+ tooltip: {
24690
+ tooltipContent: 'Swap history',
24691
+ },
24671
24692
  },
24672
24693
  {
24673
24694
  labelOrIcon: jsx(SettingsGearIcon, {}),
24674
24695
  id: 'settings',
24696
+ tooltip: {
24697
+ tooltipContent: 'Swap preferences',
24698
+ },
24675
24699
  },
24676
24700
  ] }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
24677
24701
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
@@ -24682,11 +24706,45 @@ function MainView({ isLoading }) {
24682
24706
  bgColor: '#627eea',
24683
24707
  textColor: '#fff',
24684
24708
  decimals: 18,
24685
- }, priceImpactPercentage: '0.3', balance: '4.57', address: "so-so.eth" }), jsx(DetailsToolbar, { canToggleBoostMode: false, flipButton: {
24709
+ }, priceImpactPercentage: '0.3', balance: '4.57', walletButton: {
24710
+ address: 'so-so.eth',
24711
+ onClick: () => { },
24712
+ tooltip: {
24713
+ tooltipContent: 'Connect wallet',
24714
+ },
24715
+ }, assetsButton: {
24716
+ tooltip: {
24717
+ tooltipContent: 'Select token',
24718
+ },
24719
+ }, balanceButton: {
24720
+ tooltip: {
24721
+ tooltipContent: 'Max balance',
24722
+ },
24723
+ }, inputModeButton: {
24724
+ usdModeTooltip: {
24725
+ tooltipContent: 'Enter token amount',
24726
+ },
24727
+ tokenModeTooltip: {
24728
+ tooltipContent: 'Enter in USD',
24729
+ },
24730
+ } }), jsx(DetailsToolbar, { flipButton: {
24686
24731
  isDisabled: true,
24687
- disabledMessage: 'Not enough USDC to flip the swap',
24688
- tooltipDisplayDelayMs: 0,
24689
- }, boostDisabledMessage: "Boost not supported for this route", isLoading: isLoading, isEmpty: isLoading }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
24732
+ tooltip: {
24733
+ tooltipContent: 'Not enough USDC to flip the swap',
24734
+ displayDelayMs: 0,
24735
+ },
24736
+ }, boostButton: {
24737
+ canToggleBoostMode: false,
24738
+ tooltip: {
24739
+ tooltipContent: 'Boost not supported for this route',
24740
+ },
24741
+ }, feeButton: {
24742
+ feeInUsd: '0.4',
24743
+ onClick: () => { },
24744
+ tooltip: {
24745
+ tooltipContent: 'View fees',
24746
+ },
24747
+ }, isLoading: isLoading, isEmpty: isLoading }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
24690
24748
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
24691
24749
  bgColor: '#e84142',
24692
24750
  }, token: {
@@ -24695,7 +24753,28 @@ function MainView({ isLoading }) {
24695
24753
  bgColor: '#2775ca',
24696
24754
  textColor: '#fff',
24697
24755
  decimals: 6,
24698
- }, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', address: "so-so.eth", amount: isLoading ? undefined : '100' }), jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsx(Button$1, { variant: isLoading ? 'tertiary' : 'primary', size: "lg", label: "Swap", isLoading: isLoading }) })] }));
24756
+ }, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', walletButton: {
24757
+ address: 'so-so.eth',
24758
+ onClick: () => { },
24759
+ tooltip: {
24760
+ tooltipContent: 'Connect wallet',
24761
+ },
24762
+ }, amount: isLoading ? undefined : '100', assetsButton: {
24763
+ tooltip: {
24764
+ tooltipContent: 'Select token',
24765
+ },
24766
+ }, balanceButton: {
24767
+ tooltip: {
24768
+ tooltipContent: 'Max balance',
24769
+ },
24770
+ }, inputModeButton: {
24771
+ usdModeTooltip: {
24772
+ tooltipContent: 'Enter token amount',
24773
+ },
24774
+ tokenModeTooltip: {
24775
+ tooltipContent: 'Enter in USD',
24776
+ },
24777
+ } }), jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsx(Button$1, { variant: isLoading ? 'tertiary' : 'primary', size: "lg", label: "Swap", isLoading: isLoading }) })] }));
24699
24778
  }
24700
24779
 
24701
24780
  function PunkIcon({ size = '16' }) {