@0xsquid/ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +284 -129
- package/dist/cjs/types/components/buttons/AssetsButton.d.ts +10 -0
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +1 -1
- package/dist/cjs/types/components/buttons/SettingsButton.d.ts +4 -0
- package/dist/cjs/types/components/buttons/index.d.ts +2 -1
- package/dist/cjs/types/components/controls/SettingsSlider.d.ts +5 -0
- package/dist/cjs/types/components/controls/Switch.d.ts +2 -2
- package/dist/cjs/types/components/controls/Tooltip.d.ts +4 -2
- package/dist/cjs/types/components/controls/index.d.ts +1 -0
- package/dist/cjs/types/components/icons/Arrow.d.ts +20 -0
- package/dist/cjs/types/components/icons/Clock.d.ts +8 -0
- package/dist/cjs/types/components/icons/Coins.d.ts +4 -0
- package/dist/cjs/types/components/icons/CompassRound.d.ts +8 -0
- package/dist/cjs/types/components/icons/DashboardFast.d.ts +4 -0
- package/dist/cjs/types/components/icons/DotGrid.d.ts +4 -1
- package/dist/cjs/types/components/icons/Help.d.ts +16 -0
- package/dist/cjs/types/components/icons/Infinity.d.ts +4 -0
- package/dist/cjs/types/components/icons/Lightning.d.ts +4 -0
- package/dist/cjs/types/components/icons/SquidLogo.d.ts +1 -0
- package/dist/cjs/types/components/icons/SwapStepSeparator.d.ts +1 -0
- package/dist/cjs/types/components/icons/TradingViewSteps.d.ts +4 -0
- package/dist/cjs/types/components/layout/Boost.d.ts +9 -1
- package/dist/cjs/types/components/layout/DropdownMenu.d.ts +9 -0
- package/dist/cjs/types/components/layout/Menu.d.ts +6 -2
- package/dist/cjs/types/components/layout/NavigationBar.d.ts +3 -1
- package/dist/cjs/types/components/layout/SwapProgressViewHeader.d.ts +6 -0
- package/dist/cjs/types/components/layout/SwapStepsCollapsed.d.ts +5 -0
- package/dist/cjs/types/components/layout/TokenPair.d.ts +12 -0
- package/dist/cjs/types/components/layout/index.d.ts +3 -0
- package/dist/cjs/types/components/lists/DropdownMenuItem.d.ts +3 -3
- package/dist/cjs/types/components/lists/SettingsItem.d.ts +9 -0
- package/dist/cjs/types/components/lists/SwapDetailListItem.d.ts +8 -0
- package/dist/cjs/types/components/lists/SwapStepItem.d.ts +9 -0
- package/dist/cjs/types/components/lists/index.d.ts +3 -0
- package/dist/cjs/types/components/views/ProfileView.d.ts +1 -0
- package/dist/cjs/types/components/views/SwapDetailsView.d.ts +1 -0
- package/dist/cjs/types/core/themes.d.ts +2 -0
- package/dist/cjs/types/hooks/index.d.ts +1 -0
- package/dist/cjs/types/hooks/useModal.d.ts +10 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +4 -2
- package/dist/cjs/types/stories/buttons/{Dropdown.stories.d.ts → AssetsButton.stories.d.ts} +3 -2
- package/dist/cjs/types/stories/buttons/SettingsButton.stories.d.ts +6 -0
- package/dist/cjs/types/stories/controls/SettingsSlider.stories.d.ts +7 -0
- package/dist/cjs/types/stories/layout/Boost.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/DropdownMenu.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/Menu.stories.d.ts +2 -0
- package/dist/cjs/types/stories/layout/NavigationBar.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/SwapProgressView.stories.d.ts +9 -0
- package/dist/cjs/types/stories/layout/SwapProgressViewHeader.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/TokenPair.stories.d.ts +6 -0
- package/dist/cjs/types/stories/lists/SettingsItem.stories.d.ts +9 -0
- package/dist/cjs/types/stories/lists/SwapDetailListItem.stories.d.ts +7 -0
- package/dist/cjs/types/stories/lists/SwapStepItem.stories.d.ts +10 -0
- package/dist/cjs/types/stories/views/ProfileView.stories.d.ts +6 -0
- package/dist/cjs/types/stories/views/SwapDetailsView.stories.d.ts +6 -0
- package/dist/cjs/types/types/components.d.ts +11 -0
- package/dist/esm/index.js +276 -130
- package/dist/esm/types/components/buttons/AssetsButton.d.ts +10 -0
- package/dist/esm/types/components/buttons/BoostButton.d.ts +1 -1
- package/dist/esm/types/components/buttons/SettingsButton.d.ts +4 -0
- package/dist/esm/types/components/buttons/index.d.ts +2 -1
- package/dist/esm/types/components/controls/SettingsSlider.d.ts +5 -0
- package/dist/esm/types/components/controls/Switch.d.ts +2 -2
- package/dist/esm/types/components/controls/Tooltip.d.ts +4 -2
- package/dist/esm/types/components/controls/index.d.ts +1 -0
- package/dist/esm/types/components/icons/Arrow.d.ts +20 -0
- package/dist/esm/types/components/icons/Clock.d.ts +8 -0
- package/dist/esm/types/components/icons/Coins.d.ts +4 -0
- package/dist/esm/types/components/icons/CompassRound.d.ts +8 -0
- package/dist/esm/types/components/icons/DashboardFast.d.ts +4 -0
- package/dist/esm/types/components/icons/DotGrid.d.ts +4 -1
- package/dist/esm/types/components/icons/Help.d.ts +16 -0
- package/dist/esm/types/components/icons/Infinity.d.ts +4 -0
- package/dist/esm/types/components/icons/Lightning.d.ts +4 -0
- package/dist/esm/types/components/icons/SquidLogo.d.ts +1 -0
- package/dist/esm/types/components/icons/SwapStepSeparator.d.ts +1 -0
- package/dist/esm/types/components/icons/TradingViewSteps.d.ts +4 -0
- package/dist/esm/types/components/layout/Boost.d.ts +9 -1
- package/dist/esm/types/components/layout/DropdownMenu.d.ts +9 -0
- package/dist/esm/types/components/layout/Menu.d.ts +6 -2
- package/dist/esm/types/components/layout/NavigationBar.d.ts +3 -1
- package/dist/esm/types/components/layout/SwapProgressViewHeader.d.ts +6 -0
- package/dist/esm/types/components/layout/SwapStepsCollapsed.d.ts +5 -0
- package/dist/esm/types/components/layout/TokenPair.d.ts +12 -0
- package/dist/esm/types/components/layout/index.d.ts +3 -0
- package/dist/esm/types/components/lists/DropdownMenuItem.d.ts +3 -3
- package/dist/esm/types/components/lists/SettingsItem.d.ts +9 -0
- package/dist/esm/types/components/lists/SwapDetailListItem.d.ts +8 -0
- package/dist/esm/types/components/lists/SwapStepItem.d.ts +9 -0
- package/dist/esm/types/components/lists/index.d.ts +3 -0
- package/dist/esm/types/components/views/ProfileView.d.ts +1 -0
- package/dist/esm/types/components/views/SwapDetailsView.d.ts +1 -0
- package/dist/esm/types/core/themes.d.ts +2 -0
- package/dist/esm/types/hooks/index.d.ts +1 -0
- package/dist/esm/types/hooks/useModal.d.ts +10 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +4 -2
- package/dist/esm/types/stories/buttons/{Dropdown.stories.d.ts → AssetsButton.stories.d.ts} +3 -2
- package/dist/esm/types/stories/buttons/SettingsButton.stories.d.ts +6 -0
- package/dist/esm/types/stories/controls/SettingsSlider.stories.d.ts +7 -0
- package/dist/esm/types/stories/layout/Boost.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/DropdownMenu.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/Menu.stories.d.ts +2 -0
- package/dist/esm/types/stories/layout/NavigationBar.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/SwapProgressView.stories.d.ts +9 -0
- package/dist/esm/types/stories/layout/SwapProgressViewHeader.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/TokenPair.stories.d.ts +6 -0
- package/dist/esm/types/stories/lists/SettingsItem.stories.d.ts +9 -0
- package/dist/esm/types/stories/lists/SwapDetailListItem.stories.d.ts +7 -0
- package/dist/esm/types/stories/lists/SwapStepItem.stories.d.ts +10 -0
- package/dist/esm/types/stories/views/ProfileView.stories.d.ts +6 -0
- package/dist/esm/types/stories/views/SwapDetailsView.stories.d.ts +6 -0
- package/dist/esm/types/types/components.d.ts +11 -0
- package/dist/index.css +337 -54
- package/dist/index.d.ts +116 -23
- package/package.json +1 -1
- package/dist/cjs/types/components/buttons/Dropdown.d.ts +0 -10
- package/dist/esm/types/components/buttons/Dropdown.d.ts +0 -10
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef,
|
|
2
|
+
import { useMemo, useRef, useState, useEffect, useCallback } from 'react';
|
|
3
3
|
|
|
4
4
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
5
5
|
|
|
@@ -2635,6 +2635,9 @@ function ChevronRightSmallIcon() {
|
|
|
2635
2635
|
function ArrowLeftIcon() {
|
|
2636
2636
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2637
2637
|
}
|
|
2638
|
+
function ChevronGrabberVerticalIcon({ size = '16', className, }) {
|
|
2639
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2640
|
+
}
|
|
2638
2641
|
|
|
2639
2642
|
function ArrowButton(_a) {
|
|
2640
2643
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
@@ -2645,72 +2648,6 @@ function ArrowButton(_a) {
|
|
|
2645
2648
|
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsx(ArrowRightIcon, {}) })] })));
|
|
2646
2649
|
}
|
|
2647
2650
|
|
|
2648
|
-
const animationDuration = '500ms';
|
|
2649
|
-
function BoostButton({ boostMode = 'normal', onToggleBoostMode, }) {
|
|
2650
|
-
const boostIndicatorRef = useRef(null);
|
|
2651
|
-
function handleToggleBoostMode() {
|
|
2652
|
-
if (!boostIndicatorRef.current)
|
|
2653
|
-
return;
|
|
2654
|
-
// we don't want to trigger the animation when the component is mounted
|
|
2655
|
-
// so we set the animation duration only when user clicks the button
|
|
2656
|
-
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2657
|
-
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2658
|
-
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2659
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2660
|
-
}
|
|
2661
|
-
else {
|
|
2662
|
-
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2663
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
return (jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsx("span", { className: "tw-via-grey-900/70 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" }), jsx("span", { className: "tw-via-grey-900/70 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" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center", 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: {
|
|
2667
|
-
boxShadow: generateMarkerLines(40),
|
|
2668
|
-
} })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current', `tw-duration-${animationDuration}`) })] }));
|
|
2669
|
-
}
|
|
2670
|
-
function generateMarkerLines(count) {
|
|
2671
|
-
const halfCount = Math.ceil(count / 2);
|
|
2672
|
-
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2673
|
-
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2674
|
-
});
|
|
2675
|
-
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2676
|
-
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2677
|
-
});
|
|
2678
|
-
const allShadows = [...rightShadows, ...leftShadows];
|
|
2679
|
-
return allShadows.join(', ');
|
|
2680
|
-
}
|
|
2681
|
-
|
|
2682
|
-
const buttonSizeClassMap = {
|
|
2683
|
-
md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-border tw-flex tw-items-center tw-gap-squid-xxs tw-min-w-[60px] tw-h-squid-xl tw-justify-center',
|
|
2684
|
-
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2685
|
-
};
|
|
2686
|
-
const buttonVariantClassMap = {
|
|
2687
|
-
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2688
|
-
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2689
|
-
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2690
|
-
};
|
|
2691
|
-
// right now all variants have the same disabled styles
|
|
2692
|
-
// in the future, we can add more disabled styles for different variants
|
|
2693
|
-
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2694
|
-
function Button(_a) {
|
|
2695
|
-
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2696
|
-
return (jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2697
|
-
// disabled styles
|
|
2698
|
-
buttonDisabledClass,
|
|
2699
|
-
// custom classes from props
|
|
2700
|
-
props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2701
|
-
// label only
|
|
2702
|
-
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2703
|
-
// icon only
|
|
2704
|
-
icon) : (
|
|
2705
|
-
// icon and label
|
|
2706
|
-
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2707
|
-
}
|
|
2708
|
-
|
|
2709
|
-
function Chip(_a) {
|
|
2710
|
-
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2711
|
-
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-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
2651
|
function PlusIcon() {
|
|
2715
2652
|
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", "stroke-width": "2", "stroke-linecap": "round" }) }));
|
|
2716
2653
|
}
|
|
@@ -2821,41 +2758,119 @@ const themeTypesKeys = {
|
|
|
2821
2758
|
},
|
|
2822
2759
|
};
|
|
2823
2760
|
|
|
2824
|
-
const imageClass = 'tw-w-
|
|
2825
|
-
const
|
|
2826
|
-
function
|
|
2827
|
-
const
|
|
2828
|
-
// if no chain icon, gradient is as follows:
|
|
2829
|
-
// 0%-100% default color
|
|
2761
|
+
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2762
|
+
const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
|
|
2763
|
+
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, }) {
|
|
2764
|
+
const bgGradient = useMemo(() => {
|
|
2830
2765
|
if (!chainImageUrl) {
|
|
2831
|
-
return `linear-gradient(to right, ${
|
|
2766
|
+
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
2832
2767
|
}
|
|
2833
|
-
// if chain icon present but no token icon, gradient is as follows:
|
|
2834
|
-
// 0%-25% chain color, 25%-100% default color
|
|
2835
2768
|
if (!tokenImageUrl) {
|
|
2836
|
-
return `linear-gradient(
|
|
2769
|
+
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
2837
2770
|
}
|
|
2838
|
-
|
|
2839
|
-
// 0%-20% chain color, 20%-100% token color
|
|
2840
|
-
return `linear-gradient(to right, ${chainBgColor} 20%, ${tokenBgColor} 25%)`;
|
|
2771
|
+
return `linear-gradient(to right, ${chainBgColor} 47.5%, ${tokenBgColor} 52.5%)`;
|
|
2841
2772
|
}, [chainBgColor, tokenBgColor]);
|
|
2842
|
-
return (jsxs("div", { className: "tw-
|
|
2843
|
-
|
|
2844
|
-
|
|
2773
|
+
return (jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", 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-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2774
|
+
backgroundImage: bgGradient,
|
|
2775
|
+
}, children: jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsx("img", { src: chainImageUrl, alt: "" })) : (jsx(Fragment, { children: jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
|
|
2776
|
+
backgroundColor: tokenBgColor,
|
|
2777
|
+
}, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-full -tw-translate-x-[2px]" }) })) : 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', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2778
|
+
backgroundColor: tokenBgColor,
|
|
2779
|
+
color: tokenTextColor,
|
|
2780
|
+
}, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, {})] })] }));
|
|
2845
2781
|
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2782
|
+
|
|
2783
|
+
const animationDuration = '500ms';
|
|
2784
|
+
function BoostButton({ boostMode, onToggleBoostMode, }) {
|
|
2785
|
+
const boostIndicatorRef = useRef(null);
|
|
2786
|
+
function handleToggleBoostMode() {
|
|
2787
|
+
if (!boostIndicatorRef.current)
|
|
2788
|
+
return;
|
|
2789
|
+
// we don't want to trigger the animation when the component is mounted
|
|
2790
|
+
// so we set the animation duration only when user clicks the button
|
|
2791
|
+
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2792
|
+
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2793
|
+
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2794
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2795
|
+
}
|
|
2796
|
+
else {
|
|
2797
|
+
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2798
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
return (jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsx("span", { className: "tw-via-grey-900/70 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" }), jsx("span", { className: "tw-via-grey-900/70 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" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center", 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: {
|
|
2802
|
+
boxShadow: generateMarkerLines(40),
|
|
2803
|
+
} })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
2804
|
+
transitionDuration: animationDuration,
|
|
2805
|
+
} })] }));
|
|
2806
|
+
}
|
|
2807
|
+
function generateMarkerLines(count) {
|
|
2808
|
+
const halfCount = Math.ceil(count / 2);
|
|
2809
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2810
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2811
|
+
});
|
|
2812
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2813
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2814
|
+
});
|
|
2815
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
2816
|
+
return allShadows.join(', ');
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
const buttonSizeClassMap = {
|
|
2820
|
+
md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-border tw-flex tw-items-center tw-gap-squid-xxs tw-min-w-[60px] tw-h-squid-xl tw-justify-center',
|
|
2821
|
+
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2848
2822
|
};
|
|
2849
|
-
const
|
|
2850
|
-
|
|
2823
|
+
const buttonVariantClassMap = {
|
|
2824
|
+
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2825
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2826
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2851
2827
|
};
|
|
2828
|
+
// right now all variants have the same disabled styles
|
|
2829
|
+
// in the future, we can add more disabled styles for different variants
|
|
2830
|
+
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2831
|
+
function Button(_a) {
|
|
2832
|
+
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2833
|
+
return (jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2834
|
+
// disabled styles
|
|
2835
|
+
buttonDisabledClass,
|
|
2836
|
+
// custom classes from props
|
|
2837
|
+
props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2838
|
+
// label only
|
|
2839
|
+
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2840
|
+
// icon only
|
|
2841
|
+
icon) : (
|
|
2842
|
+
// icon and label
|
|
2843
|
+
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
function Chip(_a) {
|
|
2847
|
+
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2848
|
+
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-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2849
|
+
}
|
|
2852
2850
|
|
|
2853
2851
|
function EthereumIcon() {
|
|
2854
2852
|
return (jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
|
|
2855
2853
|
}
|
|
2856
2854
|
|
|
2857
2855
|
function FeeButton() {
|
|
2858
|
-
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-px-squid-xs", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2856
|
+
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
// font size, line height, and letter spacing classes
|
|
2860
|
+
const textClassMap = {
|
|
2861
|
+
small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
|
|
2862
|
+
medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
|
|
2863
|
+
large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
|
|
2864
|
+
};
|
|
2865
|
+
function HeadingText({ children, bold, size }) {
|
|
2866
|
+
const fontWeightClass = bold
|
|
2867
|
+
? 'tw-font-heading-bold'
|
|
2868
|
+
: 'tw-font-heading-regular';
|
|
2869
|
+
return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
function SettingsButton({ label }) {
|
|
2873
|
+
return (jsx("button", { className: "tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs", children: jsx(CaptionText, { children: label }) }));
|
|
2859
2874
|
}
|
|
2860
2875
|
|
|
2861
2876
|
function SearchIcon() {
|
|
@@ -2870,6 +2885,10 @@ const PasteButton = () => {
|
|
|
2870
2885
|
return (jsx("button", { className: "tw-h-[30px] tw-rounded-full tw-border tw-border-grey-700 tw-bg-grey-800 tw-px-2 tw-text-grey-300", children: jsx(CaptionText, { children: "Paste" }) }));
|
|
2871
2886
|
};
|
|
2872
2887
|
|
|
2888
|
+
function SettingsSlider({ value, type }) {
|
|
2889
|
+
return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-xs tw-border-royal-500 tw-p-squid-xs", children: [jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) }), jsx(CaptionText, { className: "tw-text-grey-300", children: "%" })] })) : (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-grey-300", children: "$" }), jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) })] })) }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2873
2892
|
const switchSizeClassMap = {
|
|
2874
2893
|
small: 'tw-w-[36px] tw-h-squid-m tw-p-0.5',
|
|
2875
2894
|
large: 'tw-w-[54px] tw-h-squid-l tw-p-[3px]',
|
|
@@ -2878,14 +2897,14 @@ const switchCircleSizeClassMap = {
|
|
|
2878
2897
|
small: 'tw-w-4 tw-h-4',
|
|
2879
2898
|
large: 'tw-w-6 tw-h-6',
|
|
2880
2899
|
};
|
|
2881
|
-
function Switch({ checked, onChange, size }) {
|
|
2900
|
+
function Switch({ checked = false, onChange, size }) {
|
|
2882
2901
|
return (
|
|
2883
2902
|
// Switch container
|
|
2884
2903
|
jsxs("label", { className: clsx('tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin',
|
|
2885
2904
|
// size styles
|
|
2886
2905
|
switchSizeClassMap[size],
|
|
2887
2906
|
// checked styles
|
|
2888
|
-
checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsx("input", { checked: checked, onChange: (e) => onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
|
|
2907
|
+
checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsx("input", { checked: checked, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
|
|
2889
2908
|
filter: 'drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))',
|
|
2890
2909
|
}, className: clsx('tw-absolute tw-rounded-full tw-border tw-border-material-light-thin',
|
|
2891
2910
|
// size styles
|
|
@@ -2896,12 +2915,13 @@ function Switch({ checked, onChange, size }) {
|
|
|
2896
2915
|
: 'tw-left-0.5 tw-bg-grey-500') })] }));
|
|
2897
2916
|
}
|
|
2898
2917
|
|
|
2918
|
+
const borderRadiusClassMap = {
|
|
2919
|
+
sm: 'tw-rounded-squid-s',
|
|
2920
|
+
lg: 'tw-rounded-squid-m',
|
|
2921
|
+
};
|
|
2899
2922
|
function Menu(_a) {
|
|
2900
|
-
var { children,
|
|
2901
|
-
return (jsx("div", Object.assign({}, props, { className:
|
|
2902
|
-
boxShadow: '0px 2px 5px 1px rgba(0, 0, 0, 0.20), 0px 5px 20px -1px rgba(0, 0, 0, 0.33)',
|
|
2903
|
-
backdropFilter: 'blur(calc(20px / 2))',
|
|
2904
|
-
}, className: cn('tw-w-full tw-max-w-[320px] tw-items-center tw-justify-center tw-rounded-squid-m tw-border tw-border-material-light-thin tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick', contentClassName), children: typeof children === 'string' ? (jsx(CaptionText, { children: children })) : (children) }) })));
|
|
2923
|
+
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg' } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded"]);
|
|
2924
|
+
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), children: jsxs("div", { className: cn('tw-backdrop-blur/10 tw-relative tw-inline-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsx("div", { className: "tw-z-20", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-backdrop-blur/10 tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2905
2925
|
}
|
|
2906
2926
|
|
|
2907
2927
|
const tooltipWidthClassMap = {
|
|
@@ -2917,12 +2937,12 @@ const tooltipThresholdClassMap = {
|
|
|
2917
2937
|
xl: 'tw-pb-squid-xl',
|
|
2918
2938
|
xxl: 'tw-pb-squid-xxl',
|
|
2919
2939
|
};
|
|
2920
|
-
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs',
|
|
2921
|
-
return (jsxs("div", { className: cn('tw-relative',
|
|
2940
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, }) {
|
|
2941
|
+
return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), jsx(Menu, { containerClassName: cn('tw-absolute tw-z-40 tw-hidden hover:tw-block peer-hover:tw-block', 'tw-bottom-full tw-left-1/2 -tw-translate-x-1/2', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })] }));
|
|
2922
2942
|
}
|
|
2923
2943
|
|
|
2924
|
-
function Boost() {
|
|
2925
|
-
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs", children: [jsx(BoostButton, {}), jsx(Chip, { label:
|
|
2944
|
+
function Boost({ boostMode, onToggleBoostMode }) {
|
|
2945
|
+
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-bg-grey-900 tw-pr-squid-xxs", children: [jsx(BoostButton, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }), jsx(Chip, { label: boostMode === 'normal' ? '10m' : '20s', className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
|
|
2926
2946
|
}
|
|
2927
2947
|
|
|
2928
2948
|
var DetailsToolbarState;
|
|
@@ -2945,7 +2965,7 @@ const detailStateClassMap = {
|
|
|
2945
2965
|
};
|
|
2946
2966
|
function DetailsToolbar({ state = DetailsToolbarState.FULL, errorMessage, }) {
|
|
2947
2967
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
2948
|
-
return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsx(ErrorMessage, { message: errorMessage })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {}) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, {}) })] })) }));
|
|
2968
|
+
return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsx(ErrorMessage, { message: errorMessage })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {}) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { boostMode: "boost" }) })] })) }));
|
|
2949
2969
|
}
|
|
2950
2970
|
const ErrorMessage = ({ message }) => {
|
|
2951
2971
|
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsx(EmojiSadIcon, {}), jsx(CaptionText, { children: message })] }));
|
|
@@ -2954,30 +2974,19 @@ const ErrorMessage = ({ message }) => {
|
|
|
2954
2974
|
function Modal({ children }) {
|
|
2955
2975
|
return (
|
|
2956
2976
|
// modal container
|
|
2957
|
-
jsx("div", { className: "tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m",
|
|
2958
|
-
backdropFilter: 'blur(20px)',
|
|
2959
|
-
}, children: jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-end tw-overflow-hidden", children: children }) }));
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
|
-
// font size, line height, and letter spacing classes
|
|
2963
|
-
const textClassMap = {
|
|
2964
|
-
small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
|
|
2965
|
-
medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
|
|
2966
|
-
large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
|
|
2967
|
-
};
|
|
2968
|
-
function HeadingText({ children, bold, size }) {
|
|
2969
|
-
const fontWeightClass = bold
|
|
2970
|
-
? 'tw-font-heading-bold'
|
|
2971
|
-
: 'tw-font-heading-regular';
|
|
2972
|
-
return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
2977
|
+
jsx("div", { className: "tw-backdrop-blur/20 tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m", children: jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end", children: children }) }));
|
|
2973
2978
|
}
|
|
2974
2979
|
|
|
2975
|
-
function NavigationBar({ title, displayBackButton = false, logoUrl, }) {
|
|
2976
|
-
return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-
|
|
2980
|
+
function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, }) {
|
|
2981
|
+
return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsx(Button, { className: displayButtonShadows
|
|
2982
|
+
? 'group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2'
|
|
2983
|
+
: undefined, variant: "tertiary", size: "md", icon: jsx(ArrowLeftIcon, {}) })) : 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", children: jsx(AddressButton, { className: displayButtonShadows
|
|
2984
|
+
? 'group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2'
|
|
2985
|
+
: undefined, label: "Connect" }) })] }), title ? (jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-l tw-py-squid-xxs", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
|
|
2977
2986
|
}
|
|
2978
2987
|
|
|
2979
2988
|
function ProductCard({ children }) {
|
|
2980
|
-
return (jsx("div", { className: "tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs
|
|
2989
|
+
return (jsx("div", { className: "tw-backdrop-blur/10 tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs", children: jsx("div", { className: "tw-relative tw-flex tw-h-full tw-max-h-[660px] tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300", children: children }) }));
|
|
2981
2990
|
}
|
|
2982
2991
|
|
|
2983
2992
|
function MaxIcon() {
|
|
@@ -2996,19 +3005,91 @@ function SwapConfiguration({ priceImpactPercentage, amount = 0, swapAmountUsd =
|
|
|
2996
3005
|
const priceImpactClass = (priceImpactPercentage !== null && priceImpactPercentage !== void 0 ? priceImpactPercentage : 0) > 5
|
|
2997
3006
|
? 'tw-text-status-negative'
|
|
2998
3007
|
: 'tw-text-grey-300';
|
|
2999
|
-
return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-
|
|
3008
|
+
return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxs("div", { className: "-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 hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsx(WalletAddress, { ens: "so-so.eth" })] }) }), jsx("div", { className: "tw-px-squid-l", children: jsx(AssetsButton, { chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), jsx("div", { className: "tw-px-squid-m", children: jsx("input", { className: "tw-my-squid-xs tw-h-[55px] tw-w-full 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-royal-400 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-outline-none", placeholder: "0", value: amount }) }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(SwapInputsIcon, {}), jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balance }), jsx(MaxIcon, {})] })] }))] }));
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
function SwapProgressViewHeader({ title, description, }) {
|
|
3012
|
+
return (jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
|
|
3000
3013
|
}
|
|
3001
3014
|
|
|
3002
|
-
function
|
|
3003
|
-
return (jsx("
|
|
3015
|
+
function SwapStepSeparator() {
|
|
3016
|
+
return (jsx("span", { className: "tw-flex tw-h-squid-m tw-w-squid-xxl tw-items-center tw-justify-center tw-self-stretch tw-py-0.5", children: jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "21", viewBox: "0 0 4 21", fill: "none", children: jsx("path", { d: "M2 2.5V18.5", stroke: "currentColor", "stroke-width": "4", "stroke-linecap": "round" }) }) }));
|
|
3004
3017
|
}
|
|
3005
3018
|
|
|
3006
|
-
function
|
|
3007
|
-
return (jsx("
|
|
3019
|
+
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
3020
|
+
return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-pl-squid-xxs hover:tw-bg-material-light-thin", children: [jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsx(CaptionText, { className: labelClassName, children: label })] }) }));
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
function useModal(props) {
|
|
3024
|
+
const [isModalOpen, setIsModalOpen] = useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
|
|
3025
|
+
const modalRef = useRef(null);
|
|
3026
|
+
const openModalButtonRef = useRef(null);
|
|
3027
|
+
useEffect(() => {
|
|
3028
|
+
const handleClickOutside = (event) => {
|
|
3029
|
+
var _a;
|
|
3030
|
+
// close modal if the user clicked outside of it
|
|
3031
|
+
if (modalRef.current &&
|
|
3032
|
+
!modalRef.current.contains(event.target) &&
|
|
3033
|
+
!((_a = openModalButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
3034
|
+
setIsModalOpen(false);
|
|
3035
|
+
}
|
|
3036
|
+
};
|
|
3037
|
+
document.addEventListener('click', handleClickOutside);
|
|
3038
|
+
return () => {
|
|
3039
|
+
document.removeEventListener('click', handleClickOutside);
|
|
3040
|
+
};
|
|
3041
|
+
}, [modalRef]);
|
|
3042
|
+
const openModal = useCallback(() => {
|
|
3043
|
+
setIsModalOpen((prev) => !prev);
|
|
3044
|
+
}, []);
|
|
3045
|
+
const closeModal = useCallback(() => {
|
|
3046
|
+
setIsModalOpen(false);
|
|
3047
|
+
}, []);
|
|
3048
|
+
return {
|
|
3049
|
+
isModalOpen,
|
|
3050
|
+
openModal,
|
|
3051
|
+
closeModal,
|
|
3052
|
+
modalRef,
|
|
3053
|
+
openModalButtonRef,
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
function CompassRound({ size = '20', className, }) {
|
|
3058
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("path", { d: "M17.7087 9.99996C17.7087 14.2572 14.2575 17.7083 10.0003 17.7083C5.74313 17.7083 2.29199 14.2572 2.29199 9.99996C2.29199 5.74276 5.74313 2.29163 10.0003 2.29163C14.2575 2.29163 17.7087 5.74276 17.7087 9.99996Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" }), jsx("path", { d: "M12.2135 7.27515L8.79307 8.208C8.5084 8.28564 8.286 8.50803 8.20837 8.7927L7.27552 12.2132C7.19069 12.5242 7.47609 12.8096 7.78713 12.7248L11.2076 11.7919C11.4923 11.7143 11.7146 11.4919 11.7923 11.2072L12.7251 7.78677C12.81 7.47573 12.5246 7.19032 12.2135 7.27515Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" })] }));
|
|
3059
|
+
}
|
|
3060
|
+
function CircleX({ size = '20', className, }) {
|
|
3061
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { d: "M12.5003 7.49996L7.50033 12.5M12.5003 12.5L7.50033 7.49996M17.7087 9.99996C17.7087 14.2572 14.2575 17.7083 10.0003 17.7083C5.74313 17.7083 2.29199 14.2572 2.29199 9.99996C2.29199 5.74276 5.74313 2.29163 10.0003 2.29163C14.2575 2.29163 17.7087 5.74276 17.7087 9.99996Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) }));
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
|
|
3065
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M1.33325 8.00008C1.33325 7.2637 1.93021 6.66675 2.66659 6.66675C3.40297 6.66675 3.99992 7.2637 3.99992 8.00008C3.99992 8.73646 3.40297 9.33341 2.66659 9.33341C1.93021 9.33341 1.33325 8.73646 1.33325 8.00008ZM6.66659 8.00008C6.66659 7.2637 7.26354 6.66675 7.99992 6.66675C8.7363 6.66675 9.33325 7.2637 9.33325 8.00008C9.33325 8.73646 8.7363 9.33341 7.99992 9.33341C7.26354 9.33341 6.66659 8.73646 6.66659 8.00008ZM11.9999 8.00008C11.9999 7.2637 12.5969 6.66675 13.3333 6.66675C14.0696 6.66675 14.6666 7.2637 14.6666 8.00008C14.6666 8.73646 14.0696 9.33341 13.3333 9.33341C12.5969 9.33341 11.9999 8.73646 11.9999 8.00008Z", fill: "currentColor" }) }));
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
function RefreshIcon() {
|
|
3069
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [jsx("path", { d: "M10.8333 17.4999C11.2936 17.4999 11.6667 17.1269 11.6667 16.6666C11.6667 16.2064 11.2936 15.8333 10.8333 15.8333C10.3731 15.8333 10 16.2064 10 16.6666C10 17.1269 10.3731 17.4999 10.8333 17.4999Z", fill: "currentColor" }), jsx("path", { d: "M17.5 9.16661C17.5 8.70638 17.1269 8.33328 16.6667 8.33328C16.2064 8.33328 15.8333 8.70638 15.8333 9.16661C15.8333 9.62685 16.2064 9.99995 16.6667 9.99995C17.1269 9.99995 17.5 9.62685 17.5 9.16661Z", fill: "currentColor" }), jsx("path", { d: "M16.6079 11.8899C17.0065 12.12 17.143 12.6297 16.9129 13.0283C16.6828 13.4268 16.1731 13.5634 15.7746 13.3333C15.376 13.1032 15.2394 12.5935 15.4695 12.1949C15.6997 11.7964 16.2093 11.6598 16.6079 11.8899Z", fill: "currentColor" }), jsx("path", { d: "M14.473 16.0785C14.8716 15.8483 15.0081 15.3387 14.778 14.9401C14.5479 14.5415 14.0382 14.405 13.6397 14.6351C13.2411 14.8652 13.1045 15.3749 13.3347 15.7734C13.5648 16.172 14.0744 16.3086 14.473 16.0785Z", fill: "currentColor" }), jsx("path", { d: "M15.7725 6.66661C15.3739 6.89673 14.8642 6.76017 14.6341 6.36159C14.404 5.96301 14.5405 5.45335 14.9391 5.22323C15.3377 4.99312 15.8474 5.12968 16.0775 5.52826C16.3076 5.92683 16.171 6.43649 15.7725 6.66661Z", fill: "currentColor" }), jsx("path", { d: "M7.70833 12.2917V16.875H3.125M7.5 16.4063C4.93915 15.4062 3.125 12.915 3.125 10C3.125 6.20304 6.20304 3.125 10 3.125C10.9614 3.125 11.8768 3.32235 12.7077 3.67876", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
3073
|
+
return (jsx("div", { ref: dropdownRef, children: jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsx("ul", { className: "custom-scrollbar tw-flex tw-w-[144px] tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs", children: items.map((item) => (jsx(DropdownMenuItem, Object.assign({}, item)))) }) }) }));
|
|
3008
3074
|
}
|
|
3009
3075
|
|
|
3010
3076
|
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', }) {
|
|
3011
|
-
|
|
3077
|
+
const { isModalOpen, modalRef, openModalButtonRef, openModal } = useModal();
|
|
3078
|
+
return (jsx("li", { className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxs("div", { className: "tw-group/history-item tw-relative tw-flex tw-flex-shrink-0 tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin", children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), jsx("div", { className: "tw-transition-opacity group-hover/history-item:tw-opacity-0", children: isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted })) }), jsx("button", { className: "tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity group-hover/history-item:tw-opacity-100", onClick: openModal, ref: openModalButtonRef, children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] }), isModalOpen ? (jsx(DropdownMenu, { dropdownRef: modalRef, items: [
|
|
3079
|
+
{
|
|
3080
|
+
label: 'Repeat swap',
|
|
3081
|
+
icon: jsx(RefreshIcon, {}),
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
label: 'View on xyz',
|
|
3085
|
+
icon: jsx(CompassRound, {}),
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
label: 'Clear',
|
|
3089
|
+
labelClassName: 'tw-text-status-negative',
|
|
3090
|
+
icon: jsx(CircleX, { className: "tw-text-status-negative" }),
|
|
3091
|
+
},
|
|
3092
|
+
] })) : null] }) }));
|
|
3012
3093
|
}
|
|
3013
3094
|
|
|
3014
3095
|
const listItemSizeMap = {
|
|
@@ -3029,6 +3110,73 @@ function SectionTitle({ title, icon, accessory, actionIcon, className, }) {
|
|
|
3029
3110
|
return (jsxs("header", { className: cn('tw-flex tw-h-[46px] tw-w-full tw-items-center tw-gap-squid-xxs tw-bg-grey-900 tw-px-squid-m tw-pb-squid-xs tw-pt-squid-m tw-text-royal-400', className), children: [icon, jsx(CaptionText, { children: title }), accessory ? (jsx(CaptionText, { className: "tw-flex-1 tw-text-right tw-text-grey-500", children: accessory })) : actionIcon ? (jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: actionIcon })) : null] }));
|
|
3030
3111
|
}
|
|
3031
3112
|
|
|
3113
|
+
function HelpIcon({ size = '20', className, }) {
|
|
3114
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("g", { "clip-path": "url(#clip0_457_36778)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM6 7C6 4.46214 8.03736 3 10 3C12.1193 3 14 4.66531 14 7C14 7.93746 13.7596 8.6603 13.368 9.2586C13.0353 9.76679 12.6034 10.1601 12.2697 10.4639L12.1757 10.5497C11.8041 10.8904 11.534 11.1593 11.337 11.504C11.1513 11.8288 11 12.2794 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 11.9706 9.22366 11.1712 9.60051 10.5117C9.96604 9.87199 10.4459 9.42214 10.8243 9.07535L10.8834 9.02116L10.8834 9.02116L10.8834 9.02115C11.2572 8.67885 11.5066 8.45039 11.6945 8.16328C11.8654 7.9022 12 7.56254 12 7C12 5.83469 11.0807 5 10 5C8.96264 5 8 5.73786 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7ZM10 15C9.44771 15 9 15.4477 9 16C9 16.5523 9.44771 17 10 17C10.5523 17 11 16.5523 11 16C11 15.4477 10.5523 15 10 15Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_457_36778", children: jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, }) {
|
|
3118
|
+
return (jsxs("li", { className: "tw-flex tw-h-[50px] tw-scroll-px-5 tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-grey-900 tw-px-5 tw-py-squid-xs tw-text-grey-300", children: [icon, jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsx(BodyText, { size: "small", children: label }), showHelpIcon ? jsx(HelpIcon, { className: "tw-text-grey-600" }) : null] }), jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', transparentControls ? '' : 'tw-bg-grey-800'), children: controls })] }));
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
function SwapDetailListItem({ label, detail, icon, }) {
|
|
3122
|
+
return (jsx("li", { className: "tw-swap-detail-list-item-gradient tw-h-squid-l tw-w-full tw-bg-grey-800 tw-px-squid-xs tw-text-grey-300", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-justify-between tw-gap-squid-xs tw-rounded-squid-xs tw-px-squid-xs", children: [jsx("div", { className: "tw-h-6 tw-w-6 tw-text-grey-500", children: icon }), jsx(CaptionText, { className: "tw-flex-1 tw-text-grey-500", children: label }), typeof detail === 'string' ? (jsx(CaptionText, { children: detail })) : (detail)] }) }));
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, }) {
|
|
3126
|
+
return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-bg-grey-800 tw-text-grey-300", children: [showStepSeparator && jsx(SwapStepSeparator, {}), jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-text-royal-400", children: [jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsx(Chip, { className: "tw-w-squid-xl tw-bg-royal-400 tw-text-grey-900", icon: typeof chipContent === 'string' ? (jsx(CaptionText, { children: chipContent })) : (chipContent) }) }), jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map(({ type, value }, index) => {
|
|
3127
|
+
if (type === 'string') {
|
|
3128
|
+
return (
|
|
3129
|
+
// Instead of displaying the string into a single <BodyText />
|
|
3130
|
+
// we split it into multiple <BodyText />
|
|
3131
|
+
// for edge case where the string is too long to fit in one line
|
|
3132
|
+
value
|
|
3133
|
+
.trim()
|
|
3134
|
+
.split(' ')
|
|
3135
|
+
.map((word, i) => (jsx(BodyText, { size: "small", className: "tw-leading-[20px]", children: word }, i))));
|
|
3136
|
+
}
|
|
3137
|
+
else if (type === 'image') {
|
|
3138
|
+
return (jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
|
|
3139
|
+
}
|
|
3140
|
+
return null;
|
|
3141
|
+
}) })] })] }));
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
function SwapStepsCollapsed({ steps, currentStepCount: _currentStepCount, }) {
|
|
3145
|
+
// handles if route component is mounted
|
|
3146
|
+
const [isRouteVisible, setIsRouteVisible] = useState(false);
|
|
3147
|
+
const currentStepCount = Math.round(_currentStepCount);
|
|
3148
|
+
// handles if route component is animating to show
|
|
3149
|
+
const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = useState(false);
|
|
3150
|
+
const currentStep = steps[currentStepCount - 1];
|
|
3151
|
+
const isLastStep = currentStepCount === steps.length;
|
|
3152
|
+
const isFirstStep = currentStepCount === 1;
|
|
3153
|
+
useEffect(() => {
|
|
3154
|
+
// we do not want to unmount the route component if the animation to show route is running
|
|
3155
|
+
if (isShowRouteAnimationRunning)
|
|
3156
|
+
return;
|
|
3157
|
+
// unmount route component when the animation of hiding is done
|
|
3158
|
+
const timeoutId = setTimeout(() => {
|
|
3159
|
+
setIsRouteVisible(false);
|
|
3160
|
+
}, 350);
|
|
3161
|
+
return () => {
|
|
3162
|
+
clearTimeout(timeoutId);
|
|
3163
|
+
};
|
|
3164
|
+
}, [isShowRouteAnimationRunning]);
|
|
3165
|
+
return (jsxs(Fragment, { children: [jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full tw-rounded-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxs("button", { onClick: () => {
|
|
3166
|
+
// mount route component and start animation
|
|
3167
|
+
setIsRouteVisible(true);
|
|
3168
|
+
setIsShowRouteAnimationRunning(true);
|
|
3169
|
+
}, className: "tw-relative tw-flex tw-min-h-button tw-w-full tw-items-center tw-overflow-hidden tw-rounded-squid-xxl tw-border tw-border-material-light-thin tw-bg-grey-800 tw-px-squid-xs tw-text-grey-300", children: [!isLastStep && (jsxs("span", { className: "tw-absolute -tw-top-1.5", children: [jsx("span", { className: "tw-absolute tw-top-1 tw-h-full tw-w-full -tw-translate-x-1/2 tw-bg-gradient-to-b tw-from-grey-800 tw-to-transparent" }), jsx(SwapStepSeparator, {})] })), jsx(SwapStepItem, { descriptionBlocks: currentStep.descriptionBlocks, chipContent: currentStep.chipContent }), !isFirstStep && (jsxs("span", { className: "tw-absolute -tw-bottom-1.5", children: [jsx("span", { className: "tw-absolute tw-bottom-1 tw-h-full tw-w-full -tw-translate-x-1/2 tw-bg-gradient-to-b tw-from-transparent tw-to-grey-800" }), jsx(SwapStepSeparator, {})] }))] }) }), isRouteVisible && (jsxs("div", { className: cn('tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800', isShowRouteAnimationRunning
|
|
3170
|
+
? 'tw-animate-slide-to-top'
|
|
3171
|
+
: 'tw-animate-slide-to-bottom'), children: [jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsx("button", { onClick: () => setIsShowRouteAnimationRunning(false), className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { className: "custom-scrollbar tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1) }, index))) }), jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }))] }));
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
function TokenPair({ firstToken, secondToken }) {
|
|
3175
|
+
return (jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsx("defs", { children: jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
|
|
3176
|
+
background: `linear-gradient(to right, ${firstToken.bgColor} 43.48%, ${secondToken.bgColor} 56.52%)`,
|
|
3177
|
+
}, children: [jsx("img", { className: "tw-ml-[1px] tw-aspect-square tw-w-10", src: firstToken.imageUrl }), jsx("img", { className: "tw-mr-[1px] tw-aspect-square tw-w-10", src: secondToken.imageUrl })] })] }));
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3032
3180
|
/**
|
|
3033
3181
|
* Parsing the user readable config to css variables with HSL values
|
|
3034
3182
|
* @param style
|
|
@@ -3082,11 +3230,9 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3082
3230
|
.padStart(2, '0')).toUpperCase();
|
|
3083
3231
|
}
|
|
3084
3232
|
|
|
3085
|
-
|
|
3086
|
-
function SquidConfigProvider({ theme, children, }) {
|
|
3087
|
-
const Provider = squidConfigContext.Provider;
|
|
3233
|
+
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3088
3234
|
const parsedStyle = getParsedStyle(theme);
|
|
3089
|
-
return (jsx(
|
|
3235
|
+
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: clsx('tw-text-base-content tw-group tw-relative tw-font-geist'), children: children }));
|
|
3090
3236
|
}
|
|
3091
3237
|
|
|
3092
|
-
export { AddressButton, ArrowButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar,
|
|
3238
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenuItem, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, ProductCard, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, WalletAddress, useModal };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface AssetsButtonProps {
|
|
2
|
+
tokenImageUrl?: string;
|
|
3
|
+
chainImageUrl?: string;
|
|
4
|
+
tokenSymbol?: string;
|
|
5
|
+
chainBgColor?: string;
|
|
6
|
+
tokenBgColor?: string;
|
|
7
|
+
tokenTextColor?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|