@0xsquid/ui 0.15.2 → 0.15.4
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 +97 -63
- package/dist/cjs/types/components/layout/SwapStepsCollapsed.d.ts +10 -1
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +3 -10
- package/dist/cjs/types/services/internal/colorService.d.ts +2 -2
- package/dist/cjs/types/stories/lists/ListItem.stories.d.ts +2 -1
- package/dist/cjs/types/stories/lists/SwapStepItem.stories.d.ts +1 -0
- package/dist/cjs/types/stories/views/SwapProgressView.stories.d.ts +2 -0
- package/dist/cjs/types/types/components.d.ts +5 -1
- package/dist/cjs/types/types/config.d.ts +0 -6
- package/dist/esm/index.js +98 -64
- package/dist/esm/types/components/layout/SwapStepsCollapsed.d.ts +10 -1
- package/dist/esm/types/components/views/SwapProgressView.d.ts +3 -10
- package/dist/esm/types/services/internal/colorService.d.ts +2 -2
- package/dist/esm/types/stories/lists/ListItem.stories.d.ts +2 -1
- package/dist/esm/types/stories/lists/SwapStepItem.stories.d.ts +1 -0
- package/dist/esm/types/stories/views/SwapProgressView.stories.d.ts +2 -0
- package/dist/esm/types/types/components.d.ts +5 -1
- package/dist/esm/types/types/config.d.ts +0 -6
- package/dist/index.css +44 -8
- package/dist/index.d.ts +23 -15
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2570,8 +2570,25 @@ const mainImageSizeClassMap = {
|
|
|
2570
2570
|
sm: 'tw-w-8 tw-h-8',
|
|
2571
2571
|
md: 'tw-w-10 tw-h-10',
|
|
2572
2572
|
};
|
|
2573
|
+
const loadingSkeletonClassName = 'tw-bg-grey-500';
|
|
2573
2574
|
function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, rounded = false, }) {
|
|
2574
|
-
|
|
2575
|
+
const [imagesLoadState, setImageLoadState] = React.useState({
|
|
2576
|
+
badgeLoaded: false,
|
|
2577
|
+
mainImageLoaded: false,
|
|
2578
|
+
});
|
|
2579
|
+
const badgeImageClassName = cn('tw-absolute -tw-right-1/3 tw-bottom-0 tw-z-10 tw-m-0 -tw-translate-x-1/3 tw-rounded-md tw-border-[1px] tw-border-grey-800', badgeSizeClassMap[size]);
|
|
2580
|
+
const mainImageClassName = cn('tw-h-full tw-w-full tw-absolute', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs');
|
|
2581
|
+
return imageUrl ? (jsxRuntime.jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [!imagesLoadState.mainImageLoaded && (jsxRuntime.jsx("div", { className: cn(mainImageClassName, loadingSkeletonClassName) })), jsxRuntime.jsx("img", { src: imageUrl, alt: "", onLoad: () => {
|
|
2582
|
+
// update state when image is fully loaded
|
|
2583
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { mainImageLoaded: true })));
|
|
2584
|
+
}, className: cn(mainImageClassName,
|
|
2585
|
+
// hide main image while it is loading, and display it when it is loaded
|
|
2586
|
+
imagesLoadState.mainImageLoaded ? 'tw-block' : 'tw-hidden') }), badgeUrl ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!imagesLoadState.badgeLoaded && (jsxRuntime.jsx("div", { className: cn(badgeImageClassName, loadingSkeletonClassName) })), jsxRuntime.jsx("img", { src: badgeUrl, alt: "", onLoad: () => {
|
|
2587
|
+
// update state when badge image is fully loaded
|
|
2588
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { badgeLoaded: true })));
|
|
2589
|
+
}, className: cn(badgeImageClassName,
|
|
2590
|
+
// hide badge image while it is loading, and display it when it is loaded
|
|
2591
|
+
imagesLoadState.mainImageLoaded ? 'tw-block' : 'tw-hidden') })] })) : null] })) : null;
|
|
2575
2592
|
}
|
|
2576
2593
|
|
|
2577
2594
|
function LoadingSkeleton({ className, height = '20', }) {
|
|
@@ -6748,7 +6765,8 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
6748
6765
|
return 'tw-text-grey-300';
|
|
6749
6766
|
}
|
|
6750
6767
|
}, [status]);
|
|
6751
|
-
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-text-grey-300 tw-transition-colors tw-duration-1000", children: [jsxRuntime.jsxs("a", { href: link, target: "_blank", style: transitionStyle, className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClass), children: [jsxRuntime.jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsxRuntime.jsx(Chip, { style: transitionStyle, className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: chipContent }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map((
|
|
6768
|
+
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-text-grey-300 tw-transition-colors tw-duration-1000", children: [jsxRuntime.jsxs("a", { href: link, target: "_blank", style: transitionStyle, className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClass), children: [jsxRuntime.jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsxRuntime.jsx(Chip, { style: transitionStyle, className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: chipContent }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map((block, index) => {
|
|
6769
|
+
const { type, value } = block;
|
|
6752
6770
|
if (type === 'string') {
|
|
6753
6771
|
return (
|
|
6754
6772
|
// Instead of displaying the string into a single <BodyText />
|
|
@@ -6760,7 +6778,7 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
6760
6778
|
.map((word, i) => (jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
|
|
6761
6779
|
}
|
|
6762
6780
|
else if (type === 'image') {
|
|
6763
|
-
return (jsxRuntime.jsx("img", { src: value, className:
|
|
6781
|
+
return (jsxRuntime.jsx("img", { src: value, className: cn('tw-h-squid-m tw-w-squid-m', block.rounded ? 'tw-rounded-full' : 'tw-rounded-squid-xxs') }, index));
|
|
6764
6782
|
}
|
|
6765
6783
|
return null;
|
|
6766
6784
|
}) })] }), showStepSeparator && (jsxRuntime.jsx("span", { className: cn(separatorClassMap[status]), style: transitionStyle, children: jsxRuntime.jsx(SwapStepSeparator, {}) }))] }));
|
|
@@ -6878,23 +6896,16 @@ function SwapProgressViewHeader({ title, description, }) {
|
|
|
6878
6896
|
return (jsxRuntime.jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsxRuntime.jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsxRuntime.jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
|
|
6879
6897
|
}
|
|
6880
6898
|
|
|
6881
|
-
|
|
6899
|
+
const SwapStepsCollapsed = React.forwardRef((props, ref) => {
|
|
6900
|
+
const { steps, currentStepIndex: _newStepIndex, onOpen, onClose, footerButton, } = props;
|
|
6882
6901
|
const newStepIndex = Math.round(_newStepIndex);
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
setCurrentStepIndex(Math.round(newStepIndex));
|
|
6887
|
-
}, ANIMATION_DURATIONS.CHANGE_SWAP_STEP);
|
|
6888
|
-
return () => {
|
|
6889
|
-
clearTimeout(timeoutId);
|
|
6890
|
-
};
|
|
6891
|
-
}, [newStepIndex]);
|
|
6902
|
+
React.useImperativeHandle(ref, () => ({
|
|
6903
|
+
handleToggleRouteSteps,
|
|
6904
|
+
}));
|
|
6892
6905
|
// handles whether route component is mounted
|
|
6893
6906
|
const [isRouteVisible, setIsRouteVisible] = React.useState(false);
|
|
6894
6907
|
// handles whether route component is animating to show
|
|
6895
6908
|
const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = React.useState(false);
|
|
6896
|
-
steps[currentStepIndex];
|
|
6897
|
-
currentStepIndex === steps.length - 1;
|
|
6898
6909
|
React.useEffect(() => {
|
|
6899
6910
|
// we do not want to unmount the route component if the animation to show route is running
|
|
6900
6911
|
if (isShowRouteAnimationRunning)
|
|
@@ -6907,8 +6918,16 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
|
|
|
6907
6918
|
clearTimeout(timeoutId);
|
|
6908
6919
|
};
|
|
6909
6920
|
}, [isShowRouteAnimationRunning]);
|
|
6921
|
+
const routeStepsListRef = React.useRef(null);
|
|
6910
6922
|
const handleToggleRouteSteps = () => {
|
|
6911
6923
|
if (isRouteVisible) {
|
|
6924
|
+
if (routeStepsListRef.current) {
|
|
6925
|
+
// reset scroll position of route steps list
|
|
6926
|
+
routeStepsListRef.current.scrollTo({
|
|
6927
|
+
top: routeStepsListRef.current.scrollHeight,
|
|
6928
|
+
behavior: 'instant',
|
|
6929
|
+
});
|
|
6930
|
+
}
|
|
6912
6931
|
setIsShowRouteAnimationRunning(false);
|
|
6913
6932
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
6914
6933
|
}
|
|
@@ -6918,33 +6937,35 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
|
|
|
6918
6937
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
6919
6938
|
}
|
|
6920
6939
|
};
|
|
6921
|
-
return (jsxRuntime.jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-[400px] tw-rounded-squid-l", children: jsxRuntime.
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
[
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
: 'tw-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
:
|
|
6936
|
-
? `transform ${ANIMATION_DURATIONS.
|
|
6937
|
-
:
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
:
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6940
|
+
return (jsxRuntime.jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-[400px] tw-rounded-squid-l", children: jsxRuntime.jsx("div", { className: cn('tw-absolute tw-bottom-0 tw-z-10 tw-flex tw-w-full tw-max-w-[400px] tw-flex-col tw-justify-end tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l', isRouteVisible ? 'tw-h-[535px]' : 'tw-h-[60px]'), children: jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col tw-justify-end", children: [!isRouteVisible && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" }), jsxRuntime.jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" })] })), jsxRuntime.jsx("div", { onClick: handleToggleRouteSteps, style: {
|
|
6941
|
+
[CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
6942
|
+
[CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
6943
|
+
}, className: cn('tw-absolute tw-top-0 tw-h-[535px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-backdrop-blur/10 ', isShowRouteAnimationRunning
|
|
6944
|
+
? 'tw-animate-fade-in'
|
|
6945
|
+
: 'tw-animate-fade-out') }), jsxRuntime.jsx("div", { style: {
|
|
6946
|
+
zIndex: 20,
|
|
6947
|
+
display: isRouteVisible ? 'none' : 'block',
|
|
6948
|
+
}, onClick: handleToggleRouteSteps, className: "tw-absolute tw-inset-0 tw-h-[60px] tw-cursor-pointer tw-rounded-squid-l tw-border tw-border-material-light-thin" }), jsxRuntime.jsx("div", { onClick: isShowRouteAnimationRunning ? undefined : handleToggleRouteSteps, style: {
|
|
6949
|
+
[CSS_VARS.COLLAPSE_ROUTE_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
6950
|
+
[CSS_VARS.EXPAND_ROUTE_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
6951
|
+
}, className: cn('tw-relative tw-h-[60px] tw-max-h-[535px] tw-w-full tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
6952
|
+
? 'tw-animate-expand-route'
|
|
6953
|
+
: 'tw-animate-collapse-route'), children: jsxRuntime.jsxs("div", { className: "tw-flex tw-max-h-[535px] tw-grow-0 tw-flex-col tw-gap-squid-xxs tw-pt-[52px]", style: {
|
|
6954
|
+
transition: isShowRouteAnimationRunning
|
|
6955
|
+
? `transform ${ANIMATION_DURATIONS.SHOW_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
6956
|
+
: isRouteVisible
|
|
6957
|
+
? `transform ${ANIMATION_DURATIONS.HIDE_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
6958
|
+
: `transform ${ANIMATION_DURATIONS.CHANGE_SWAP_STEP}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`,
|
|
6959
|
+
transform: isShowRouteAnimationRunning
|
|
6960
|
+
? 'translateY(0)'
|
|
6961
|
+
: `translateY(calc(-100% + 85px + ${(newStepIndex + 1) * 50}px))`,
|
|
6962
|
+
}, children: [jsxRuntime.jsx("div", { className: cn('tw-absolute tw-top-0 tw-z-10 tw-flex tw-h-[52px] tw-w-full tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-transparent tw-p-squid-xs'), children: jsxRuntime.jsx("button", { onClick: handleToggleRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { ref: routeStepsListRef, style: {
|
|
6963
|
+
zIndex: isRouteVisible ? 0 : -10,
|
|
6964
|
+
scrollbarWidth: 'none',
|
|
6965
|
+
}, className: "tw-relative tw-flex tw-max-h-[413px] tw-w-[400px] tw-flex-1 tw-grow-0 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs tw-py-[15px]", children: steps.map((step, index) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks,
|
|
6966
|
+
// show separator for all steps except the first one
|
|
6967
|
+
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? 'pending' : step.status }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-w-full tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsxRuntime.jsx(Button, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full" }) })] }) })] }) }) }));
|
|
6968
|
+
});
|
|
6948
6969
|
|
|
6949
6970
|
function TokenPair({ firstToken, secondToken }) {
|
|
6950
6971
|
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxRuntime.jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsxRuntime.jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsxRuntime.jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsxRuntime.jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsxRuntime.jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsxRuntime.jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsxRuntime.jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxRuntime.jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
|
|
@@ -42245,7 +42266,7 @@ const swapProgressButtonTexts = {
|
|
|
42245
42266
|
[SwapState.PARTIAL_SUCCESS]: 'Cancel',
|
|
42246
42267
|
[SwapState.NEEDS_GAS]: 'Go to Axelarscan',
|
|
42247
42268
|
};
|
|
42248
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
42269
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }) {
|
|
42249
42270
|
const [showSwapInfoSection, setShowSwapInfoSection] = React.useState(true);
|
|
42250
42271
|
const isFirstRenderRef = React.useRef(true);
|
|
42251
42272
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -42281,7 +42302,11 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
42281
42302
|
headerDescription,
|
|
42282
42303
|
};
|
|
42283
42304
|
}, [swapState, fromToken, toToken, toAmount, toChain]);
|
|
42284
|
-
|
|
42305
|
+
const trackTransactionViewRef = React.useRef(null);
|
|
42306
|
+
const handleCollapseRouteSteps = () => { var _a; return (_a = trackTransactionViewRef.current) === null || _a === void 0 ? void 0 : _a.handleToggleRouteSteps(); };
|
|
42307
|
+
return (jsxRuntime.jsxs(Modal, { isOpen: isOpen, onBackdropClick:
|
|
42308
|
+
// close route steps modal when open and backdrop is clicked
|
|
42309
|
+
!showSwapInfoSection ? handleCollapseRouteSteps : handleClose, children: [jsxRuntime.jsxs(ModalContent, { style: {
|
|
42285
42310
|
[CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
42286
42311
|
[CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
42287
42312
|
}, borderType: "outline", className: cn('!tw-max-h-[470px]',
|
|
@@ -42299,9 +42324,10 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
42299
42324
|
}, secondToken: {
|
|
42300
42325
|
bgColor: toToken.bgColor,
|
|
42301
42326
|
imageUrl: toToken.logoUrl,
|
|
42302
|
-
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromAmount })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toAmount })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Button, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
42327
|
+
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromAmount })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toAmount })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsxRuntime.jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsxRuntime.jsx(CaptionText, { children: timer })) : (jsxRuntime.jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsxRuntime.jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: "Cancel", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Button, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
42303
42328
|
}
|
|
42304
|
-
const TrackTransactionView = (
|
|
42329
|
+
const TrackTransactionView = React.forwardRef((props, ref) => {
|
|
42330
|
+
const { swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, footerButton, } = props;
|
|
42305
42331
|
const { currentStepIndex, steps } = React.useMemo(() => {
|
|
42306
42332
|
if (swapState === SwapState.COMPLETED) {
|
|
42307
42333
|
onTxEnd();
|
|
@@ -42340,8 +42366,8 @@ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart,
|
|
|
42340
42366
|
currentStepIndex: 0,
|
|
42341
42367
|
};
|
|
42342
42368
|
}, [swapState, rawSteps]);
|
|
42343
|
-
return rawSteps.length > 0 ? (jsxRuntime.jsx(SwapStepsCollapsed, { steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen })) : null;
|
|
42344
|
-
};
|
|
42369
|
+
return rawSteps.length > 0 ? (jsxRuntime.jsx(SwapStepsCollapsed, { ref: ref, steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen, footerButton: footerButton })) : null;
|
|
42370
|
+
});
|
|
42345
42371
|
const SwapDetailItemValues = ({ fromContent, toContent, }) => {
|
|
42346
42372
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: fromContent })) : (fromContent), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: toContent })) : (toContent)] }));
|
|
42347
42373
|
};
|
|
@@ -42367,15 +42393,11 @@ const lightTheme = {
|
|
|
42367
42393
|
'status-positive': '#11D421',
|
|
42368
42394
|
'status-negative': '#FF5B4D',
|
|
42369
42395
|
'status-warning': '#EC9213',
|
|
42370
|
-
// transparent
|
|
42371
|
-
'transparent-light-thin': '#17191C1A', // 10% opacity
|
|
42372
|
-
'transparent-light-average': '#17191C54', // 33% opacity
|
|
42373
|
-
'transparent-light-thick': '#17191CA8', // 66% opacity
|
|
42374
|
-
'transparent-dark-thin': '#FBFBFD1A', // 10% opacity
|
|
42375
|
-
'transparent-dark-average': '#FBFCFD54', // 33% opacity
|
|
42376
|
-
'transparent-dark-thick': '#FBFCFDA8', // 66% opacity
|
|
42377
42396
|
};
|
|
42378
42397
|
|
|
42398
|
+
// list of the theme variables that need to be replaced
|
|
42399
|
+
// from the user readable theme config
|
|
42400
|
+
// to the internal theme config
|
|
42379
42401
|
const themeKeysToReplace = [
|
|
42380
42402
|
{
|
|
42381
42403
|
userKey: 'content',
|
|
@@ -42385,24 +42407,20 @@ const themeKeysToReplace = [
|
|
|
42385
42407
|
userKey: 'accent',
|
|
42386
42408
|
internalKey: 'royal',
|
|
42387
42409
|
},
|
|
42388
|
-
{
|
|
42389
|
-
userKey: 'transparent',
|
|
42390
|
-
internalKey: 'material',
|
|
42391
|
-
},
|
|
42392
42410
|
{
|
|
42393
42411
|
userKey: 'status-warning',
|
|
42394
42412
|
internalKey: 'status-partial',
|
|
42395
42413
|
},
|
|
42396
42414
|
];
|
|
42397
42415
|
/**
|
|
42398
|
-
*
|
|
42416
|
+
* Parses the user readable config to css variables
|
|
42399
42417
|
* Also maps the public theme variables to the internal theme variables
|
|
42418
|
+
* and adds the material-* variants
|
|
42400
42419
|
* example user theme:
|
|
42401
42420
|
* {
|
|
42402
42421
|
* 'content-100': '#000',
|
|
42403
42422
|
* 'content-200': '#000',
|
|
42404
42423
|
* 'accent-400': '#000',
|
|
42405
|
-
* 'transparent-light-thin': '#000'
|
|
42406
42424
|
* }
|
|
42407
42425
|
* Resulting in:
|
|
42408
42426
|
* {
|
|
@@ -42417,10 +42435,9 @@ const parseSquidTheme = (userTheme) => {
|
|
|
42417
42435
|
var _a;
|
|
42418
42436
|
if (!userTheme)
|
|
42419
42437
|
return undefined;
|
|
42420
|
-
|
|
42438
|
+
let squidTheme = Object.entries(userTheme).reduce((internalKeys, [userKey, userValue]) => {
|
|
42421
42439
|
// content-* -> grey-*
|
|
42422
42440
|
// accent-* -> royal-*
|
|
42423
|
-
// transparent-* -> material-*
|
|
42424
42441
|
const keyToReplace = themeKeysToReplace.find((k) => userKey.includes(k.userKey));
|
|
42425
42442
|
if (keyToReplace) {
|
|
42426
42443
|
const newKey = userKey.replace(keyToReplace.userKey, keyToReplace.internalKey);
|
|
@@ -42431,6 +42448,23 @@ const parseSquidTheme = (userTheme) => {
|
|
|
42431
42448
|
}
|
|
42432
42449
|
return internalKeys;
|
|
42433
42450
|
}, {});
|
|
42451
|
+
// add material-{light,dark}-{thin,average,thick} colors to the squid theme object
|
|
42452
|
+
// using the following formula:
|
|
42453
|
+
// material-light-thin -> grey-100 + 10% opacity
|
|
42454
|
+
// material-light-average -> grey-100 + 33% opacity
|
|
42455
|
+
// material-light-thick -> grey-100 + 66% opacity
|
|
42456
|
+
// material-dark-thin -> grey-900 + 10% opacity
|
|
42457
|
+
// material-dark-average -> grey-900 + 33% opacity
|
|
42458
|
+
// material-dark-thick -> grey-900 + 66% opacity
|
|
42459
|
+
const materialVariants = {
|
|
42460
|
+
'material-light-thin': getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.1),
|
|
42461
|
+
'material-light-average': getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.33),
|
|
42462
|
+
'material-light-thick': getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.66),
|
|
42463
|
+
'material-dark-thin': getHexColorFromOpacityPercentage(squidTheme['grey-900'], 0.1),
|
|
42464
|
+
'material-dark-average': getHexColorFromOpacityPercentage(squidTheme['grey-900'], 0.33),
|
|
42465
|
+
'material-dark-thick': getHexColorFromOpacityPercentage(squidTheme['grey-900'], 0.66),
|
|
42466
|
+
};
|
|
42467
|
+
squidTheme = Object.assign(Object.assign({}, squidTheme), materialVariants);
|
|
42434
42468
|
const styleKeys = Object.keys(themeTypesKeys);
|
|
42435
42469
|
const parsed = styleKeys.map((sk) => {
|
|
42436
42470
|
const themeItem = themeTypesKeys[sk];
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SwapStep } from '../../types/components';
|
|
3
|
+
export type SwapStepsCollapsedFooterButton = {
|
|
4
|
+
label: string;
|
|
5
|
+
link?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
};
|
|
2
8
|
interface SwapStepsCollapsedProps {
|
|
3
9
|
steps: SwapStep[];
|
|
4
10
|
currentStepIndex: number;
|
|
5
11
|
onOpen?: () => void;
|
|
6
12
|
onClose?: () => void;
|
|
13
|
+
footerButton?: SwapStepsCollapsedFooterButton;
|
|
7
14
|
}
|
|
8
|
-
export declare
|
|
15
|
+
export declare const SwapStepsCollapsed: import("react").ForwardRefExoticComponent<SwapStepsCollapsedProps & import("react").RefAttributes<{
|
|
16
|
+
handleToggleRouteSteps: () => void;
|
|
17
|
+
}>>;
|
|
9
18
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SwapState, SwapStep } from '../../types/components';
|
|
2
|
+
import { SwapStepsCollapsedFooterButton } from '../layout/SwapStepsCollapsed';
|
|
2
3
|
type ChainData = {
|
|
3
4
|
networkName: string;
|
|
4
5
|
logoUrl: string;
|
|
@@ -9,7 +10,7 @@ type Token = {
|
|
|
9
10
|
logoUrl: string;
|
|
10
11
|
bgColor: string;
|
|
11
12
|
};
|
|
12
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
13
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
13
14
|
steps: SwapStep[];
|
|
14
15
|
handleClose?: () => void;
|
|
15
16
|
handleComplete?: () => void;
|
|
@@ -26,14 +27,6 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, handleCom
|
|
|
26
27
|
toAddressFormatted: string;
|
|
27
28
|
swapState: SwapState;
|
|
28
29
|
estimatedTimeToComplete?: string;
|
|
30
|
+
footerButton?: SwapStepsCollapsedFooterButton;
|
|
29
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
interface Props {
|
|
31
|
-
rawSteps: SwapStep[];
|
|
32
|
-
swapState?: SwapState;
|
|
33
|
-
onOpen?: () => void;
|
|
34
|
-
onClose?: () => void;
|
|
35
|
-
onTxStart: () => void;
|
|
36
|
-
onTxEnd: () => void;
|
|
37
|
-
}
|
|
38
|
-
export declare const TrackTransactionView: ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
39
32
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SquidTheme } from '../../types/config';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Parses the user readable config to css variables
|
|
4
4
|
* Also maps the public theme variables to the internal theme variables
|
|
5
|
+
* and adds the material-* variants
|
|
5
6
|
* example user theme:
|
|
6
7
|
* {
|
|
7
8
|
* 'content-100': '#000',
|
|
8
9
|
* 'content-200': '#000',
|
|
9
10
|
* 'accent-400': '#000',
|
|
10
|
-
* 'transparent-light-thin': '#000'
|
|
11
11
|
* }
|
|
12
12
|
* Resulting in:
|
|
13
13
|
* {
|
|
@@ -16,7 +16,8 @@ export declare const LargeShowDetailOnHoverOnly: Story;
|
|
|
16
16
|
export declare const LargeWithSecondaryImage: Story;
|
|
17
17
|
export declare const LargeSelected: Story;
|
|
18
18
|
export declare const LargeWithCustomIconAsImage: Story;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const SubtitleLoading: Story;
|
|
20
|
+
export declare const ImageAndBadgeLoading: Story;
|
|
20
21
|
export declare const Small: Story;
|
|
21
22
|
export declare const SmallInteractive: Story;
|
|
22
23
|
export declare const SmallWithLongTitle: Story;
|
|
@@ -18,6 +18,7 @@ export declare const ErrorWithSeparator: Story;
|
|
|
18
18
|
export declare const Warning: Story;
|
|
19
19
|
export declare const WarningWithSeparator: Story;
|
|
20
20
|
export declare const CustomDescription: Story;
|
|
21
|
+
export declare const CustomDescriptionWithRoundedImage: Story;
|
|
21
22
|
export declare const CustomDescriptionWithSeparator: Story;
|
|
22
23
|
export declare const Link: Story;
|
|
23
24
|
export declare const LongDescription: Story;
|
|
@@ -4,6 +4,8 @@ declare const meta: Meta<typeof SwapProgressView>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const WithControls: Story;
|
|
7
|
+
export declare const ShortRoute: Story;
|
|
8
|
+
export declare const LongRoute: Story;
|
|
7
9
|
export declare const Completed: Story;
|
|
8
10
|
export declare const Error: Story;
|
|
9
11
|
export declare const Confirm: Story;
|
|
@@ -5,8 +5,12 @@ export type ButtonSize = 'md' | 'lg';
|
|
|
5
5
|
export type SwapDirection = 'from' | 'to';
|
|
6
6
|
export type BoostMode = 'normal' | 'boost';
|
|
7
7
|
export type SwapStepDescriptionBlock = {
|
|
8
|
-
type: 'string'
|
|
8
|
+
type: 'string';
|
|
9
9
|
value: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'image';
|
|
12
|
+
value: string;
|
|
13
|
+
rounded?: boolean;
|
|
10
14
|
};
|
|
11
15
|
export type SwapStep = {
|
|
12
16
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
@@ -41,12 +41,6 @@ export type SquidTheme = {
|
|
|
41
41
|
'status-positive': string;
|
|
42
42
|
'status-negative': string;
|
|
43
43
|
'status-warning': string;
|
|
44
|
-
'transparent-light-thin': string;
|
|
45
|
-
'transparent-light-average': string;
|
|
46
|
-
'transparent-light-thick': string;
|
|
47
|
-
'transparent-dark-thin': string;
|
|
48
|
-
'transparent-dark-average': string;
|
|
49
|
-
'transparent-dark-thick': string;
|
|
50
44
|
};
|
|
51
45
|
export declare const SQUID_THEME_CSS_VARIABLE_PREFIX = "--squid-theme-";
|
|
52
46
|
/**
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useMemo, useRef,
|
|
3
|
+
import { useState, useMemo, useRef, useEffect, useCallback, forwardRef, useImperativeHandle } from 'react';
|
|
4
4
|
|
|
5
5
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
6
6
|
|
|
@@ -2550,8 +2550,25 @@ const mainImageSizeClassMap = {
|
|
|
2550
2550
|
sm: 'tw-w-8 tw-h-8',
|
|
2551
2551
|
md: 'tw-w-10 tw-h-10',
|
|
2552
2552
|
};
|
|
2553
|
+
const loadingSkeletonClassName = 'tw-bg-grey-500';
|
|
2553
2554
|
function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, rounded = false, }) {
|
|
2554
|
-
|
|
2555
|
+
const [imagesLoadState, setImageLoadState] = useState({
|
|
2556
|
+
badgeLoaded: false,
|
|
2557
|
+
mainImageLoaded: false,
|
|
2558
|
+
});
|
|
2559
|
+
const badgeImageClassName = cn('tw-absolute -tw-right-1/3 tw-bottom-0 tw-z-10 tw-m-0 -tw-translate-x-1/3 tw-rounded-md tw-border-[1px] tw-border-grey-800', badgeSizeClassMap[size]);
|
|
2560
|
+
const mainImageClassName = cn('tw-h-full tw-w-full tw-absolute', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs');
|
|
2561
|
+
return imageUrl ? (jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [!imagesLoadState.mainImageLoaded && (jsx("div", { className: cn(mainImageClassName, loadingSkeletonClassName) })), jsx("img", { src: imageUrl, alt: "", onLoad: () => {
|
|
2562
|
+
// update state when image is fully loaded
|
|
2563
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { mainImageLoaded: true })));
|
|
2564
|
+
}, className: cn(mainImageClassName,
|
|
2565
|
+
// hide main image while it is loading, and display it when it is loaded
|
|
2566
|
+
imagesLoadState.mainImageLoaded ? 'tw-block' : 'tw-hidden') }), badgeUrl ? (jsxs(Fragment, { children: [!imagesLoadState.badgeLoaded && (jsx("div", { className: cn(badgeImageClassName, loadingSkeletonClassName) })), jsx("img", { src: badgeUrl, alt: "", onLoad: () => {
|
|
2567
|
+
// update state when badge image is fully loaded
|
|
2568
|
+
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { badgeLoaded: true })));
|
|
2569
|
+
}, className: cn(badgeImageClassName,
|
|
2570
|
+
// hide badge image while it is loading, and display it when it is loaded
|
|
2571
|
+
imagesLoadState.mainImageLoaded ? 'tw-block' : 'tw-hidden') })] })) : null] })) : null;
|
|
2555
2572
|
}
|
|
2556
2573
|
|
|
2557
2574
|
function LoadingSkeleton({ className, height = '20', }) {
|
|
@@ -6728,7 +6745,8 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
6728
6745
|
return 'tw-text-grey-300';
|
|
6729
6746
|
}
|
|
6730
6747
|
}, [status]);
|
|
6731
|
-
return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-text-grey-300 tw-transition-colors tw-duration-1000", children: [jsxs("a", { href: link, target: "_blank", style: transitionStyle, className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClass), children: [jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsx(Chip, { style: transitionStyle, className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: chipContent }) }), jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map((
|
|
6748
|
+
return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-text-grey-300 tw-transition-colors tw-duration-1000", children: [jsxs("a", { href: link, target: "_blank", style: transitionStyle, className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClass), children: [jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsx(Chip, { style: transitionStyle, className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: chipContent }) }), jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map((block, index) => {
|
|
6749
|
+
const { type, value } = block;
|
|
6732
6750
|
if (type === 'string') {
|
|
6733
6751
|
return (
|
|
6734
6752
|
// Instead of displaying the string into a single <BodyText />
|
|
@@ -6740,7 +6758,7 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
6740
6758
|
.map((word, i) => (jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
|
|
6741
6759
|
}
|
|
6742
6760
|
else if (type === 'image') {
|
|
6743
|
-
return (jsx("img", { src: value, className:
|
|
6761
|
+
return (jsx("img", { src: value, className: cn('tw-h-squid-m tw-w-squid-m', block.rounded ? 'tw-rounded-full' : 'tw-rounded-squid-xxs') }, index));
|
|
6744
6762
|
}
|
|
6745
6763
|
return null;
|
|
6746
6764
|
}) })] }), showStepSeparator && (jsx("span", { className: cn(separatorClassMap[status]), style: transitionStyle, children: jsx(SwapStepSeparator, {}) }))] }));
|
|
@@ -6858,23 +6876,16 @@ function SwapProgressViewHeader({ title, description, }) {
|
|
|
6858
6876
|
return (jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
|
|
6859
6877
|
}
|
|
6860
6878
|
|
|
6861
|
-
|
|
6879
|
+
const SwapStepsCollapsed = forwardRef((props, ref) => {
|
|
6880
|
+
const { steps, currentStepIndex: _newStepIndex, onOpen, onClose, footerButton, } = props;
|
|
6862
6881
|
const newStepIndex = Math.round(_newStepIndex);
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
setCurrentStepIndex(Math.round(newStepIndex));
|
|
6867
|
-
}, ANIMATION_DURATIONS.CHANGE_SWAP_STEP);
|
|
6868
|
-
return () => {
|
|
6869
|
-
clearTimeout(timeoutId);
|
|
6870
|
-
};
|
|
6871
|
-
}, [newStepIndex]);
|
|
6882
|
+
useImperativeHandle(ref, () => ({
|
|
6883
|
+
handleToggleRouteSteps,
|
|
6884
|
+
}));
|
|
6872
6885
|
// handles whether route component is mounted
|
|
6873
6886
|
const [isRouteVisible, setIsRouteVisible] = useState(false);
|
|
6874
6887
|
// handles whether route component is animating to show
|
|
6875
6888
|
const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = useState(false);
|
|
6876
|
-
steps[currentStepIndex];
|
|
6877
|
-
currentStepIndex === steps.length - 1;
|
|
6878
6889
|
useEffect(() => {
|
|
6879
6890
|
// we do not want to unmount the route component if the animation to show route is running
|
|
6880
6891
|
if (isShowRouteAnimationRunning)
|
|
@@ -6887,8 +6898,16 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
|
|
|
6887
6898
|
clearTimeout(timeoutId);
|
|
6888
6899
|
};
|
|
6889
6900
|
}, [isShowRouteAnimationRunning]);
|
|
6901
|
+
const routeStepsListRef = useRef(null);
|
|
6890
6902
|
const handleToggleRouteSteps = () => {
|
|
6891
6903
|
if (isRouteVisible) {
|
|
6904
|
+
if (routeStepsListRef.current) {
|
|
6905
|
+
// reset scroll position of route steps list
|
|
6906
|
+
routeStepsListRef.current.scrollTo({
|
|
6907
|
+
top: routeStepsListRef.current.scrollHeight,
|
|
6908
|
+
behavior: 'instant',
|
|
6909
|
+
});
|
|
6910
|
+
}
|
|
6892
6911
|
setIsShowRouteAnimationRunning(false);
|
|
6893
6912
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
6894
6913
|
}
|
|
@@ -6898,33 +6917,35 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
|
|
|
6898
6917
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
6899
6918
|
}
|
|
6900
6919
|
};
|
|
6901
|
-
return (jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-[400px] tw-rounded-squid-l", children:
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
[
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
: 'tw-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
:
|
|
6916
|
-
? `transform ${ANIMATION_DURATIONS.
|
|
6917
|
-
:
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
:
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6920
|
+
return (jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-[400px] tw-rounded-squid-l", children: jsx("div", { className: cn('tw-absolute tw-bottom-0 tw-z-10 tw-flex tw-w-full tw-max-w-[400px] tw-flex-col tw-justify-end tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l', isRouteVisible ? 'tw-h-[535px]' : 'tw-h-[60px]'), children: jsxs("div", { className: "tw-flex tw-flex-col tw-justify-end", children: [!isRouteVisible && (jsxs(Fragment, { children: [jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" }), jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" })] })), jsx("div", { onClick: handleToggleRouteSteps, style: {
|
|
6921
|
+
[CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
6922
|
+
[CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
6923
|
+
}, className: cn('tw-absolute tw-top-0 tw-h-[535px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-backdrop-blur/10 ', isShowRouteAnimationRunning
|
|
6924
|
+
? 'tw-animate-fade-in'
|
|
6925
|
+
: 'tw-animate-fade-out') }), jsx("div", { style: {
|
|
6926
|
+
zIndex: 20,
|
|
6927
|
+
display: isRouteVisible ? 'none' : 'block',
|
|
6928
|
+
}, onClick: handleToggleRouteSteps, className: "tw-absolute tw-inset-0 tw-h-[60px] tw-cursor-pointer tw-rounded-squid-l tw-border tw-border-material-light-thin" }), jsx("div", { onClick: isShowRouteAnimationRunning ? undefined : handleToggleRouteSteps, style: {
|
|
6929
|
+
[CSS_VARS.COLLAPSE_ROUTE_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
6930
|
+
[CSS_VARS.EXPAND_ROUTE_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
6931
|
+
}, className: cn('tw-relative tw-h-[60px] tw-max-h-[535px] tw-w-full tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
6932
|
+
? 'tw-animate-expand-route'
|
|
6933
|
+
: 'tw-animate-collapse-route'), children: jsxs("div", { className: "tw-flex tw-max-h-[535px] tw-grow-0 tw-flex-col tw-gap-squid-xxs tw-pt-[52px]", style: {
|
|
6934
|
+
transition: isShowRouteAnimationRunning
|
|
6935
|
+
? `transform ${ANIMATION_DURATIONS.SHOW_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
6936
|
+
: isRouteVisible
|
|
6937
|
+
? `transform ${ANIMATION_DURATIONS.HIDE_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
6938
|
+
: `transform ${ANIMATION_DURATIONS.CHANGE_SWAP_STEP}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`,
|
|
6939
|
+
transform: isShowRouteAnimationRunning
|
|
6940
|
+
? 'translateY(0)'
|
|
6941
|
+
: `translateY(calc(-100% + 85px + ${(newStepIndex + 1) * 50}px))`,
|
|
6942
|
+
}, children: [jsx("div", { className: cn('tw-absolute tw-top-0 tw-z-10 tw-flex tw-h-[52px] tw-w-full tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-transparent tw-p-squid-xs'), children: jsx("button", { onClick: handleToggleRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { ref: routeStepsListRef, style: {
|
|
6943
|
+
zIndex: isRouteVisible ? 0 : -10,
|
|
6944
|
+
scrollbarWidth: 'none',
|
|
6945
|
+
}, className: "tw-relative tw-flex tw-max-h-[413px] tw-w-[400px] tw-flex-1 tw-grow-0 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs tw-py-[15px]", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks,
|
|
6946
|
+
// show separator for all steps except the first one
|
|
6947
|
+
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? 'pending' : step.status }, index))) }), jsx("footer", { className: "tw-flex tw-w-full tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsx(Button, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full" }) })] }) })] }) }) }));
|
|
6948
|
+
});
|
|
6928
6949
|
|
|
6929
6950
|
function TokenPair({ firstToken, secondToken }) {
|
|
6930
6951
|
return (jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsx("defs", { children: jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
|
|
@@ -42225,7 +42246,7 @@ const swapProgressButtonTexts = {
|
|
|
42225
42246
|
[SwapState.PARTIAL_SUCCESS]: 'Cancel',
|
|
42226
42247
|
[SwapState.NEEDS_GAS]: 'Go to Axelarscan',
|
|
42227
42248
|
};
|
|
42228
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
42249
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }) {
|
|
42229
42250
|
const [showSwapInfoSection, setShowSwapInfoSection] = useState(true);
|
|
42230
42251
|
const isFirstRenderRef = useRef(true);
|
|
42231
42252
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -42261,7 +42282,11 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
42261
42282
|
headerDescription,
|
|
42262
42283
|
};
|
|
42263
42284
|
}, [swapState, fromToken, toToken, toAmount, toChain]);
|
|
42264
|
-
|
|
42285
|
+
const trackTransactionViewRef = useRef(null);
|
|
42286
|
+
const handleCollapseRouteSteps = () => { var _a; return (_a = trackTransactionViewRef.current) === null || _a === void 0 ? void 0 : _a.handleToggleRouteSteps(); };
|
|
42287
|
+
return (jsxs(Modal, { isOpen: isOpen, onBackdropClick:
|
|
42288
|
+
// close route steps modal when open and backdrop is clicked
|
|
42289
|
+
!showSwapInfoSection ? handleCollapseRouteSteps : handleClose, children: [jsxs(ModalContent, { style: {
|
|
42265
42290
|
[CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
42266
42291
|
[CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
42267
42292
|
}, borderType: "outline", className: cn('!tw-max-h-[470px]',
|
|
@@ -42279,9 +42304,10 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
42279
42304
|
}, secondToken: {
|
|
42280
42305
|
bgColor: toToken.bgColor,
|
|
42281
42306
|
imageUrl: toToken.logoUrl,
|
|
42282
|
-
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(SwapDetailListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsx(CaptionText, { children: fromAmount })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsx(CaptionText, { children: toAmount })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsx(SwapDetailListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), swapState === SwapState.PARTIAL_SUCCESS ? (jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsx(Button, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsx(Button, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
42307
|
+
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(SwapDetailListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsx(CaptionText, { children: fromAmount })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsx(CaptionText, { children: toAmount })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsx(SwapDetailListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: swapState === SwapState.PROGRESS ? (jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete })) : swapState === SwapState.COMPLETED ? (jsx(CaptionText, { children: timer })) : (jsx(CaptionText, { children: estimatedTimeToComplete })) })] })] }), jsx(TrackTransactionView, { ref: trackTransactionViewRef, onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState, footerButton: footerButton }), !showSwapInfoSection ? (jsx(Button, { size: "lg", variant: "primary", label: "Cancel", onClick: handleCollapseRouteSteps, className: "tw-min-h-button" })) : swapState === SwapState.PARTIAL_SUCCESS ? (jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-gap-squid-xxs", children: [jsx(Button, { size: "lg", variant: "secondary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }), jsx(Button, { size: "lg", variant: "primary", label: "Complete", onClick: handleComplete, className: "tw-min-h-button" })] })) : (jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" }))] }));
|
|
42283
42308
|
}
|
|
42284
|
-
const TrackTransactionView = (
|
|
42309
|
+
const TrackTransactionView = forwardRef((props, ref) => {
|
|
42310
|
+
const { swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, footerButton, } = props;
|
|
42285
42311
|
const { currentStepIndex, steps } = useMemo(() => {
|
|
42286
42312
|
if (swapState === SwapState.COMPLETED) {
|
|
42287
42313
|
onTxEnd();
|
|
@@ -42320,8 +42346,8 @@ const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart,
|
|
|
42320
42346
|
currentStepIndex: 0,
|
|
42321
42347
|
};
|
|
42322
42348
|
}, [swapState, rawSteps]);
|
|
42323
|
-
return rawSteps.length > 0 ? (jsx(SwapStepsCollapsed, { steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen })) : null;
|
|
42324
|
-
};
|
|
42349
|
+
return rawSteps.length > 0 ? (jsx(SwapStepsCollapsed, { ref: ref, steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen, footerButton: footerButton })) : null;
|
|
42350
|
+
});
|
|
42325
42351
|
const SwapDetailItemValues = ({ fromContent, toContent, }) => {
|
|
42326
42352
|
return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsx(CaptionText, { children: fromContent })) : (fromContent), jsx("span", { className: "tw-text-grey-500", children: jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsx(CaptionText, { children: toContent })) : (toContent)] }));
|
|
42327
42353
|
};
|
|
@@ -42347,15 +42373,11 @@ const lightTheme = {
|
|
|
42347
42373
|
'status-positive': '#11D421',
|
|
42348
42374
|
'status-negative': '#FF5B4D',
|
|
42349
42375
|
'status-warning': '#EC9213',
|
|
42350
|
-
// transparent
|
|
42351
|
-
'transparent-light-thin': '#17191C1A', // 10% opacity
|
|
42352
|
-
'transparent-light-average': '#17191C54', // 33% opacity
|
|
42353
|
-
'transparent-light-thick': '#17191CA8', // 66% opacity
|
|
42354
|
-
'transparent-dark-thin': '#FBFBFD1A', // 10% opacity
|
|
42355
|
-
'transparent-dark-average': '#FBFCFD54', // 33% opacity
|
|
42356
|
-
'transparent-dark-thick': '#FBFCFDA8', // 66% opacity
|
|
42357
42376
|
};
|
|
42358
42377
|
|
|
42378
|
+
// list of the theme variables that need to be replaced
|
|
42379
|
+
// from the user readable theme config
|
|
42380
|
+
// to the internal theme config
|
|
42359
42381
|
const themeKeysToReplace = [
|
|
42360
42382
|
{
|
|
42361
42383
|
userKey: 'content',
|
|
@@ -42365,24 +42387,20 @@ const themeKeysToReplace = [
|
|
|
42365
42387
|
userKey: 'accent',
|
|
42366
42388
|
internalKey: 'royal',
|
|
42367
42389
|
},
|
|
42368
|
-
{
|
|
42369
|
-
userKey: 'transparent',
|
|
42370
|
-
internalKey: 'material',
|
|
42371
|
-
},
|
|
42372
42390
|
{
|
|
42373
42391
|
userKey: 'status-warning',
|
|
42374
42392
|
internalKey: 'status-partial',
|
|
42375
42393
|
},
|
|
42376
42394
|
];
|
|
42377
42395
|
/**
|
|
42378
|
-
*
|
|
42396
|
+
* Parses the user readable config to css variables
|
|
42379
42397
|
* Also maps the public theme variables to the internal theme variables
|
|
42398
|
+
* and adds the material-* variants
|
|
42380
42399
|
* example user theme:
|
|
42381
42400
|
* {
|
|
42382
42401
|
* 'content-100': '#000',
|
|
42383
42402
|
* 'content-200': '#000',
|
|
42384
42403
|
* 'accent-400': '#000',
|
|
42385
|
-
* 'transparent-light-thin': '#000'
|
|
42386
42404
|
* }
|
|
42387
42405
|
* Resulting in:
|
|
42388
42406
|
* {
|
|
@@ -42397,10 +42415,9 @@ const parseSquidTheme = (userTheme) => {
|
|
|
42397
42415
|
var _a;
|
|
42398
42416
|
if (!userTheme)
|
|
42399
42417
|
return undefined;
|
|
42400
|
-
|
|
42418
|
+
let squidTheme = Object.entries(userTheme).reduce((internalKeys, [userKey, userValue]) => {
|
|
42401
42419
|
// content-* -> grey-*
|
|
42402
42420
|
// accent-* -> royal-*
|
|
42403
|
-
// transparent-* -> material-*
|
|
42404
42421
|
const keyToReplace = themeKeysToReplace.find((k) => userKey.includes(k.userKey));
|
|
42405
42422
|
if (keyToReplace) {
|
|
42406
42423
|
const newKey = userKey.replace(keyToReplace.userKey, keyToReplace.internalKey);
|
|
@@ -42411,6 +42428,23 @@ const parseSquidTheme = (userTheme) => {
|
|
|
42411
42428
|
}
|
|
42412
42429
|
return internalKeys;
|
|
42413
42430
|
}, {});
|
|
42431
|
+
// add material-{light,dark}-{thin,average,thick} colors to the squid theme object
|
|
42432
|
+
// using the following formula:
|
|
42433
|
+
// material-light-thin -> grey-100 + 10% opacity
|
|
42434
|
+
// material-light-average -> grey-100 + 33% opacity
|
|
42435
|
+
// material-light-thick -> grey-100 + 66% opacity
|
|
42436
|
+
// material-dark-thin -> grey-900 + 10% opacity
|
|
42437
|
+
// material-dark-average -> grey-900 + 33% opacity
|
|
42438
|
+
// material-dark-thick -> grey-900 + 66% opacity
|
|
42439
|
+
const materialVariants = {
|
|
42440
|
+
'material-light-thin': getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.1),
|
|
42441
|
+
'material-light-average': getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.33),
|
|
42442
|
+
'material-light-thick': getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.66),
|
|
42443
|
+
'material-dark-thin': getHexColorFromOpacityPercentage(squidTheme['grey-900'], 0.1),
|
|
42444
|
+
'material-dark-average': getHexColorFromOpacityPercentage(squidTheme['grey-900'], 0.33),
|
|
42445
|
+
'material-dark-thick': getHexColorFromOpacityPercentage(squidTheme['grey-900'], 0.66),
|
|
42446
|
+
};
|
|
42447
|
+
squidTheme = Object.assign(Object.assign({}, squidTheme), materialVariants);
|
|
42414
42448
|
const styleKeys = Object.keys(themeTypesKeys);
|
|
42415
42449
|
const parsed = styleKeys.map((sk) => {
|
|
42416
42450
|
const themeItem = themeTypesKeys[sk];
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SwapStep } from '../../types/components';
|
|
3
|
+
export type SwapStepsCollapsedFooterButton = {
|
|
4
|
+
label: string;
|
|
5
|
+
link?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
};
|
|
2
8
|
interface SwapStepsCollapsedProps {
|
|
3
9
|
steps: SwapStep[];
|
|
4
10
|
currentStepIndex: number;
|
|
5
11
|
onOpen?: () => void;
|
|
6
12
|
onClose?: () => void;
|
|
13
|
+
footerButton?: SwapStepsCollapsedFooterButton;
|
|
7
14
|
}
|
|
8
|
-
export declare
|
|
15
|
+
export declare const SwapStepsCollapsed: import("react").ForwardRefExoticComponent<SwapStepsCollapsedProps & import("react").RefAttributes<{
|
|
16
|
+
handleToggleRouteSteps: () => void;
|
|
17
|
+
}>>;
|
|
9
18
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SwapState, SwapStep } from '../../types/components';
|
|
2
|
+
import { SwapStepsCollapsedFooterButton } from '../layout/SwapStepsCollapsed';
|
|
2
3
|
type ChainData = {
|
|
3
4
|
networkName: string;
|
|
4
5
|
logoUrl: string;
|
|
@@ -9,7 +10,7 @@ type Token = {
|
|
|
9
10
|
logoUrl: string;
|
|
10
11
|
bgColor: string;
|
|
11
12
|
};
|
|
12
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
13
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
13
14
|
steps: SwapStep[];
|
|
14
15
|
handleClose?: () => void;
|
|
15
16
|
handleComplete?: () => void;
|
|
@@ -26,14 +27,6 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, handleCom
|
|
|
26
27
|
toAddressFormatted: string;
|
|
27
28
|
swapState: SwapState;
|
|
28
29
|
estimatedTimeToComplete?: string;
|
|
30
|
+
footerButton?: SwapStepsCollapsedFooterButton;
|
|
29
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
interface Props {
|
|
31
|
-
rawSteps: SwapStep[];
|
|
32
|
-
swapState?: SwapState;
|
|
33
|
-
onOpen?: () => void;
|
|
34
|
-
onClose?: () => void;
|
|
35
|
-
onTxStart: () => void;
|
|
36
|
-
onTxEnd: () => void;
|
|
37
|
-
}
|
|
38
|
-
export declare const TrackTransactionView: ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
39
32
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SquidTheme } from '../../types/config';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Parses the user readable config to css variables
|
|
4
4
|
* Also maps the public theme variables to the internal theme variables
|
|
5
|
+
* and adds the material-* variants
|
|
5
6
|
* example user theme:
|
|
6
7
|
* {
|
|
7
8
|
* 'content-100': '#000',
|
|
8
9
|
* 'content-200': '#000',
|
|
9
10
|
* 'accent-400': '#000',
|
|
10
|
-
* 'transparent-light-thin': '#000'
|
|
11
11
|
* }
|
|
12
12
|
* Resulting in:
|
|
13
13
|
* {
|
|
@@ -16,7 +16,8 @@ export declare const LargeShowDetailOnHoverOnly: Story;
|
|
|
16
16
|
export declare const LargeWithSecondaryImage: Story;
|
|
17
17
|
export declare const LargeSelected: Story;
|
|
18
18
|
export declare const LargeWithCustomIconAsImage: Story;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const SubtitleLoading: Story;
|
|
20
|
+
export declare const ImageAndBadgeLoading: Story;
|
|
20
21
|
export declare const Small: Story;
|
|
21
22
|
export declare const SmallInteractive: Story;
|
|
22
23
|
export declare const SmallWithLongTitle: Story;
|
|
@@ -18,6 +18,7 @@ export declare const ErrorWithSeparator: Story;
|
|
|
18
18
|
export declare const Warning: Story;
|
|
19
19
|
export declare const WarningWithSeparator: Story;
|
|
20
20
|
export declare const CustomDescription: Story;
|
|
21
|
+
export declare const CustomDescriptionWithRoundedImage: Story;
|
|
21
22
|
export declare const CustomDescriptionWithSeparator: Story;
|
|
22
23
|
export declare const Link: Story;
|
|
23
24
|
export declare const LongDescription: Story;
|
|
@@ -4,6 +4,8 @@ declare const meta: Meta<typeof SwapProgressView>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const WithControls: Story;
|
|
7
|
+
export declare const ShortRoute: Story;
|
|
8
|
+
export declare const LongRoute: Story;
|
|
7
9
|
export declare const Completed: Story;
|
|
8
10
|
export declare const Error: Story;
|
|
9
11
|
export declare const Confirm: Story;
|
|
@@ -5,8 +5,12 @@ export type ButtonSize = 'md' | 'lg';
|
|
|
5
5
|
export type SwapDirection = 'from' | 'to';
|
|
6
6
|
export type BoostMode = 'normal' | 'boost';
|
|
7
7
|
export type SwapStepDescriptionBlock = {
|
|
8
|
-
type: 'string'
|
|
8
|
+
type: 'string';
|
|
9
9
|
value: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'image';
|
|
12
|
+
value: string;
|
|
13
|
+
rounded?: boolean;
|
|
10
14
|
};
|
|
11
15
|
export type SwapStep = {
|
|
12
16
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
@@ -41,12 +41,6 @@ export type SquidTheme = {
|
|
|
41
41
|
'status-positive': string;
|
|
42
42
|
'status-negative': string;
|
|
43
43
|
'status-warning': string;
|
|
44
|
-
'transparent-light-thin': string;
|
|
45
|
-
'transparent-light-average': string;
|
|
46
|
-
'transparent-light-thick': string;
|
|
47
|
-
'transparent-dark-thin': string;
|
|
48
|
-
'transparent-dark-average': string;
|
|
49
|
-
'transparent-dark-thick': string;
|
|
50
44
|
};
|
|
51
45
|
export declare const SQUID_THEME_CSS_VARIABLE_PREFIX = "--squid-theme-";
|
|
52
46
|
/**
|
package/dist/index.css
CHANGED
|
@@ -741,10 +741,6 @@ video {
|
|
|
741
741
|
top: 11px;
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
-
.tw-top-\[52px\] {
|
|
745
|
-
top: 52px;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
744
|
.tw-top-squid-xxs {
|
|
749
745
|
top: 0.3125rem;
|
|
750
746
|
}
|
|
@@ -828,6 +824,10 @@ video {
|
|
|
828
824
|
margin-top: 0.25rem;
|
|
829
825
|
}
|
|
830
826
|
|
|
827
|
+
.tw-block {
|
|
828
|
+
display: block;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
831
|
.tw-flex {
|
|
832
832
|
display: flex;
|
|
833
833
|
}
|
|
@@ -1351,6 +1351,10 @@ video {
|
|
|
1351
1351
|
flex-shrink: 0;
|
|
1352
1352
|
}
|
|
1353
1353
|
|
|
1354
|
+
.tw-grow-0 {
|
|
1355
|
+
flex-grow: 0;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1354
1358
|
.-tw-translate-x-1\/2 {
|
|
1355
1359
|
--tw-translate-x: -50%;
|
|
1356
1360
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1438,6 +1442,34 @@ video {
|
|
|
1438
1442
|
animation: tw-expand-route var(--squid-animation-expand-to-top-duration, 0s) linear both;
|
|
1439
1443
|
}
|
|
1440
1444
|
|
|
1445
|
+
@keyframes tw-fade-in {
|
|
1446
|
+
0% {
|
|
1447
|
+
opacity: 0;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
100% {
|
|
1451
|
+
opacity: 1;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
.tw-animate-fade-in {
|
|
1456
|
+
animation: tw-fade-in var(--squid-animation-fade-in-duration, 0s) ease-out both;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
@keyframes tw-fade-out {
|
|
1460
|
+
0% {
|
|
1461
|
+
opacity: 1;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
100% {
|
|
1465
|
+
opacity: 0;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
.tw-animate-fade-out {
|
|
1470
|
+
animation: tw-fade-out var(--squid-animation-fade-out-duration, 0s) ease-out both;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1441
1473
|
@keyframes tw-hide {
|
|
1442
1474
|
0% {
|
|
1443
1475
|
display: block;
|
|
@@ -1493,8 +1525,8 @@ video {
|
|
|
1493
1525
|
}
|
|
1494
1526
|
|
|
1495
1527
|
100% {
|
|
1496
|
-
transform: scale(0.
|
|
1497
|
-
opacity: 0;
|
|
1528
|
+
transform: scale(0.9);
|
|
1529
|
+
opacity: 0.5;
|
|
1498
1530
|
}
|
|
1499
1531
|
}
|
|
1500
1532
|
|
|
@@ -1504,8 +1536,8 @@ video {
|
|
|
1504
1536
|
|
|
1505
1537
|
@keyframes tw-scale-and-fade-up {
|
|
1506
1538
|
0% {
|
|
1507
|
-
transform: scale(0.
|
|
1508
|
-
opacity: 0;
|
|
1539
|
+
transform: scale(0.9);
|
|
1540
|
+
opacity: 0.5;
|
|
1509
1541
|
}
|
|
1510
1542
|
|
|
1511
1543
|
100% {
|
|
@@ -2224,6 +2256,10 @@ video {
|
|
|
2224
2256
|
padding-right: 0.625rem;
|
|
2225
2257
|
}
|
|
2226
2258
|
|
|
2259
|
+
.tw-pt-\[52px\] {
|
|
2260
|
+
padding-top: 52px;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2227
2263
|
.tw-pt-\[5px\] {
|
|
2228
2264
|
padding-top: 5px;
|
|
2229
2265
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import React$1 from 'react';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import React__default from 'react';
|
|
4
5
|
|
|
5
6
|
interface BadgeImageProps {
|
|
6
7
|
imageUrl?: string;
|
|
@@ -54,8 +55,12 @@ type ButtonSize = 'md' | 'lg';
|
|
|
54
55
|
type SwapDirection = 'from' | 'to';
|
|
55
56
|
type BoostMode = 'normal' | 'boost';
|
|
56
57
|
type SwapStepDescriptionBlock = {
|
|
57
|
-
type: 'string'
|
|
58
|
+
type: 'string';
|
|
58
59
|
value: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'image';
|
|
62
|
+
value: string;
|
|
63
|
+
rounded?: boolean;
|
|
59
64
|
};
|
|
60
65
|
type SwapStep = {
|
|
61
66
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
@@ -175,8 +180,8 @@ declare function Switch({ checked, onChange, size, disabled, }: SwitchProps): re
|
|
|
175
180
|
type TooltipWidth = 'max' | 'container';
|
|
176
181
|
type TooltipThreshold = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
177
182
|
interface TooltipProps {
|
|
178
|
-
children:
|
|
179
|
-
tooltipContent:
|
|
183
|
+
children: React__default.ReactNode;
|
|
184
|
+
tooltipContent: React__default.ReactNode;
|
|
180
185
|
threshold?: TooltipThreshold;
|
|
181
186
|
tooltipWidth?: TooltipWidth;
|
|
182
187
|
containerClassName?: string;
|
|
@@ -367,13 +372,13 @@ interface InfoBoxProps {
|
|
|
367
372
|
declare function InfoBox({ title, description, icon }: InfoBoxProps): react_jsx_runtime.JSX.Element;
|
|
368
373
|
|
|
369
374
|
type Rounded = 'sm' | 'lg';
|
|
370
|
-
interface MenuProps extends
|
|
375
|
+
interface MenuProps extends React__default.ComponentProps<'div'> {
|
|
371
376
|
containerClassName?: string;
|
|
372
377
|
contentClassName?: string;
|
|
373
378
|
title?: string;
|
|
374
379
|
displayControls?: boolean;
|
|
375
380
|
rounded?: Rounded;
|
|
376
|
-
menuRef?:
|
|
381
|
+
menuRef?: React__default.RefObject<HTMLDivElement>;
|
|
377
382
|
}
|
|
378
383
|
declare function Menu({ children, containerClassName, contentClassName, title, displayControls, rounded, menuRef, ...props }: MenuProps): react_jsx_runtime.JSX.Element;
|
|
379
384
|
|
|
@@ -458,13 +463,21 @@ interface SwapProgressViewHeaderProps {
|
|
|
458
463
|
}
|
|
459
464
|
declare function SwapProgressViewHeader({ title, description, }: SwapProgressViewHeaderProps): react_jsx_runtime.JSX.Element;
|
|
460
465
|
|
|
466
|
+
type SwapStepsCollapsedFooterButton = {
|
|
467
|
+
label: string;
|
|
468
|
+
link?: string;
|
|
469
|
+
onClick?: () => void;
|
|
470
|
+
};
|
|
461
471
|
interface SwapStepsCollapsedProps {
|
|
462
472
|
steps: SwapStep[];
|
|
463
473
|
currentStepIndex: number;
|
|
464
474
|
onOpen?: () => void;
|
|
465
475
|
onClose?: () => void;
|
|
476
|
+
footerButton?: SwapStepsCollapsedFooterButton;
|
|
466
477
|
}
|
|
467
|
-
declare
|
|
478
|
+
declare const SwapStepsCollapsed: React$1.ForwardRefExoticComponent<SwapStepsCollapsedProps & React$1.RefAttributes<{
|
|
479
|
+
handleToggleRouteSteps: () => void;
|
|
480
|
+
}>>;
|
|
468
481
|
|
|
469
482
|
interface TokenPairProps {
|
|
470
483
|
firstToken: {
|
|
@@ -507,7 +520,7 @@ type Token = {
|
|
|
507
520
|
logoUrl: string;
|
|
508
521
|
bgColor: string;
|
|
509
522
|
};
|
|
510
|
-
declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
523
|
+
declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
511
524
|
steps: SwapStep[];
|
|
512
525
|
handleClose?: () => void;
|
|
513
526
|
handleComplete?: () => void;
|
|
@@ -524,6 +537,7 @@ declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete,
|
|
|
524
537
|
toAddressFormatted: string;
|
|
525
538
|
swapState: SwapState;
|
|
526
539
|
estimatedTimeToComplete?: string;
|
|
540
|
+
footerButton?: SwapStepsCollapsedFooterButton;
|
|
527
541
|
}): react_jsx_runtime.JSX.Element;
|
|
528
542
|
|
|
529
543
|
type SquidTheme = {
|
|
@@ -541,12 +555,6 @@ type SquidTheme = {
|
|
|
541
555
|
'status-positive': string;
|
|
542
556
|
'status-negative': string;
|
|
543
557
|
'status-warning': string;
|
|
544
|
-
'transparent-light-thin': string;
|
|
545
|
-
'transparent-light-average': string;
|
|
546
|
-
'transparent-light-thick': string;
|
|
547
|
-
'transparent-dark-thin': string;
|
|
548
|
-
'transparent-dark-average': string;
|
|
549
|
-
'transparent-dark-thick': string;
|
|
550
558
|
};
|
|
551
559
|
|
|
552
560
|
declare function SquidConfigProvider({ theme, children, themeType, }: {
|
|
@@ -565,4 +573,4 @@ declare function useDropdownMenu(props?: {
|
|
|
565
573
|
openDropdownButtonRef: React.RefObject<HTMLButtonElement>;
|
|
566
574
|
};
|
|
567
575
|
|
|
568
|
-
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, BorderedContainer, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressView, SwapProgressViewHeader, SwapState, type SwapStep, SwapStepItem, type SwapStepItemStatus, SwapStepsCollapsed, Switch, type ThemeType, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, UsdAmount, useDropdownMenu };
|
|
576
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, BorderedContainer, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressView, SwapProgressViewHeader, SwapState, type SwapStep, SwapStepItem, type SwapStepItemStatus, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, Switch, type ThemeType, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, UsdAmount, useDropdownMenu };
|