@0xsquid/ui 0.5.0 → 0.6.1
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 +112 -106
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +3 -1
- package/dist/cjs/types/components/buttons/FeeButton.d.ts +7 -1
- package/dist/cjs/types/components/layout/Boost.d.ts +4 -1
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +6 -1
- package/dist/cjs/types/components/lists/ListItem.d.ts +2 -1
- package/dist/cjs/types/stories/buttons/BoostButton.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/Boost.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
- package/dist/cjs/types/stories/lists/ListItem.stories.d.ts +2 -0
- package/dist/esm/index.js +112 -106
- package/dist/esm/types/components/buttons/BoostButton.d.ts +3 -1
- package/dist/esm/types/components/buttons/FeeButton.d.ts +7 -1
- package/dist/esm/types/components/layout/Boost.d.ts +4 -1
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +6 -1
- package/dist/esm/types/components/lists/ListItem.d.ts +2 -1
- package/dist/esm/types/stories/buttons/BoostButton.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/Boost.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
- package/dist/esm/types/stories/lists/ListItem.stories.d.ts +2 -0
- package/dist/index.css +24 -7
- package/dist/index.d.ts +20 -5
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2772,91 +2772,27 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2772
2772
|
}
|
|
2773
2773
|
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
2774
2774
|
}, [chainBgColor, tokenBgColor]);
|
|
2775
|
-
return (jsxRuntime.jsxs("div", { onClick: onClick, className: "tw-relative tw-flex tw-h-squid-xl tw-
|
|
2775
|
+
return (jsxRuntime.jsxs("div", { onClick: onClick, className: "tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center tw-text-grey-100", children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-cursor-pointer tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-cursor-pointer tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2776
2776
|
backgroundImage: bgGradient,
|
|
2777
|
-
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsxRuntime.jsx("img", { src: chainImageUrl, alt: "" })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsxRuntime.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: {
|
|
2777
|
+
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsxRuntime.jsx("img", { src: chainImageUrl, alt: "", className: "tw-rounded-full" })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsxRuntime.jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-cursor-pointer tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
|
|
2778
2778
|
backgroundColor: tokenBgColor,
|
|
2779
|
-
}, children: jsxRuntime.jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px]" }) })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer 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: {
|
|
2779
|
+
}, children: jsxRuntime.jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px] tw-rounded-full" }) })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer 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: {
|
|
2780
2780
|
backgroundColor: tokenBgColor,
|
|
2781
2781
|
color: tokenTextColor,
|
|
2782
2782
|
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-text-material-light-thick" })] })] }));
|
|
2783
2783
|
}
|
|
2784
2784
|
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
const boostIndicatorRef = react.useRef(null);
|
|
2788
|
-
function handleToggleBoostMode() {
|
|
2789
|
-
if (!boostIndicatorRef.current)
|
|
2790
|
-
return;
|
|
2791
|
-
// we don't want to trigger the animation when the component is mounted
|
|
2792
|
-
// so we set the animation duration only when user clicks the button
|
|
2793
|
-
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2794
|
-
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2795
|
-
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2796
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2797
|
-
}
|
|
2798
|
-
else {
|
|
2799
|
-
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2800
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
return (jsxRuntime.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: [jsxRuntime.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" }), jsxRuntime.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" }), jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
2804
|
-
boxShadow: generateMarkerLines(40),
|
|
2805
|
-
} })] }), jsxRuntime.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: {
|
|
2806
|
-
transitionDuration: animationDuration,
|
|
2807
|
-
} })] }));
|
|
2808
|
-
}
|
|
2809
|
-
function generateMarkerLines(count) {
|
|
2810
|
-
const halfCount = Math.ceil(count / 2);
|
|
2811
|
-
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2812
|
-
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2813
|
-
});
|
|
2814
|
-
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2815
|
-
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2816
|
-
});
|
|
2817
|
-
const allShadows = [...rightShadows, ...leftShadows];
|
|
2818
|
-
return allShadows.join(', ');
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
const buttonSizeClassMap = {
|
|
2822
|
-
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',
|
|
2823
|
-
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2824
|
-
};
|
|
2825
|
-
const buttonVariantClassMap = {
|
|
2826
|
-
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2827
|
-
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2828
|
-
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2829
|
-
};
|
|
2830
|
-
// right now all variants have the same disabled styles
|
|
2831
|
-
// in the future, we can add more disabled styles for different variants
|
|
2832
|
-
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2833
|
-
function Button(_a) {
|
|
2834
|
-
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2835
|
-
return (jsxRuntime.jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2836
|
-
// disabled styles
|
|
2837
|
-
buttonDisabledClass,
|
|
2838
|
-
// custom classes from props
|
|
2839
|
-
props.className), children: size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2840
|
-
// label only
|
|
2841
|
-
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2842
|
-
// icon only
|
|
2843
|
-
icon) : (
|
|
2844
|
-
// icon and label
|
|
2845
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2846
|
-
}
|
|
2847
|
-
|
|
2848
|
-
function Chip(_a) {
|
|
2849
|
-
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2850
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
function EthereumIcon() {
|
|
2854
|
-
return (jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
|
|
2785
|
+
function SearchIcon() {
|
|
2786
|
+
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M20 20L16.05 16.05M18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
2855
2787
|
}
|
|
2856
2788
|
|
|
2857
|
-
function
|
|
2858
|
-
|
|
2789
|
+
function Input(_a) {
|
|
2790
|
+
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon"]);
|
|
2791
|
+
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsxRuntime.jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2 focus:tw-outline-royal-500', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', className), placeholder: placeholder })), showIcon ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsxRuntime.jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(PasteButton, {}) })) : null] }));
|
|
2859
2792
|
}
|
|
2793
|
+
const PasteButton = () => {
|
|
2794
|
+
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { children: "Paste" }) }));
|
|
2795
|
+
};
|
|
2860
2796
|
|
|
2861
2797
|
// font size, line height, and letter spacing classes
|
|
2862
2798
|
const textClassMap = {
|
|
@@ -2871,22 +2807,6 @@ function HeadingText({ children, bold, size }) {
|
|
|
2871
2807
|
return (jsxRuntime.jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
2872
2808
|
}
|
|
2873
2809
|
|
|
2874
|
-
function SettingsButton({ label }) {
|
|
2875
|
-
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { children: label }) }));
|
|
2876
|
-
}
|
|
2877
|
-
|
|
2878
|
-
function SearchIcon() {
|
|
2879
|
-
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M20 20L16.05 16.05M18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
function Input(_a) {
|
|
2883
|
-
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon"]);
|
|
2884
|
-
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsxRuntime.jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2 focus:tw-outline-royal-500', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', className), placeholder: placeholder })), showIcon ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsxRuntime.jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(PasteButton, {}) })) : null] }));
|
|
2885
|
-
}
|
|
2886
|
-
const PasteButton = () => {
|
|
2887
|
-
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { children: "Paste" }) }));
|
|
2888
|
-
};
|
|
2889
|
-
|
|
2890
2810
|
function SettingsSlider({ value, type }) {
|
|
2891
2811
|
return (jsxRuntime.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: [jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-300", children: "%" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-300", children: "$" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) })] })) }), jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
|
|
2892
2812
|
}
|
|
@@ -2940,11 +2860,94 @@ const tooltipThresholdClassMap = {
|
|
|
2940
2860
|
xxl: 'tw-pb-squid-xxl',
|
|
2941
2861
|
};
|
|
2942
2862
|
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, }) {
|
|
2943
|
-
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsxRuntime.jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), jsxRuntime.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 })] }));
|
|
2863
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsxRuntime.jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsxRuntime.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 })) : null] }));
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
const animationDuration = '500ms';
|
|
2867
|
+
function BoostButton({ boostMode: _boostMode, onToggleBoostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', }) {
|
|
2868
|
+
const boostIndicatorRef = react.useRef(null);
|
|
2869
|
+
// force normal mode if canToggleBoostMode is false
|
|
2870
|
+
const boostMode = canToggleBoostMode ? _boostMode : 'normal';
|
|
2871
|
+
function handleToggleBoostMode() {
|
|
2872
|
+
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
2873
|
+
return;
|
|
2874
|
+
// we don't want to trigger the animation when the component is mounted
|
|
2875
|
+
// so we set the animation duration only when user clicks the button
|
|
2876
|
+
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2877
|
+
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2878
|
+
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2879
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2880
|
+
}
|
|
2881
|
+
else {
|
|
2882
|
+
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2883
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return (jsxRuntime.jsx(Tooltip, { tooltipWidth: "max", tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxRuntime.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: [jsxRuntime.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" }), jsxRuntime.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" }), jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
2887
|
+
boxShadow: generateMarkerLines(40),
|
|
2888
|
+
} })] }), jsxRuntime.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: {
|
|
2889
|
+
transitionDuration: animationDuration,
|
|
2890
|
+
} })] }) }));
|
|
2891
|
+
}
|
|
2892
|
+
function generateMarkerLines(count) {
|
|
2893
|
+
const halfCount = Math.ceil(count / 2);
|
|
2894
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2895
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2896
|
+
});
|
|
2897
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2898
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2899
|
+
});
|
|
2900
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
2901
|
+
return allShadows.join(', ');
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
const buttonSizeClassMap = {
|
|
2905
|
+
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',
|
|
2906
|
+
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2907
|
+
};
|
|
2908
|
+
const buttonVariantClassMap = {
|
|
2909
|
+
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2910
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2911
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2912
|
+
};
|
|
2913
|
+
// right now all variants have the same disabled styles
|
|
2914
|
+
// in the future, we can add more disabled styles for different variants
|
|
2915
|
+
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2916
|
+
function Button(_a) {
|
|
2917
|
+
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2918
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2919
|
+
// disabled styles
|
|
2920
|
+
buttonDisabledClass,
|
|
2921
|
+
// custom classes from props
|
|
2922
|
+
props.className), children: size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2923
|
+
// label only
|
|
2924
|
+
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2925
|
+
// icon only
|
|
2926
|
+
icon) : (
|
|
2927
|
+
// icon and label
|
|
2928
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
function Chip(_a) {
|
|
2932
|
+
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2933
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
function EthereumIcon() {
|
|
2937
|
+
return (jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
function FeeButton(_a) {
|
|
2941
|
+
var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest(_a, ["feeInUsd", "chipLabel", "className"]);
|
|
2942
|
+
return (jsxRuntime.jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsxRuntime.jsx(Chip, { label: chipLabel }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
function SettingsButton({ label }) {
|
|
2946
|
+
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { children: label }) }));
|
|
2944
2947
|
}
|
|
2945
2948
|
|
|
2946
|
-
function Boost({ boostMode, onToggleBoostMode }) {
|
|
2947
|
-
return (jsxRuntime.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: [jsxRuntime.jsx(BoostButton, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }), jsxRuntime.jsx(Chip, { label:
|
|
2949
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }) {
|
|
2950
|
+
return (jsxRuntime.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: [jsxRuntime.jsx(BoostButton, { boostMode: boostMode, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, onToggleBoostMode: onToggleBoostMode }), jsxRuntime.jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
|
|
2948
2951
|
}
|
|
2949
2952
|
|
|
2950
2953
|
function EmojiSadIcon() {
|
|
@@ -2957,16 +2960,16 @@ const detailStateClassMap = {
|
|
|
2957
2960
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
2958
2961
|
full: '',
|
|
2959
2962
|
};
|
|
2960
|
-
function DetailsToolbar({ state = 'full', errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, }) {
|
|
2963
|
+
function DetailsToolbar({ state = 'full', errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, }) {
|
|
2961
2964
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
2962
|
-
return (jsxRuntime.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 === 'error' ? (jsxRuntime.jsx(ErrorMessage, { message: errorMessage })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, {}) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }) })] })) }));
|
|
2965
|
+
return (jsxRuntime.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 === 'error' ? (jsxRuntime.jsx(ErrorMessage, { message: errorMessage })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: canToggleBoostMode, boostDisabledMessage: boostDisabledMessage }) })] })) }));
|
|
2963
2966
|
}
|
|
2964
2967
|
const ErrorMessage = ({ message }) => {
|
|
2965
2968
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsxRuntime.jsx(EmojiSadIcon, {}), jsxRuntime.jsx(CaptionText, { children: message })] }));
|
|
2966
2969
|
};
|
|
2967
2970
|
|
|
2968
2971
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
2969
|
-
return (jsxRuntime.jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxRuntime.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: [jsxRuntime.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 ? (jsxRuntime.jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsxRuntime.jsx(CaptionText, { className: labelClassName, children: label })] }) }));
|
|
2972
|
+
return (jsxRuntime.jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-l tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-pl-squid-xxs hover:tw-bg-material-light-thin", children: [jsxRuntime.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 ? (jsxRuntime.jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsxRuntime.jsx(CaptionText, { className: labelClassName, children: label })] }) }));
|
|
2970
2973
|
}
|
|
2971
2974
|
|
|
2972
2975
|
function useModal(props) {
|
|
@@ -3020,7 +3023,7 @@ function RefreshIcon() {
|
|
|
3020
3023
|
|
|
3021
3024
|
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', }) {
|
|
3022
3025
|
const { isModalOpen, modalRef, openModalButtonRef, openModal } = useModal();
|
|
3023
|
-
return (jsxRuntime.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: jsxRuntime.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: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsxRuntime.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: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.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" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), jsxRuntime.jsx("div", { className: "tw-transition-opacity group-hover/history-item:tw-opacity-0", children: isPending ? (jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsxRuntime.jsx(CaptionText, { children: dateCompleted })) }), jsxRuntime.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: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] }), isModalOpen ? (jsxRuntime.jsx(DropdownMenu, { className: "-tw-left-[85px] tw-top-7", dropdownRef: modalRef, items: [
|
|
3026
|
+
return (jsxRuntime.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: jsxRuntime.jsxs("div", { className: "tw-group/history-item tw-relative tw-flex tw-flex-shrink-0 tw-cursor-pointer 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: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsxRuntime.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: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.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" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), jsxRuntime.jsx("div", { className: "tw-transition-opacity group-hover/history-item:tw-opacity-0", children: isPending ? (jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsxRuntime.jsx(CaptionText, { children: dateCompleted })) }), jsxRuntime.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: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] }), isModalOpen ? (jsxRuntime.jsx(DropdownMenu, { className: "-tw-left-[85px] tw-top-7", dropdownRef: modalRef, items: [
|
|
3024
3027
|
{
|
|
3025
3028
|
label: 'Repeat swap',
|
|
3026
3029
|
icon: jsxRuntime.jsx(RefreshIcon, {}),
|
|
@@ -3038,14 +3041,14 @@ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted,
|
|
|
3038
3041
|
}
|
|
3039
3042
|
|
|
3040
3043
|
const listItemSizeMap = {
|
|
3041
|
-
small: 'tw-max-w-list-item-small tw-h-list-item-small tw-px-squid-xs
|
|
3042
|
-
large: 'tw-max-w-list-item-large tw-h-list-item-large tw-px-squid-xs
|
|
3044
|
+
small: 'tw-max-w-list-item-small tw-h-list-item-small tw-px-squid-xs',
|
|
3045
|
+
large: 'tw-max-w-list-item-large tw-h-list-item-large tw-px-squid-xs',
|
|
3043
3046
|
};
|
|
3044
3047
|
function ListItem(_a) {
|
|
3045
|
-
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className"]);
|
|
3046
|
-
return (jsxRuntime.
|
|
3047
|
-
|
|
3048
|
-
|
|
3048
|
+
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected"]);
|
|
3049
|
+
return (jsxRuntime.jsx("li", Object.assign({}, props, { className: cn('tw-flex tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxRuntime.jsxs("div", { className: cn('tw-flex tw-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: false })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-w-full tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xs',
|
|
3050
|
+
// 'large' variant has extra padding
|
|
3051
|
+
size === 'large' && 'tw-px-squid-xxs'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className: "tw-truncate !tw-leading-[18px]", children: itemTitle })) : (itemTitle), size === 'large' && subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-squid-xs !tw-leading-[10px] tw-text-grey-500", children: subtitle })) : null] }), jsxRuntime.jsxs("span", { className: "tw-flex tw-max-h-4 tw-items-center", children: [size === 'large' ? (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })) : null, jsxRuntime.jsx("span", { className: "min-tw-w-4 min-tw-h-4", children: icon ? icon : null })] })] }) })));
|
|
3049
3052
|
}
|
|
3050
3053
|
|
|
3051
3054
|
function MenuItem({ label, imageUrl, icon }) {
|
|
@@ -3092,7 +3095,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3092
3095
|
}
|
|
3093
3096
|
|
|
3094
3097
|
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
3095
|
-
return (jsxRuntime.jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsxRuntime.jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsxRuntime.jsx("ul", { className: "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) => (jsxRuntime.jsx(DropdownMenuItem, Object.assign({}, item)))) }) }) }));
|
|
3098
|
+
return (jsxRuntime.jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsxRuntime.jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsxRuntime.jsx("ul", { className: "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) => (jsxRuntime.jsx(DropdownMenuItem, Object.assign({}, item), item.label))) }) }) }));
|
|
3096
3099
|
}
|
|
3097
3100
|
|
|
3098
3101
|
function Modal({ children }) {
|
|
@@ -3130,7 +3133,10 @@ function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd = '0',
|
|
|
3130
3133
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > 5
|
|
3131
3134
|
? 'tw-text-status-negative'
|
|
3132
3135
|
: 'tw-text-grey-300';
|
|
3133
|
-
|
|
3136
|
+
const isInteractive = direction === 'from';
|
|
3137
|
+
// improve accessibility
|
|
3138
|
+
const BalanceButtonTag = isInteractive ? 'button' : 'div';
|
|
3139
|
+
return (jsxRuntime.jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsxRuntime.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: jsxRuntime.jsxs("button", { onClick: onWalletButtonClick, 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: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), address ? (jsxRuntime.jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" })) : null, jsxRuntime.jsx(WalletAddress, { ens: address })] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { onClick: onAssetsButtonClick, 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 }) }), direction === 'from' ? (jsxRuntime.jsx("div", { className: "tw-px-squid-m tw-pb-[15px] tw-pt-[5px]", children: jsxRuntime.jsx("input", { className: "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-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", placeholder: "0", value: amount, onChange: onAmountChange }) })) : (jsxRuntime.jsx("div", { className: "tw-w-full tw-px-squid-m tw-pb-[15px] tw-pt-[5px]", children: jsxRuntime.jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsxRuntime.jsx("span", { children: amount }) }) })), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxRuntime.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: [jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isInteractive && 'hover:tw-bg-material-light-thin'), children: [jsxRuntime.jsx(SwapInputsIcon, {}), jsxRuntime.jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, {}), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxRuntime.jsxs(BalanceButtonTag, { className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isInteractive && 'hover:tw-bg-material-light-thin'), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balance }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
3134
3140
|
}
|
|
3135
3141
|
|
|
3136
3142
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { BoostMode } from '../../types/components';
|
|
2
2
|
interface BoostButtonProps {
|
|
3
3
|
boostMode: BoostMode;
|
|
4
|
+
canToggleBoostMode?: boolean;
|
|
4
5
|
onToggleBoostMode?: ({ boostMode }: {
|
|
5
6
|
boostMode: BoostMode;
|
|
6
7
|
}) => void;
|
|
8
|
+
boostDisabledMessage?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare function BoostButton({ boostMode, onToggleBoostMode, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function BoostButton({ boostMode: _boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface FeeButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
feeInUsd?: string;
|
|
4
|
+
chipLabel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function FeeButton({ feeInUsd, chipLabel, className, ...props }: FeeButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -4,6 +4,9 @@ interface BoostProps {
|
|
|
4
4
|
onToggleBoostMode?: ({ boostMode }: {
|
|
5
5
|
boostMode: BoostMode;
|
|
6
6
|
}) => void;
|
|
7
|
+
estimatedTime: string;
|
|
8
|
+
boostDisabledMessage?: string;
|
|
9
|
+
canToggleBoostMode?: boolean;
|
|
7
10
|
}
|
|
8
|
-
export declare function Boost({ boostMode, onToggleBoostMode }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -7,6 +7,11 @@ interface DetailsToolbarProps {
|
|
|
7
7
|
boostMode: BoostMode;
|
|
8
8
|
}) => void;
|
|
9
9
|
onInvertSwapButtonClick?: () => void;
|
|
10
|
+
onFeeButtonClick?: () => void;
|
|
11
|
+
feeInUsd?: string;
|
|
12
|
+
estimatedTime?: string;
|
|
13
|
+
canToggleBoostMode?: boolean;
|
|
14
|
+
boostDisabledMessage?: string;
|
|
10
15
|
}
|
|
11
|
-
export declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
12
17
|
export {};
|
|
@@ -8,8 +8,9 @@ interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
|
8
8
|
icon?: React.ReactNode;
|
|
9
9
|
size?: ListItemSize;
|
|
10
10
|
mainIcon?: React.ReactNode;
|
|
11
|
+
isSelected?: boolean;
|
|
11
12
|
className?: string;
|
|
12
13
|
}
|
|
13
14
|
type ListItemSize = 'small' | 'large';
|
|
14
|
-
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size, mainIcon, className, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size, mainIcon, className, isSelected, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -8,7 +8,9 @@ export declare const LargeWithSubtitle: Story;
|
|
|
8
8
|
export declare const LargeWithDetail: Story;
|
|
9
9
|
export declare const LargeWithIcon: Story;
|
|
10
10
|
export declare const LargeWithSecondaryImage: Story;
|
|
11
|
+
export declare const LargeSelected: Story;
|
|
11
12
|
export declare const LargeWithCustomIconAsImage: Story;
|
|
12
13
|
export declare const Small: Story;
|
|
13
14
|
export declare const SmallWithIcon: Story;
|
|
15
|
+
export declare const SmallSelected: Story;
|
|
14
16
|
export declare const SmallWithCustomIconAsImage: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -2770,91 +2770,27 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2770
2770
|
}
|
|
2771
2771
|
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
2772
2772
|
}, [chainBgColor, tokenBgColor]);
|
|
2773
|
-
return (jsxs("div", { onClick: onClick, className: "tw-relative tw-flex tw-h-squid-xl tw-
|
|
2773
|
+
return (jsxs("div", { onClick: onClick, className: "tw-relative tw-flex tw-h-squid-xl tw-w-fit 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-cursor-pointer 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-cursor-pointer tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2774
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: {
|
|
2775
|
+
}, children: jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsx("img", { src: chainImageUrl, alt: "", className: "tw-rounded-full" })) : (jsx(Fragment, { children: jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-cursor-pointer tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
|
|
2776
2776
|
backgroundColor: tokenBgColor,
|
|
2777
|
-
}, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px]" }) })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer 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: {
|
|
2777
|
+
}, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px] tw-rounded-full" }) })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer 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
2778
|
backgroundColor: tokenBgColor,
|
|
2779
2779
|
color: tokenTextColor,
|
|
2780
2780
|
}, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, { className: "tw-text-material-light-thick" })] })] }));
|
|
2781
2781
|
}
|
|
2782
2782
|
|
|
2783
|
-
|
|
2784
|
-
|
|
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',
|
|
2822
|
-
};
|
|
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',
|
|
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
|
-
}
|
|
2850
|
-
|
|
2851
|
-
function EthereumIcon() {
|
|
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" })] }));
|
|
2783
|
+
function SearchIcon() {
|
|
2784
|
+
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" }) }));
|
|
2853
2785
|
}
|
|
2854
2786
|
|
|
2855
|
-
function
|
|
2856
|
-
|
|
2787
|
+
function Input(_a) {
|
|
2788
|
+
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon"]);
|
|
2789
|
+
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2 focus:tw-outline-royal-500', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(PasteButton, {}) })) : null] }));
|
|
2857
2790
|
}
|
|
2791
|
+
const PasteButton = () => {
|
|
2792
|
+
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" }) }));
|
|
2793
|
+
};
|
|
2858
2794
|
|
|
2859
2795
|
// font size, line height, and letter spacing classes
|
|
2860
2796
|
const textClassMap = {
|
|
@@ -2869,22 +2805,6 @@ function HeadingText({ children, bold, size }) {
|
|
|
2869
2805
|
return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
2870
2806
|
}
|
|
2871
2807
|
|
|
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 }) }));
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
function SearchIcon() {
|
|
2877
|
-
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" }) }));
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
function Input(_a) {
|
|
2881
|
-
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon"]);
|
|
2882
|
-
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2 focus:tw-outline-royal-500', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showPasteButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(PasteButton, {}) })) : null] }));
|
|
2883
|
-
}
|
|
2884
|
-
const PasteButton = () => {
|
|
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" }) }));
|
|
2886
|
-
};
|
|
2887
|
-
|
|
2888
2808
|
function SettingsSlider({ value, type }) {
|
|
2889
2809
|
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
2810
|
}
|
|
@@ -2938,11 +2858,94 @@ const tooltipThresholdClassMap = {
|
|
|
2938
2858
|
xxl: 'tw-pb-squid-xxl',
|
|
2939
2859
|
};
|
|
2940
2860
|
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 })] }));
|
|
2861
|
+
return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (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 })) : null] }));
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
const animationDuration = '500ms';
|
|
2865
|
+
function BoostButton({ boostMode: _boostMode, onToggleBoostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', }) {
|
|
2866
|
+
const boostIndicatorRef = useRef(null);
|
|
2867
|
+
// force normal mode if canToggleBoostMode is false
|
|
2868
|
+
const boostMode = canToggleBoostMode ? _boostMode : 'normal';
|
|
2869
|
+
function handleToggleBoostMode() {
|
|
2870
|
+
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
2871
|
+
return;
|
|
2872
|
+
// we don't want to trigger the animation when the component is mounted
|
|
2873
|
+
// so we set the animation duration only when user clicks the button
|
|
2874
|
+
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2875
|
+
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2876
|
+
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2877
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2878
|
+
}
|
|
2879
|
+
else {
|
|
2880
|
+
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2881
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
return (jsx(Tooltip, { tooltipWidth: "max", tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: 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: {
|
|
2885
|
+
boxShadow: generateMarkerLines(40),
|
|
2886
|
+
} })] }), 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: {
|
|
2887
|
+
transitionDuration: animationDuration,
|
|
2888
|
+
} })] }) }));
|
|
2889
|
+
}
|
|
2890
|
+
function generateMarkerLines(count) {
|
|
2891
|
+
const halfCount = Math.ceil(count / 2);
|
|
2892
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2893
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2894
|
+
});
|
|
2895
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2896
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2897
|
+
});
|
|
2898
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
2899
|
+
return allShadows.join(', ');
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
const buttonSizeClassMap = {
|
|
2903
|
+
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',
|
|
2904
|
+
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2905
|
+
};
|
|
2906
|
+
const buttonVariantClassMap = {
|
|
2907
|
+
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2908
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2909
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2910
|
+
};
|
|
2911
|
+
// right now all variants have the same disabled styles
|
|
2912
|
+
// in the future, we can add more disabled styles for different variants
|
|
2913
|
+
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2914
|
+
function Button(_a) {
|
|
2915
|
+
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2916
|
+
return (jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2917
|
+
// disabled styles
|
|
2918
|
+
buttonDisabledClass,
|
|
2919
|
+
// custom classes from props
|
|
2920
|
+
props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2921
|
+
// label only
|
|
2922
|
+
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2923
|
+
// icon only
|
|
2924
|
+
icon) : (
|
|
2925
|
+
// icon and label
|
|
2926
|
+
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
function Chip(_a) {
|
|
2930
|
+
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2931
|
+
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) })));
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
function EthereumIcon() {
|
|
2935
|
+
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" })] }));
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
function FeeButton(_a) {
|
|
2939
|
+
var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest(_a, ["feeInUsd", "chipLabel", "className"]);
|
|
2940
|
+
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 })] })] })));
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
function SettingsButton({ label }) {
|
|
2944
|
+
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 }) }));
|
|
2942
2945
|
}
|
|
2943
2946
|
|
|
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:
|
|
2947
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }) {
|
|
2948
|
+
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, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, onToggleBoostMode: onToggleBoostMode }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
|
|
2946
2949
|
}
|
|
2947
2950
|
|
|
2948
2951
|
function EmojiSadIcon() {
|
|
@@ -2955,16 +2958,16 @@ const detailStateClassMap = {
|
|
|
2955
2958
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
2956
2959
|
full: '',
|
|
2957
2960
|
};
|
|
2958
|
-
function DetailsToolbar({ state = 'full', errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, }) {
|
|
2961
|
+
function DetailsToolbar({ state = 'full', errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, }) {
|
|
2959
2962
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
2960
|
-
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 === '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 === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }) })] })) }));
|
|
2963
|
+
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 === 'error' ? (jsx(ErrorMessage, { message: errorMessage })) : (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: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: canToggleBoostMode, boostDisabledMessage: boostDisabledMessage }) })] })) }));
|
|
2961
2964
|
}
|
|
2962
2965
|
const ErrorMessage = ({ message }) => {
|
|
2963
2966
|
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 })] }));
|
|
2964
2967
|
};
|
|
2965
2968
|
|
|
2966
2969
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
2967
|
-
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 })] }) }));
|
|
2970
|
+
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-cursor-pointer 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 })] }) }));
|
|
2968
2971
|
}
|
|
2969
2972
|
|
|
2970
2973
|
function useModal(props) {
|
|
@@ -3018,7 +3021,7 @@ function RefreshIcon() {
|
|
|
3018
3021
|
|
|
3019
3022
|
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', }) {
|
|
3020
3023
|
const { isModalOpen, modalRef, openModalButtonRef, openModal } = useModal();
|
|
3021
|
-
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, { className: "-tw-left-[85px] tw-top-7", dropdownRef: modalRef, items: [
|
|
3024
|
+
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-cursor-pointer 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, { className: "-tw-left-[85px] tw-top-7", dropdownRef: modalRef, items: [
|
|
3022
3025
|
{
|
|
3023
3026
|
label: 'Repeat swap',
|
|
3024
3027
|
icon: jsx(RefreshIcon, {}),
|
|
@@ -3036,14 +3039,14 @@ function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted,
|
|
|
3036
3039
|
}
|
|
3037
3040
|
|
|
3038
3041
|
const listItemSizeMap = {
|
|
3039
|
-
small: 'tw-max-w-list-item-small tw-h-list-item-small tw-px-squid-xs
|
|
3040
|
-
large: 'tw-max-w-list-item-large tw-h-list-item-large tw-px-squid-xs
|
|
3042
|
+
small: 'tw-max-w-list-item-small tw-h-list-item-small tw-px-squid-xs',
|
|
3043
|
+
large: 'tw-max-w-list-item-large tw-h-list-item-large tw-px-squid-xs',
|
|
3041
3044
|
};
|
|
3042
3045
|
function ListItem(_a) {
|
|
3043
|
-
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className"]);
|
|
3044
|
-
return (
|
|
3045
|
-
|
|
3046
|
-
|
|
3046
|
+
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected"]);
|
|
3047
|
+
return (jsx("li", Object.assign({}, props, { className: cn('tw-flex tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxs("div", { className: cn('tw-flex tw-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: false })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-w-full tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xs',
|
|
3048
|
+
// 'large' variant has extra padding
|
|
3049
|
+
size === 'large' && 'tw-px-squid-xxs'), children: [typeof itemTitle === 'string' ? (jsx(BodyText, { size: "small", className: "tw-truncate !tw-leading-[18px]", children: itemTitle })) : (itemTitle), size === 'large' && subtitle ? (jsx(CaptionText, { className: "tw-h-squid-xs !tw-leading-[10px] tw-text-grey-500", children: subtitle })) : null] }), jsxs("span", { className: "tw-flex tw-max-h-4 tw-items-center", children: [size === 'large' ? (jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })) : null, jsx("span", { className: "min-tw-w-4 min-tw-h-4", children: icon ? icon : null })] })] }) })));
|
|
3047
3050
|
}
|
|
3048
3051
|
|
|
3049
3052
|
function MenuItem({ label, imageUrl, icon }) {
|
|
@@ -3090,7 +3093,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3090
3093
|
}
|
|
3091
3094
|
|
|
3092
3095
|
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
3093
|
-
return (jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsx("ul", { className: "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)))) }) }) }));
|
|
3096
|
+
return (jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsx("ul", { className: "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), item.label))) }) }) }));
|
|
3094
3097
|
}
|
|
3095
3098
|
|
|
3096
3099
|
function Modal({ children }) {
|
|
@@ -3128,7 +3131,10 @@ function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd = '0',
|
|
|
3128
3131
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > 5
|
|
3129
3132
|
? 'tw-text-status-negative'
|
|
3130
3133
|
: 'tw-text-grey-300';
|
|
3131
|
-
|
|
3134
|
+
const isInteractive = direction === 'from';
|
|
3135
|
+
// improve accessibility
|
|
3136
|
+
const BalanceButtonTag = isInteractive ? 'button' : 'div';
|
|
3137
|
+
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("button", { onClick: onWalletButtonClick, 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' }), address ? (jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" })) : null, jsx(WalletAddress, { ens: address })] }) }), jsx("div", { className: "tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, 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 }) }), direction === 'from' ? (jsx("div", { className: "tw-px-squid-m tw-pb-[15px] tw-pt-[5px]", children: jsx("input", { className: "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-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", placeholder: "0", value: amount, onChange: onAmountChange }) })) : (jsx("div", { className: "tw-w-full tw-px-squid-m tw-pb-[15px] tw-pt-[5px]", 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: 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: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isInteractive && 'hover:tw-bg-material-light-thin'), children: [jsx(SwapInputsIcon, {}), jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxs(BalanceButtonTag, { className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isInteractive && 'hover:tw-bg-material-light-thin'), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balance }), jsx(MaxIcon, {})] })] }))] }));
|
|
3132
3138
|
}
|
|
3133
3139
|
|
|
3134
3140
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { BoostMode } from '../../types/components';
|
|
2
2
|
interface BoostButtonProps {
|
|
3
3
|
boostMode: BoostMode;
|
|
4
|
+
canToggleBoostMode?: boolean;
|
|
4
5
|
onToggleBoostMode?: ({ boostMode }: {
|
|
5
6
|
boostMode: BoostMode;
|
|
6
7
|
}) => void;
|
|
8
|
+
boostDisabledMessage?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare function BoostButton({ boostMode, onToggleBoostMode, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function BoostButton({ boostMode: _boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface FeeButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
feeInUsd?: string;
|
|
4
|
+
chipLabel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function FeeButton({ feeInUsd, chipLabel, className, ...props }: FeeButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -4,6 +4,9 @@ interface BoostProps {
|
|
|
4
4
|
onToggleBoostMode?: ({ boostMode }: {
|
|
5
5
|
boostMode: BoostMode;
|
|
6
6
|
}) => void;
|
|
7
|
+
estimatedTime: string;
|
|
8
|
+
boostDisabledMessage?: string;
|
|
9
|
+
canToggleBoostMode?: boolean;
|
|
7
10
|
}
|
|
8
|
-
export declare function Boost({ boostMode, onToggleBoostMode }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -7,6 +7,11 @@ interface DetailsToolbarProps {
|
|
|
7
7
|
boostMode: BoostMode;
|
|
8
8
|
}) => void;
|
|
9
9
|
onInvertSwapButtonClick?: () => void;
|
|
10
|
+
onFeeButtonClick?: () => void;
|
|
11
|
+
feeInUsd?: string;
|
|
12
|
+
estimatedTime?: string;
|
|
13
|
+
canToggleBoostMode?: boolean;
|
|
14
|
+
boostDisabledMessage?: string;
|
|
10
15
|
}
|
|
11
|
-
export declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
12
17
|
export {};
|
|
@@ -8,8 +8,9 @@ interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
|
8
8
|
icon?: React.ReactNode;
|
|
9
9
|
size?: ListItemSize;
|
|
10
10
|
mainIcon?: React.ReactNode;
|
|
11
|
+
isSelected?: boolean;
|
|
11
12
|
className?: string;
|
|
12
13
|
}
|
|
13
14
|
type ListItemSize = 'small' | 'large';
|
|
14
|
-
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size, mainIcon, className, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size, mainIcon, className, isSelected, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -8,7 +8,9 @@ export declare const LargeWithSubtitle: Story;
|
|
|
8
8
|
export declare const LargeWithDetail: Story;
|
|
9
9
|
export declare const LargeWithIcon: Story;
|
|
10
10
|
export declare const LargeWithSecondaryImage: Story;
|
|
11
|
+
export declare const LargeSelected: Story;
|
|
11
12
|
export declare const LargeWithCustomIconAsImage: Story;
|
|
12
13
|
export declare const Small: Story;
|
|
13
14
|
export declare const SmallWithIcon: Story;
|
|
15
|
+
export declare const SmallSelected: Story;
|
|
14
16
|
export declare const SmallWithCustomIconAsImage: Story;
|
package/dist/index.css
CHANGED
|
@@ -746,11 +746,6 @@ video {
|
|
|
746
746
|
margin-right: auto;
|
|
747
747
|
}
|
|
748
748
|
|
|
749
|
-
.tw-mx-squid-xs {
|
|
750
|
-
margin-left: 0.625rem;
|
|
751
|
-
margin-right: 0.625rem;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
749
|
.tw-mx-squid-xxs {
|
|
755
750
|
margin-left: 0.3125rem;
|
|
756
751
|
margin-right: 0.3125rem;
|
|
@@ -1028,6 +1023,10 @@ video {
|
|
|
1028
1023
|
min-height: 195px;
|
|
1029
1024
|
}
|
|
1030
1025
|
|
|
1026
|
+
.tw-min-h-\[30px\] {
|
|
1027
|
+
min-height: 30px;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1031
1030
|
.tw-min-h-button {
|
|
1032
1031
|
min-height: 3.75rem;
|
|
1033
1032
|
}
|
|
@@ -1156,6 +1155,10 @@ video {
|
|
|
1156
1155
|
width: 90px;
|
|
1157
1156
|
}
|
|
1158
1157
|
|
|
1158
|
+
.tw-w-\[92px\] {
|
|
1159
|
+
width: 92px;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1159
1162
|
.tw-w-\[94px\] {
|
|
1160
1163
|
width: 94px;
|
|
1161
1164
|
}
|
|
@@ -1182,6 +1185,10 @@ video {
|
|
|
1182
1185
|
width: max-content;
|
|
1183
1186
|
}
|
|
1184
1187
|
|
|
1188
|
+
.tw-w-squid-l {
|
|
1189
|
+
width: 1.875rem;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1185
1192
|
.tw-w-squid-m {
|
|
1186
1193
|
width: 1.25rem;
|
|
1187
1194
|
}
|
|
@@ -1198,8 +1205,8 @@ video {
|
|
|
1198
1205
|
min-width: 24rem;
|
|
1199
1206
|
}
|
|
1200
1207
|
|
|
1201
|
-
.tw-min-w-\[
|
|
1202
|
-
min-width:
|
|
1208
|
+
.tw-min-w-\[30px\] {
|
|
1209
|
+
min-width: 30px;
|
|
1203
1210
|
}
|
|
1204
1211
|
|
|
1205
1212
|
.tw-min-w-\[60px\] {
|
|
@@ -1446,6 +1453,12 @@ video {
|
|
|
1446
1453
|
overflow-x: hidden;
|
|
1447
1454
|
}
|
|
1448
1455
|
|
|
1456
|
+
.tw-truncate {
|
|
1457
|
+
overflow: hidden;
|
|
1458
|
+
text-overflow: ellipsis;
|
|
1459
|
+
white-space: nowrap;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1449
1462
|
.tw-rounded-2xl {
|
|
1450
1463
|
border-radius: 1rem;
|
|
1451
1464
|
}
|
|
@@ -2053,6 +2066,10 @@ video {
|
|
|
2053
2066
|
line-height: 13px !important;
|
|
2054
2067
|
}
|
|
2055
2068
|
|
|
2069
|
+
.\!tw-leading-\[18px\] {
|
|
2070
|
+
line-height: 18px !important;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2056
2073
|
.\!tw-leading-\[20px\] {
|
|
2057
2074
|
line-height: 20px !important;
|
|
2058
2075
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -62,11 +62,13 @@ type ThemeType = 'light' | 'dark';
|
|
|
62
62
|
|
|
63
63
|
interface BoostButtonProps {
|
|
64
64
|
boostMode: BoostMode;
|
|
65
|
+
canToggleBoostMode?: boolean;
|
|
65
66
|
onToggleBoostMode?: ({ boostMode }: {
|
|
66
67
|
boostMode: BoostMode;
|
|
67
68
|
}) => void;
|
|
69
|
+
boostDisabledMessage?: string;
|
|
68
70
|
}
|
|
69
|
-
declare function BoostButton({ boostMode, onToggleBoostMode, }: BoostButtonProps): react_jsx_runtime.JSX.Element;
|
|
71
|
+
declare function BoostButton({ boostMode: _boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, }: BoostButtonProps): react_jsx_runtime.JSX.Element;
|
|
70
72
|
|
|
71
73
|
interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
72
74
|
label?: string;
|
|
@@ -83,7 +85,11 @@ interface ChipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
83
85
|
}
|
|
84
86
|
declare function Chip({ label, icon, ...props }: ChipProps): react_jsx_runtime.JSX.Element;
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
interface FeeButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
89
|
+
feeInUsd?: string;
|
|
90
|
+
chipLabel?: string;
|
|
91
|
+
}
|
|
92
|
+
declare function FeeButton({ feeInUsd, chipLabel, className, ...props }: FeeButtonProps): react_jsx_runtime.JSX.Element;
|
|
87
93
|
|
|
88
94
|
interface SettingsButtonProps {
|
|
89
95
|
label: string;
|
|
@@ -129,8 +135,11 @@ interface BoostProps {
|
|
|
129
135
|
onToggleBoostMode?: ({ boostMode }: {
|
|
130
136
|
boostMode: BoostMode;
|
|
131
137
|
}) => void;
|
|
138
|
+
estimatedTime: string;
|
|
139
|
+
boostDisabledMessage?: string;
|
|
140
|
+
canToggleBoostMode?: boolean;
|
|
132
141
|
}
|
|
133
|
-
declare function Boost({ boostMode, onToggleBoostMode }: BoostProps): react_jsx_runtime.JSX.Element;
|
|
142
|
+
declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }: BoostProps): react_jsx_runtime.JSX.Element;
|
|
134
143
|
|
|
135
144
|
interface DetailsToolbarProps {
|
|
136
145
|
state?: DetailsToolbarState;
|
|
@@ -140,8 +149,13 @@ interface DetailsToolbarProps {
|
|
|
140
149
|
boostMode: BoostMode;
|
|
141
150
|
}) => void;
|
|
142
151
|
onInvertSwapButtonClick?: () => void;
|
|
152
|
+
onFeeButtonClick?: () => void;
|
|
153
|
+
feeInUsd?: string;
|
|
154
|
+
estimatedTime?: string;
|
|
155
|
+
canToggleBoostMode?: boolean;
|
|
156
|
+
boostDisabledMessage?: string;
|
|
143
157
|
}
|
|
144
|
-
declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
158
|
+
declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
145
159
|
|
|
146
160
|
interface DropdownMenuItemProps {
|
|
147
161
|
label: string;
|
|
@@ -173,10 +187,11 @@ interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
|
173
187
|
icon?: React.ReactNode;
|
|
174
188
|
size?: ListItemSize;
|
|
175
189
|
mainIcon?: React.ReactNode;
|
|
190
|
+
isSelected?: boolean;
|
|
176
191
|
className?: string;
|
|
177
192
|
}
|
|
178
193
|
type ListItemSize = 'small' | 'large';
|
|
179
|
-
declare function ListItem({ itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size, mainIcon, className, ...props }: ListItemProps): react_jsx_runtime.JSX.Element;
|
|
194
|
+
declare function ListItem({ itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size, mainIcon, className, isSelected, ...props }: ListItemProps): react_jsx_runtime.JSX.Element;
|
|
180
195
|
|
|
181
196
|
interface MenuItemProps {
|
|
182
197
|
label: string;
|