@0xsquid/ui 0.9.5 → 0.10.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 +88 -41
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +2 -1
- package/dist/cjs/types/components/buttons/Button.d.ts +2 -1
- package/dist/cjs/types/components/controls/Tooltip.d.ts +2 -1
- package/dist/cjs/types/components/icons/Social.d.ts +4 -0
- package/dist/cjs/types/components/layout/Boost.d.ts +2 -1
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +2 -1
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +2 -1
- package/dist/cjs/types/components/lists/ListItem.d.ts +1 -1
- package/dist/cjs/types/core/constants.d.ts +4 -0
- package/dist/cjs/types/core/themes.d.ts +1 -0
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +1 -1
- package/dist/cjs/types/stories/buttons/BoostButton.stories.d.ts +1 -0
- package/dist/cjs/types/stories/buttons/Button.stories.d.ts +2 -0
- package/dist/cjs/types/stories/controls/Tooltip.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 +1 -0
- package/dist/esm/index.js +88 -41
- package/dist/esm/types/components/buttons/BoostButton.d.ts +2 -1
- package/dist/esm/types/components/buttons/Button.d.ts +2 -1
- package/dist/esm/types/components/controls/Tooltip.d.ts +2 -1
- package/dist/esm/types/components/icons/Social.d.ts +4 -0
- package/dist/esm/types/components/layout/Boost.d.ts +2 -1
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +2 -1
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +2 -1
- package/dist/esm/types/components/lists/ListItem.d.ts +1 -1
- package/dist/esm/types/core/constants.d.ts +4 -0
- package/dist/esm/types/core/themes.d.ts +1 -0
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +1 -1
- package/dist/esm/types/stories/buttons/BoostButton.stories.d.ts +1 -0
- package/dist/esm/types/stories/buttons/Button.stories.d.ts +2 -0
- package/dist/esm/types/stories/controls/Tooltip.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 +1 -0
- package/dist/index.css +90 -40
- package/dist/index.d.ts +14 -8
- package/package.json +1 -1
- package/dist/cjs/types/components/views/ProfileView.d.ts +0 -1
- package/dist/cjs/types/stories/views/ProfileView.stories.d.ts +0 -6
- package/dist/esm/types/components/views/ProfileView.d.ts +0 -1
- package/dist/esm/types/stories/views/ProfileView.stories.d.ts +0 -6
package/dist/cjs/index.js
CHANGED
|
@@ -2765,6 +2765,11 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2765
2765
|
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
|
|
2766
2766
|
}
|
|
2767
2767
|
|
|
2768
|
+
const CSS_VARS = {
|
|
2769
|
+
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
2770
|
+
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2768
2773
|
function SearchIcon() {
|
|
2769
2774
|
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" }) }));
|
|
2770
2775
|
}
|
|
@@ -2967,7 +2972,7 @@ const borderRadiusClassMap = {
|
|
|
2967
2972
|
};
|
|
2968
2973
|
function Menu(_a) {
|
|
2969
2974
|
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
|
|
2970
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsxRuntime.jsx("div", { className: "tw-z-20 tw-max-w-full", children: children })), displayControls ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsxRuntime.jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2975
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsxRuntime.jsx("div", { className: "tw-z-20 tw-max-w-full tw-text-caption", children: children })), displayControls ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsxRuntime.jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2971
2976
|
}
|
|
2972
2977
|
|
|
2973
2978
|
const tooltipWidthClassMap = {
|
|
@@ -2983,19 +2988,25 @@ const tooltipThresholdClassMap = {
|
|
|
2983
2988
|
xl: 'tw-pb-squid-xl',
|
|
2984
2989
|
xxl: 'tw-pb-squid-xxl',
|
|
2985
2990
|
};
|
|
2986
|
-
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, }) {
|
|
2987
|
-
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsxRuntime.jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsxRuntime.jsx(Menu, {
|
|
2991
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, }) {
|
|
2992
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsxRuntime.jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsxRuntime.jsx(Menu, { style: {
|
|
2993
|
+
[CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms`,
|
|
2994
|
+
}, containerClassName: cn(
|
|
2995
|
+
// general styles
|
|
2996
|
+
'tw-absolute tw-z-40 tw-bottom-full tw-left-1/2 -tw-translate-x-1/2',
|
|
2997
|
+
// visibility styles. Display only on hover
|
|
2998
|
+
'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
|
|
2988
2999
|
}
|
|
2989
3000
|
|
|
2990
3001
|
const animationDuration = '500ms';
|
|
2991
|
-
function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', }) {
|
|
3002
|
+
function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, }) {
|
|
2992
3003
|
const boostIndicatorRef = react.useRef(null);
|
|
2993
3004
|
function handleToggleBoostMode() {
|
|
2994
3005
|
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
2995
3006
|
return;
|
|
2996
3007
|
// we don't want to trigger the animation when the component is mounted
|
|
2997
3008
|
// so we set the animation duration only when user clicks the button
|
|
2998
|
-
boostIndicatorRef.current.style.setProperty(
|
|
3009
|
+
boostIndicatorRef.current.style.setProperty(CSS_VARS.MOVE_WITH_SPRING_BOUNCE_DURATION, animationDuration);
|
|
2999
3010
|
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
3000
3011
|
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
3001
3012
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
@@ -3005,7 +3016,7 @@ function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode = true,
|
|
|
3005
3016
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
3006
3017
|
}
|
|
3007
3018
|
}
|
|
3008
|
-
return (jsxRuntime.jsx(Tooltip, { tooltipWidth: "max", tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxRuntime.jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: "tw-group 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-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
3019
|
+
return (jsxRuntime.jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxRuntime.jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: "tw-group 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-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
3009
3020
|
boxShadow: generateMarkerLines(40),
|
|
3010
3021
|
} })] }), 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 group-disabled:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
3011
3022
|
transitionDuration: animationDuration,
|
|
@@ -3028,26 +3039,31 @@ const buttonSizeClassMap = {
|
|
|
3028
3039
|
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
3029
3040
|
};
|
|
3030
3041
|
const buttonVariantClassMap = {
|
|
3031
|
-
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
3042
|
+
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
|
|
3032
3043
|
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
3033
3044
|
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
3034
3045
|
};
|
|
3035
3046
|
// right now all variants have the same disabled styles
|
|
3036
3047
|
// in the future, we can add more disabled styles for different variants
|
|
3037
|
-
const buttonDisabledClass = '
|
|
3048
|
+
const buttonDisabledClass = 'tw-bg-grey-800 tw-text-grey-600 tw-cursor-not-allowed';
|
|
3038
3049
|
function Button(_a) {
|
|
3039
|
-
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
3040
|
-
|
|
3041
|
-
// disabled styles
|
|
3042
|
-
buttonDisabledClass,
|
|
3043
|
-
// custom classes from props
|
|
3044
|
-
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 ? (
|
|
3050
|
+
var { label, disabled, size, variant, icon, link } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
|
|
3051
|
+
const children = (jsxRuntime.jsx(jsxRuntime.Fragment, { children: size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
3045
3052
|
// label only
|
|
3046
3053
|
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
3047
3054
|
// icon only
|
|
3048
3055
|
icon) : (
|
|
3049
3056
|
// icon and label
|
|
3050
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null }))
|
|
3057
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null }));
|
|
3058
|
+
const className = cn(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
3059
|
+
// disabled styles
|
|
3060
|
+
disabled && buttonDisabledClass,
|
|
3061
|
+
// custom classes from props
|
|
3062
|
+
props.className);
|
|
3063
|
+
if (link) {
|
|
3064
|
+
return (jsxRuntime.jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
|
|
3065
|
+
}
|
|
3066
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
|
|
3051
3067
|
}
|
|
3052
3068
|
|
|
3053
3069
|
function Chip(_a) {
|
|
@@ -3068,8 +3084,8 @@ function SettingsButton({ label, isSelected = false, }) {
|
|
|
3068
3084
|
return (jsxRuntime.jsx("button", { className: cn('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 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
3069
3085
|
}
|
|
3070
3086
|
|
|
3071
|
-
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, }) {
|
|
3072
|
-
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' || !canToggleBoostMode
|
|
3087
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
|
|
3088
|
+
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, tooltipDisplayDelayMs: boostTooltipDisplayDelayMs }), jsxRuntime.jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
3073
3089
|
? 'tw-bg-grey-300'
|
|
3074
3090
|
: 'tw-bg-status-positive') })] }));
|
|
3075
3091
|
}
|
|
@@ -3088,7 +3104,7 @@ const detailStateClassMap = {
|
|
|
3088
3104
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
3089
3105
|
full: '',
|
|
3090
3106
|
};
|
|
3091
|
-
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }) {
|
|
3107
|
+
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, }) {
|
|
3092
3108
|
const state = react.useMemo(() => {
|
|
3093
3109
|
if (errorMessage)
|
|
3094
3110
|
return 'error';
|
|
@@ -3099,11 +3115,11 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3099
3115
|
return 'full';
|
|
3100
3116
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3101
3117
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3102
|
-
return (jsxRuntime.jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: 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: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage }) })] })) }));
|
|
3118
|
+
return (jsxRuntime.jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: 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: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3103
3119
|
}
|
|
3104
3120
|
|
|
3105
3121
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
3106
|
-
return (jsxRuntime.jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs",
|
|
3122
|
+
return (jsxRuntime.jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxRuntime.jsxs("button", { onClick: onClick, className: "tw-flex tw-h-squid-l tw-w-full tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-px-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: cn(labelClassName, 'tw-max-w-full tw-truncate !tw-leading-[18px]'), children: label })] }) }));
|
|
3107
3123
|
}
|
|
3108
3124
|
|
|
3109
3125
|
function useDropdownMenu(props) {
|
|
@@ -3210,16 +3226,18 @@ const listItemSizeMap = {
|
|
|
3210
3226
|
};
|
|
3211
3227
|
function ListItem(_a) {
|
|
3212
3228
|
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading"]);
|
|
3213
|
-
|
|
3229
|
+
// 'small' variant does not have detail
|
|
3230
|
+
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
3231
|
+
return (jsxRuntime.jsx("li", { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxRuntime.jsxs("button", Object.assign({}, props, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-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: rounded })) })) : (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-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xs',
|
|
3214
3232
|
// 'large' variant has extra padding
|
|
3215
|
-
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className: "tw-max-w-full tw-truncate !tw-leading-[
|
|
3216
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsxRuntime.jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-squid-xs !tw-leading-[
|
|
3233
|
+
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className: "tw-max-w-full tw-truncate !tw-leading-[17px]", children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
3234
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsxRuntime.jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-squid-xs tw-max-w-full tw-truncate !tw-leading-[11px] tw-text-grey-500", children: subtitle })) : null)] }), showDetail && (jsxRuntime.jsxs("button", { onClick: (event) => {
|
|
3217
3235
|
// prevent click event from bubbling up to parent
|
|
3218
3236
|
event.stopPropagation();
|
|
3219
3237
|
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
3220
|
-
}, className: cn('tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
3221
|
-
? 'tw-
|
|
3222
|
-
: 'tw-flex', detailButtonClassName), children: [
|
|
3238
|
+
}, className: cn('tw-flex tw-w-fit tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
3239
|
+
? 'tw-opacity-0 hover:tw-opacity-100 focus:tw-opacity-100 group-hover/list-item:tw-opacity-100 group-focus/list-item:tw-opacity-100'
|
|
3240
|
+
: 'tw-flex', detailButtonClassName), children: [!!detail && (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] }))] })) }));
|
|
3223
3241
|
}
|
|
3224
3242
|
|
|
3225
3243
|
function MenuItem({ label, imageUrl, icon }) {
|
|
@@ -3287,8 +3305,9 @@ const separatorClassMap = {
|
|
|
3287
3305
|
progress: 'tw-text-grey-600',
|
|
3288
3306
|
pending: 'tw-text-grey-600',
|
|
3289
3307
|
};
|
|
3308
|
+
const colorsTransitionClass = 'tw-transition-colors tw-duration-300';
|
|
3290
3309
|
function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, link, status = 'pending', }) {
|
|
3291
|
-
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-
|
|
3310
|
+
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-text-grey-300", children: [showStepSeparator && (jsxRuntime.jsx("span", { className: cn(separatorClassMap[status], colorsTransitionClass, 'tw-duration-100'), children: jsxRuntime.jsx(SwapStepSeparator, {}) })), jsxRuntime.jsxs("a", { href: link, target: "_blank", 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', statusTextClassMap[status], colorsTransitionClass), 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, { className: cn('tw-w-squid-xl', statusBgClassMap[status], colorsTransitionClass), icon: typeof chipContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: chipContent })) : (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(({ type, value }, index) => {
|
|
3292
3311
|
if (type === 'string') {
|
|
3293
3312
|
return (
|
|
3294
3313
|
// Instead of displaying the string into a single <BodyText />
|
|
@@ -3386,17 +3405,17 @@ function SwapInputsIcon() {
|
|
|
3386
3405
|
return (jsxRuntime.jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_40_7936)", children: jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_40_7936", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
3387
3406
|
}
|
|
3388
3407
|
|
|
3389
|
-
|
|
3408
|
+
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
3409
|
+
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage = 5, emptyAddressLabel = 'Connect wallet', }) {
|
|
3390
3410
|
var _a;
|
|
3391
3411
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
3392
3412
|
? 'tw-text-status-negative'
|
|
3393
3413
|
: 'tw-text-grey-300';
|
|
3394
|
-
const
|
|
3395
|
-
|
|
3396
|
-
const
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
: 'tw-pointer-events-none'), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balance }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
3414
|
+
const isBalanceChipInteractive = !!onBalanceButtonClick;
|
|
3415
|
+
const BalanceChipTag = isBalanceChipInteractive ? 'button' : 'div';
|
|
3416
|
+
const isSwapAmountChipInteractive = !!onSwapAmountButtonClick;
|
|
3417
|
+
const SwapAmountChipTag = isSwapAmountChipInteractive ? 'button' : 'div';
|
|
3418
|
+
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 tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { size: "small", children: ":" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsxRuntime.jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-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(NumericInput, { forcedUpdateValue: forcedAmount, initialValue: amount, onParsedValueChanged: (value) => onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value) })) : (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: [error ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsxs(SwapAmountChipTag, { onClick: onSwapAmountButtonClick, className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isSwapAmountChipInteractive && interactiveChipClassName), 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(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isBalanceChipInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balance }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
3400
3419
|
}
|
|
3401
3420
|
|
|
3402
3421
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -3434,12 +3453,11 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
|
3434
3453
|
};
|
|
3435
3454
|
}, [isShowRouteAnimationRunning]);
|
|
3436
3455
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3437
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-absolute tw-left-0 tw-top-full tw-w-full tw-animate-translate-to-top", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800" }), jsxRuntime.jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800" })] }) }), isRouteVisible && (jsxRuntime.jsxs("div", { className: "tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-justify-end tw-gap-squid-xxs", children: [jsxRuntime.jsx("div", { className: cn('tw-absolute tw-top-0 tw-h-[536px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10', isShowRouteAnimationRunning
|
|
3456
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("button", { className: "tw-group/swap-step-item-button tw-relative tw-max-h-button tw-max-w-[400px] tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800 tw-transition-colors tw-duration-[50ms] hover:tw-bg-grey-700", onClick: () => {
|
|
3457
|
+
// mount route component and start animation
|
|
3458
|
+
setIsRouteVisible(true);
|
|
3459
|
+
setIsShowRouteAnimationRunning(true);
|
|
3460
|
+
}, children: [newStepIndex > currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-absolute -tw-top-full tw-left-0 tw-w-full tw-animate-translate-to-bottom", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx(CurrentStep, { className: cn(newStepIndex > currentStepIndex && 'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-absolute tw-left-0 tw-top-full tw-w-full tw-animate-translate-to-top", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-20 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-20 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" })] }), isRouteVisible && (jsxRuntime.jsxs("div", { className: "tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-justify-end tw-gap-squid-xxs", children: [jsxRuntime.jsx("div", { className: cn('tw-absolute tw-top-0 tw-h-[536px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10', isShowRouteAnimationRunning
|
|
3443
3461
|
? 'tw-animate-fade-in'
|
|
3444
3462
|
: 'tw-animate-fade-out'), onClick: collapseRouteSteps }), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-max-h-[536px] tw-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
3445
3463
|
? 'tw-animate-slide-to-top'
|
|
@@ -3459,6 +3477,32 @@ function TokenPair({ firstToken, secondToken }) {
|
|
|
3459
3477
|
}, children: [jsxRuntime.jsx("img", { className: "tw-ml-[1px] tw-aspect-square tw-w-10", src: firstToken.imageUrl }), jsxRuntime.jsx("img", { className: "tw-mr-[1px] tw-aspect-square tw-w-10", src: secondToken.imageUrl })] })] }));
|
|
3460
3478
|
}
|
|
3461
3479
|
|
|
3480
|
+
const lightTheme = {
|
|
3481
|
+
// content
|
|
3482
|
+
'content-100': '#17191C',
|
|
3483
|
+
'content-200': '#292C32',
|
|
3484
|
+
'content-300': '#4C515D',
|
|
3485
|
+
'content-400': '#626784',
|
|
3486
|
+
'content-500': '#8A8FA8',
|
|
3487
|
+
'content-600': '#A7ABBE',
|
|
3488
|
+
'content-700': '#D1D6E0',
|
|
3489
|
+
'content-800': '#EDEEF3',
|
|
3490
|
+
'content-900': '#FBFBFD',
|
|
3491
|
+
// accent
|
|
3492
|
+
'accent-400': '#9E79D2',
|
|
3493
|
+
'accent-500': '#B893EC',
|
|
3494
|
+
// status
|
|
3495
|
+
'status-positive': '#11D421',
|
|
3496
|
+
'status-negative': '#FF5B4D',
|
|
3497
|
+
// transparent
|
|
3498
|
+
'transparent-light-thin': '#17191C1A', // 10% opacity
|
|
3499
|
+
'transparent-light-average': '#17191C54', // 33% opacity
|
|
3500
|
+
'transparent-light-thick': '#17191CA8', // 66% opacity
|
|
3501
|
+
'transparent-dark-thin': '#FBFBFD1A', // 10% opacity
|
|
3502
|
+
'transparent-dark-average': '#FBFCFD54', // 33% opacity
|
|
3503
|
+
'transparent-dark-thick': '#FBFCFDA8', // 66% opacity
|
|
3504
|
+
};
|
|
3505
|
+
|
|
3462
3506
|
const themeKeysToReplace = [
|
|
3463
3507
|
{
|
|
3464
3508
|
userKey: 'content',
|
|
@@ -3504,6 +3548,9 @@ const parseSquidTheme = (userTheme) => {
|
|
|
3504
3548
|
const newKey = userKey.replace(keyToReplace.userKey, keyToReplace.internalKey);
|
|
3505
3549
|
internalKeys[newKey] = userValue;
|
|
3506
3550
|
}
|
|
3551
|
+
else {
|
|
3552
|
+
internalKeys[userKey] = userValue;
|
|
3553
|
+
}
|
|
3507
3554
|
return internalKeys;
|
|
3508
3555
|
}, {});
|
|
3509
3556
|
const styleKeys = Object.keys(themeTypesKeys);
|
|
@@ -3552,7 +3599,7 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3552
3599
|
.padStart(2, '0')).toUpperCase();
|
|
3553
3600
|
}
|
|
3554
3601
|
|
|
3555
|
-
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3602
|
+
function SquidConfigProvider({ theme = lightTheme, children, themeType = 'light', }) {
|
|
3556
3603
|
const parsedStyle = parseSquidTheme(theme);
|
|
3557
3604
|
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3558
3605
|
}
|
|
@@ -6,6 +6,7 @@ interface BoostButtonProps {
|
|
|
6
6
|
boostMode: BoostMode;
|
|
7
7
|
}) => void;
|
|
8
8
|
boostDisabledMessage?: string;
|
|
9
|
+
tooltipDisplayDelayMs?: number;
|
|
9
10
|
}
|
|
10
|
-
export declare function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, tooltipDisplayDelayMs, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -6,6 +6,7 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
6
6
|
variant: ButtonVariant;
|
|
7
7
|
size: ButtonSize;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
link?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function Button({ label, disabled, size, variant, icon, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Button({ label, disabled, size, variant, icon, link, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -9,5 +9,6 @@ export interface TooltipProps {
|
|
|
9
9
|
containerClassName?: string;
|
|
10
10
|
childrenClassName?: string;
|
|
11
11
|
tooltipClassName?: string;
|
|
12
|
+
displayDelayMs?: number;
|
|
12
13
|
}
|
|
13
|
-
export declare function Tooltip({ children, tooltipContent, tooltipWidth, threshold, containerClassName, childrenClassName, tooltipClassName, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function Tooltip({ children, tooltipContent, tooltipWidth, threshold, containerClassName, childrenClassName, tooltipClassName, displayDelayMs, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,7 @@ interface BoostProps {
|
|
|
7
7
|
estimatedTime: string;
|
|
8
8
|
boostDisabledMessage?: string;
|
|
9
9
|
canToggleBoostMode?: boolean;
|
|
10
|
+
boostTooltipDisplayDelayMs?: number;
|
|
10
11
|
}
|
|
11
|
-
export declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, boostTooltipDisplayDelayMs, }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -17,6 +17,7 @@ interface DetailsToolbarProps {
|
|
|
17
17
|
label: string;
|
|
18
18
|
onClick: () => void;
|
|
19
19
|
};
|
|
20
|
+
boostTooltipDisplayDelayMs?: number;
|
|
20
21
|
}
|
|
21
|
-
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -27,6 +27,7 @@ interface SwapConfigurationProps {
|
|
|
27
27
|
};
|
|
28
28
|
criticalPriceImpactPercentage?: number;
|
|
29
29
|
emptyAddressLabel?: string;
|
|
30
|
+
onSwapAmountButtonClick?: () => void;
|
|
30
31
|
}
|
|
31
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
interface ListItemProps extends React.HTMLAttributes<
|
|
2
|
+
interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
3
|
itemTitle: string | React.ReactNode;
|
|
4
4
|
mainImageUrl?: string;
|
|
5
5
|
secondaryImageUrl?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ThemeType } from '../types/components';
|
|
3
3
|
import { SquidTheme } from '../types/config';
|
|
4
4
|
export declare function SquidConfigProvider({ theme, children, themeType, }: {
|
|
5
|
-
theme
|
|
5
|
+
theme?: SquidTheme;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
themeType?: ThemeType;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,3 +19,5 @@ export declare const LargePrimary: Story;
|
|
|
19
19
|
export declare const LargeSecondary: Story;
|
|
20
20
|
export declare const LargeTertiary: Story;
|
|
21
21
|
export declare const LargeDisabled: Story;
|
|
22
|
+
export declare const LargeAndLink: Story;
|
|
23
|
+
export declare const LargeAndLinkDisabled: Story;
|
|
@@ -5,6 +5,7 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Large: Story;
|
|
7
7
|
export declare const LargeWithLongTitle: Story;
|
|
8
|
+
export declare const LargeWithLongTitleAndSubtitle: Story;
|
|
8
9
|
export declare const LargeRoundedFull: Story;
|
|
9
10
|
export declare const LargeWithSubtitle: Story;
|
|
10
11
|
export declare const LargeWithDetail: Story;
|