@0xsquid/ui 0.4.0 → 0.4.2
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 +14 -21
- package/dist/cjs/types/components/badges/UsdAmount.d.ts +1 -1
- package/dist/cjs/types/components/buttons/AssetsButton.d.ts +2 -1
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +6 -2
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +9 -4
- package/dist/cjs/types/types/components.d.ts +1 -6
- package/dist/esm/index.js +14 -21
- package/dist/esm/types/components/badges/UsdAmount.d.ts +1 -1
- package/dist/esm/types/components/buttons/AssetsButton.d.ts +2 -1
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +6 -2
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +9 -4
- package/dist/esm/types/types/components.d.ts +1 -6
- package/dist/fonts/Geist-Variable.woff2 +0 -0
- package/dist/fonts/fonts/Geist-Variable.woff2 +0 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +17 -13
- package/package.json +7 -6
package/dist/cjs/index.js
CHANGED
|
@@ -2762,7 +2762,7 @@ const themeTypesKeys = {
|
|
|
2762
2762
|
|
|
2763
2763
|
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2764
2764
|
const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
|
|
2765
|
-
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, }) {
|
|
2765
|
+
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, onClick, }) {
|
|
2766
2766
|
const bgGradient = react.useMemo(() => {
|
|
2767
2767
|
if (!chainImageUrl) {
|
|
2768
2768
|
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
@@ -2772,11 +2772,11 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2772
2772
|
}
|
|
2773
2773
|
return `linear-gradient(to right, ${chainBgColor} 47.5%, ${tokenBgColor} 52.5%)`;
|
|
2774
2774
|
}, [chainBgColor, tokenBgColor]);
|
|
2775
|
-
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2775
|
+
return (jsxRuntime.jsxs("div", { onClick: onClick, className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2776
2776
|
backgroundImage: bgGradient,
|
|
2777
2777
|
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsxRuntime.jsx("img", { src: chainImageUrl, alt: "" })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsxRuntime.jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
|
|
2778
2778
|
backgroundColor: tokenBgColor,
|
|
2779
|
-
}, children: jsxRuntime.jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-
|
|
2779
|
+
}, children: jsxRuntime.jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px]" }) })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2780
2780
|
backgroundColor: tokenBgColor,
|
|
2781
2781
|
color: tokenTextColor,
|
|
2782
2782
|
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, {})] })] }));
|
|
@@ -2855,7 +2855,7 @@ function EthereumIcon() {
|
|
|
2855
2855
|
}
|
|
2856
2856
|
|
|
2857
2857
|
function FeeButton() {
|
|
2858
|
-
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(Chip, { label: "Fee" }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2858
|
+
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(Chip, { label: "Fee" }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: '560' })] })] }));
|
|
2859
2859
|
}
|
|
2860
2860
|
|
|
2861
2861
|
// font size, line height, and letter spacing classes
|
|
@@ -2947,27 +2947,19 @@ function Boost({ boostMode, onToggleBoostMode }) {
|
|
|
2947
2947
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-bg-grey-900 tw-pr-squid-xxs", children: [jsxRuntime.jsx(BoostButton, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }), jsxRuntime.jsx(Chip, { label: boostMode === 'normal' ? '10m' : '20s', className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
|
|
2948
2948
|
}
|
|
2949
2949
|
|
|
2950
|
-
var DetailsToolbarState;
|
|
2951
|
-
(function (DetailsToolbarState) {
|
|
2952
|
-
DetailsToolbarState[DetailsToolbarState["FULL"] = 0] = "FULL";
|
|
2953
|
-
DetailsToolbarState[DetailsToolbarState["LOADING"] = 1] = "LOADING";
|
|
2954
|
-
DetailsToolbarState[DetailsToolbarState["EMPTY"] = 2] = "EMPTY";
|
|
2955
|
-
DetailsToolbarState[DetailsToolbarState["ERROR"] = 3] = "ERROR";
|
|
2956
|
-
})(DetailsToolbarState || (DetailsToolbarState = {}));
|
|
2957
|
-
|
|
2958
2950
|
function EmojiSadIcon() {
|
|
2959
2951
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM13.5341 12.4645C11.5815 10.5118 8.41568 10.5118 6.46306 12.4645C6.07254 12.855 6.07254 13.4882 6.46306 13.8787C6.85358 14.2692 7.48675 14.2692 7.87727 13.8787C9.04885 12.7071 10.9483 12.7071 12.1199 13.8787C12.5104 14.2692 13.1436 14.2692 13.5341 13.8787C13.9247 13.4882 13.9247 12.855 13.5341 12.4645ZM8.5 7.5C8.5 8.32843 7.94036 9 7.25 9C6.55964 9 6 8.32843 6 7.5C6 6.67157 6.55964 6 7.25 6C7.94036 6 8.5 6.67157 8.5 7.5ZM12.75 9C13.4404 9 14 8.32843 14 7.5C14 6.67157 13.4404 6 12.75 6C12.0596 6 11.5 6.67157 11.5 7.5C11.5 8.32843 12.0596 9 12.75 9Z", fill: "currentColor" }) }));
|
|
2960
2952
|
}
|
|
2961
2953
|
|
|
2962
2954
|
const detailStateClassMap = {
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2955
|
+
loading: 'tw-opacity-33 tw-pointer-events-none',
|
|
2956
|
+
empty: 'tw-pointer-events-none tw-hidden',
|
|
2957
|
+
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
2958
|
+
full: '',
|
|
2967
2959
|
};
|
|
2968
|
-
function DetailsToolbar({ state =
|
|
2960
|
+
function DetailsToolbar({ state = 'full', errorMessage, boostMode = 'normal', onToggleBoostMode, }) {
|
|
2969
2961
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
2970
|
-
return (jsxRuntime.jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state ===
|
|
2962
|
+
return (jsxRuntime.jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === 'error' ? (jsxRuntime.jsx(ErrorMessage, { message: errorMessage })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, {}) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }) })] })) }));
|
|
2971
2963
|
}
|
|
2972
2964
|
const ErrorMessage = ({ message }) => {
|
|
2973
2965
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsxRuntime.jsx(EmojiSadIcon, {}), jsxRuntime.jsx(CaptionText, { children: message })] }));
|
|
@@ -3003,11 +2995,12 @@ function WalletAddress({ address, ens }) {
|
|
|
3003
2995
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", children: ens ? ens : (address === null || address === void 0 ? void 0 : address.slice(0, 6)) + '...' + (address === null || address === void 0 ? void 0 : address.slice(-4)) }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronArrowIcon, {}) })] }));
|
|
3004
2996
|
}
|
|
3005
2997
|
|
|
3006
|
-
function SwapConfiguration({ priceImpactPercentage, amount = 0, swapAmountUsd = 0, balance = '0', isFetching = false, chain, token, direction, }) {
|
|
3007
|
-
|
|
2998
|
+
function SwapConfiguration({ priceImpactPercentage, amount = '0', swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, }) {
|
|
2999
|
+
var _a;
|
|
3000
|
+
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > 5
|
|
3008
3001
|
? 'tw-text-status-negative'
|
|
3009
3002
|
: 'tw-text-grey-300';
|
|
3010
|
-
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("
|
|
3003
|
+
return (jsxRuntime.jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxRuntime.jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsxRuntime.jsx(WalletAddress, { ens: address })] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { onClick: onAssetsButtonClick, chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m", children: jsxRuntime.jsx("input", { className: "tw-my-squid-xs tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-royal-400 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-outline-none", placeholder: "0", value: amount, onChange: onAmountChange }) }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxRuntime.jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [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("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balance }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
3011
3004
|
}
|
|
3012
3005
|
|
|
3013
3006
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -5,6 +5,7 @@ interface AssetsButtonProps {
|
|
|
5
5
|
chainBgColor?: string;
|
|
6
6
|
tokenBgColor?: string;
|
|
7
7
|
tokenTextColor?: string;
|
|
8
|
+
onClick?: () => void;
|
|
8
9
|
}
|
|
9
|
-
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, onClick, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { DetailsToolbarState } from '../../types/components';
|
|
1
|
+
import { BoostMode, DetailsToolbarState } from '../../types/components';
|
|
2
2
|
interface DetailsToolbarProps {
|
|
3
3
|
state?: DetailsToolbarState;
|
|
4
4
|
errorMessage: string;
|
|
5
|
+
boostMode?: BoostMode;
|
|
6
|
+
onToggleBoostMode?: ({ boostMode }: {
|
|
7
|
+
boostMode: BoostMode;
|
|
8
|
+
}) => void;
|
|
5
9
|
}
|
|
6
|
-
export declare function DetailsToolbar({ state, errorMessage, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SwapDirection } from '../../types/components';
|
|
2
3
|
interface SwapConfigurationProps {
|
|
3
4
|
direction: SwapDirection;
|
|
4
|
-
priceImpactPercentage?:
|
|
5
|
-
amount?:
|
|
6
|
-
swapAmountUsd?:
|
|
5
|
+
priceImpactPercentage?: string;
|
|
6
|
+
amount?: string;
|
|
7
|
+
swapAmountUsd?: string;
|
|
7
8
|
balance?: string;
|
|
8
9
|
isFetching?: boolean;
|
|
9
10
|
chain?: {
|
|
@@ -16,6 +17,10 @@ interface SwapConfigurationProps {
|
|
|
16
17
|
bgColor: string;
|
|
17
18
|
textColor: string;
|
|
18
19
|
};
|
|
20
|
+
address?: string;
|
|
21
|
+
onAmountChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
22
|
+
onWalletButtonClick?: () => void;
|
|
23
|
+
onAssetsButtonClick?: () => void;
|
|
19
24
|
}
|
|
20
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd, balance, isFetching, chain, token, direction, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
21
26
|
export {};
|
|
@@ -14,10 +14,5 @@ export type SwapStep = {
|
|
|
14
14
|
chipContent: React.ReactNode;
|
|
15
15
|
routeStepOrder: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
FULL = 0,
|
|
19
|
-
LOADING = 1,
|
|
20
|
-
EMPTY = 2,
|
|
21
|
-
ERROR = 3
|
|
22
|
-
}
|
|
17
|
+
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
23
18
|
export type ThemeType = 'light' | 'dark';
|
package/dist/esm/index.js
CHANGED
|
@@ -2760,7 +2760,7 @@ const themeTypesKeys = {
|
|
|
2760
2760
|
|
|
2761
2761
|
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2762
2762
|
const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
|
|
2763
|
-
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, }) {
|
|
2763
|
+
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, onClick, }) {
|
|
2764
2764
|
const bgGradient = useMemo(() => {
|
|
2765
2765
|
if (!chainImageUrl) {
|
|
2766
2766
|
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
@@ -2770,11 +2770,11 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2770
2770
|
}
|
|
2771
2771
|
return `linear-gradient(to right, ${chainBgColor} 47.5%, ${tokenBgColor} 52.5%)`;
|
|
2772
2772
|
}, [chainBgColor, tokenBgColor]);
|
|
2773
|
-
return (jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2773
|
+
return (jsxs("div", { onClick: onClick, className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2774
2774
|
backgroundImage: bgGradient,
|
|
2775
2775
|
}, children: jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsx("img", { src: chainImageUrl, alt: "" })) : (jsx(Fragment, { children: jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
|
|
2776
2776
|
backgroundColor: tokenBgColor,
|
|
2777
|
-
}, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-
|
|
2777
|
+
}, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px]" }) })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2778
2778
|
backgroundColor: tokenBgColor,
|
|
2779
2779
|
color: tokenTextColor,
|
|
2780
2780
|
}, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, {})] })] }));
|
|
@@ -2853,7 +2853,7 @@ function EthereumIcon() {
|
|
|
2853
2853
|
}
|
|
2854
2854
|
|
|
2855
2855
|
function FeeButton() {
|
|
2856
|
-
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2856
|
+
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(Chip, { label: "Fee" }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: '560' })] })] }));
|
|
2857
2857
|
}
|
|
2858
2858
|
|
|
2859
2859
|
// font size, line height, and letter spacing classes
|
|
@@ -2945,27 +2945,19 @@ function Boost({ boostMode, onToggleBoostMode }) {
|
|
|
2945
2945
|
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-bg-grey-900 tw-pr-squid-xxs", children: [jsx(BoostButton, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }), jsx(Chip, { label: boostMode === 'normal' ? '10m' : '20s', className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
|
|
2946
2946
|
}
|
|
2947
2947
|
|
|
2948
|
-
var DetailsToolbarState;
|
|
2949
|
-
(function (DetailsToolbarState) {
|
|
2950
|
-
DetailsToolbarState[DetailsToolbarState["FULL"] = 0] = "FULL";
|
|
2951
|
-
DetailsToolbarState[DetailsToolbarState["LOADING"] = 1] = "LOADING";
|
|
2952
|
-
DetailsToolbarState[DetailsToolbarState["EMPTY"] = 2] = "EMPTY";
|
|
2953
|
-
DetailsToolbarState[DetailsToolbarState["ERROR"] = 3] = "ERROR";
|
|
2954
|
-
})(DetailsToolbarState || (DetailsToolbarState = {}));
|
|
2955
|
-
|
|
2956
2948
|
function EmojiSadIcon() {
|
|
2957
2949
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM13.5341 12.4645C11.5815 10.5118 8.41568 10.5118 6.46306 12.4645C6.07254 12.855 6.07254 13.4882 6.46306 13.8787C6.85358 14.2692 7.48675 14.2692 7.87727 13.8787C9.04885 12.7071 10.9483 12.7071 12.1199 13.8787C12.5104 14.2692 13.1436 14.2692 13.5341 13.8787C13.9247 13.4882 13.9247 12.855 13.5341 12.4645ZM8.5 7.5C8.5 8.32843 7.94036 9 7.25 9C6.55964 9 6 8.32843 6 7.5C6 6.67157 6.55964 6 7.25 6C7.94036 6 8.5 6.67157 8.5 7.5ZM12.75 9C13.4404 9 14 8.32843 14 7.5C14 6.67157 13.4404 6 12.75 6C12.0596 6 11.5 6.67157 11.5 7.5C11.5 8.32843 12.0596 9 12.75 9Z", fill: "currentColor" }) }));
|
|
2958
2950
|
}
|
|
2959
2951
|
|
|
2960
2952
|
const detailStateClassMap = {
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2953
|
+
loading: 'tw-opacity-33 tw-pointer-events-none',
|
|
2954
|
+
empty: 'tw-pointer-events-none tw-hidden',
|
|
2955
|
+
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
2956
|
+
full: '',
|
|
2965
2957
|
};
|
|
2966
|
-
function DetailsToolbar({ state =
|
|
2958
|
+
function DetailsToolbar({ state = 'full', errorMessage, boostMode = 'normal', onToggleBoostMode, }) {
|
|
2967
2959
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
2968
|
-
return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state ===
|
|
2960
|
+
return (jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === 'error' ? (jsx(ErrorMessage, { message: errorMessage })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, {}) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }) })] })) }));
|
|
2969
2961
|
}
|
|
2970
2962
|
const ErrorMessage = ({ message }) => {
|
|
2971
2963
|
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsx(EmojiSadIcon, {}), jsx(CaptionText, { children: message })] }));
|
|
@@ -3001,11 +2993,12 @@ function WalletAddress({ address, ens }) {
|
|
|
3001
2993
|
return (jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", children: ens ? ens : (address === null || address === void 0 ? void 0 : address.slice(0, 6)) + '...' + (address === null || address === void 0 ? void 0 : address.slice(-4)) }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronArrowIcon, {}) })] }));
|
|
3002
2994
|
}
|
|
3003
2995
|
|
|
3004
|
-
function SwapConfiguration({ priceImpactPercentage, amount = 0, swapAmountUsd = 0, balance = '0', isFetching = false, chain, token, direction, }) {
|
|
3005
|
-
|
|
2996
|
+
function SwapConfiguration({ priceImpactPercentage, amount = '0', swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, }) {
|
|
2997
|
+
var _a;
|
|
2998
|
+
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > 5
|
|
3006
2999
|
? 'tw-text-status-negative'
|
|
3007
3000
|
: 'tw-text-grey-300';
|
|
3008
|
-
return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxs("
|
|
3001
|
+
return (jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsx(WalletAddress, { ens: address })] }) }), jsx("div", { className: "tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), jsx("div", { className: "tw-px-squid-m", children: jsx("input", { className: "tw-my-squid-xs tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-royal-400 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-outline-none", placeholder: "0", value: amount, onChange: onAmountChange }) }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(SwapInputsIcon, {}), jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsx(CaptionText, { children: balance }), jsx(MaxIcon, {})] })] }))] }));
|
|
3009
3002
|
}
|
|
3010
3003
|
|
|
3011
3004
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -5,6 +5,7 @@ interface AssetsButtonProps {
|
|
|
5
5
|
chainBgColor?: string;
|
|
6
6
|
tokenBgColor?: string;
|
|
7
7
|
tokenTextColor?: string;
|
|
8
|
+
onClick?: () => void;
|
|
8
9
|
}
|
|
9
|
-
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, onClick, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { DetailsToolbarState } from '../../types/components';
|
|
1
|
+
import { BoostMode, DetailsToolbarState } from '../../types/components';
|
|
2
2
|
interface DetailsToolbarProps {
|
|
3
3
|
state?: DetailsToolbarState;
|
|
4
4
|
errorMessage: string;
|
|
5
|
+
boostMode?: BoostMode;
|
|
6
|
+
onToggleBoostMode?: ({ boostMode }: {
|
|
7
|
+
boostMode: BoostMode;
|
|
8
|
+
}) => void;
|
|
5
9
|
}
|
|
6
|
-
export declare function DetailsToolbar({ state, errorMessage, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SwapDirection } from '../../types/components';
|
|
2
3
|
interface SwapConfigurationProps {
|
|
3
4
|
direction: SwapDirection;
|
|
4
|
-
priceImpactPercentage?:
|
|
5
|
-
amount?:
|
|
6
|
-
swapAmountUsd?:
|
|
5
|
+
priceImpactPercentage?: string;
|
|
6
|
+
amount?: string;
|
|
7
|
+
swapAmountUsd?: string;
|
|
7
8
|
balance?: string;
|
|
8
9
|
isFetching?: boolean;
|
|
9
10
|
chain?: {
|
|
@@ -16,6 +17,10 @@ interface SwapConfigurationProps {
|
|
|
16
17
|
bgColor: string;
|
|
17
18
|
textColor: string;
|
|
18
19
|
};
|
|
20
|
+
address?: string;
|
|
21
|
+
onAmountChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
22
|
+
onWalletButtonClick?: () => void;
|
|
23
|
+
onAssetsButtonClick?: () => void;
|
|
19
24
|
}
|
|
20
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd, balance, isFetching, chain, token, direction, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
21
26
|
export {};
|
|
@@ -14,10 +14,5 @@ export type SwapStep = {
|
|
|
14
14
|
chipContent: React.ReactNode;
|
|
15
15
|
routeStepOrder: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
FULL = 0,
|
|
19
|
-
LOADING = 1,
|
|
20
|
-
EMPTY = 2,
|
|
21
|
-
ERROR = 3
|
|
22
|
-
}
|
|
17
|
+
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
23
18
|
export type ThemeType = 'light' | 'dark';
|
|
Binary file
|
|
Binary file
|
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type BadgeSize = 'sm' | 'md';
|
|
|
13
13
|
declare function BadgeImage({ imageUrl, badgeUrl, size, extraMarginForBadge, rounded, }: BadgeImageProps): react_jsx_runtime.JSX.Element | null;
|
|
14
14
|
|
|
15
15
|
interface UsdAmountProps {
|
|
16
|
-
usdAmount:
|
|
16
|
+
usdAmount: string;
|
|
17
17
|
}
|
|
18
18
|
declare function UsdAmount({ usdAmount }: UsdAmountProps): react_jsx_runtime.JSX.Element;
|
|
19
19
|
|
|
@@ -38,8 +38,9 @@ interface AssetsButtonProps {
|
|
|
38
38
|
chainBgColor?: string;
|
|
39
39
|
tokenBgColor?: string;
|
|
40
40
|
tokenTextColor?: string;
|
|
41
|
+
onClick?: () => void;
|
|
41
42
|
}
|
|
42
|
-
declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, }: AssetsButtonProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, onClick, }: AssetsButtonProps): react_jsx_runtime.JSX.Element;
|
|
43
44
|
|
|
44
45
|
type TextSize = 'small' | 'medium' | 'large';
|
|
45
46
|
type SwitchSize = 'small' | 'large';
|
|
@@ -56,12 +57,7 @@ type SwapStep = {
|
|
|
56
57
|
chipContent: React.ReactNode;
|
|
57
58
|
routeStepOrder: number;
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
-
FULL = 0,
|
|
61
|
-
LOADING = 1,
|
|
62
|
-
EMPTY = 2,
|
|
63
|
-
ERROR = 3
|
|
64
|
-
}
|
|
60
|
+
type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
65
61
|
type ThemeType = 'light' | 'dark';
|
|
66
62
|
|
|
67
63
|
interface BoostButtonProps {
|
|
@@ -139,8 +135,12 @@ declare function Boost({ boostMode, onToggleBoostMode }: BoostProps): react_jsx_
|
|
|
139
135
|
interface DetailsToolbarProps {
|
|
140
136
|
state?: DetailsToolbarState;
|
|
141
137
|
errorMessage: string;
|
|
138
|
+
boostMode?: BoostMode;
|
|
139
|
+
onToggleBoostMode?: ({ boostMode }: {
|
|
140
|
+
boostMode: BoostMode;
|
|
141
|
+
}) => void;
|
|
142
142
|
}
|
|
143
|
-
declare function DetailsToolbar({ state, errorMessage, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
143
|
+
declare function DetailsToolbar({ state, errorMessage, boostMode, onToggleBoostMode, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
144
144
|
|
|
145
145
|
type Rounded = 'sm' | 'lg';
|
|
146
146
|
interface MenuProps extends React$1.ComponentProps<'div'> {
|
|
@@ -173,9 +173,9 @@ declare function ProductCard({ children }: ProductCardProps): react_jsx_runtime.
|
|
|
173
173
|
|
|
174
174
|
interface SwapConfigurationProps {
|
|
175
175
|
direction: SwapDirection;
|
|
176
|
-
priceImpactPercentage?:
|
|
177
|
-
amount?:
|
|
178
|
-
swapAmountUsd?:
|
|
176
|
+
priceImpactPercentage?: string;
|
|
177
|
+
amount?: string;
|
|
178
|
+
swapAmountUsd?: string;
|
|
179
179
|
balance?: string;
|
|
180
180
|
isFetching?: boolean;
|
|
181
181
|
chain?: {
|
|
@@ -188,8 +188,12 @@ interface SwapConfigurationProps {
|
|
|
188
188
|
bgColor: string;
|
|
189
189
|
textColor: string;
|
|
190
190
|
};
|
|
191
|
+
address?: string;
|
|
192
|
+
onAmountChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
193
|
+
onWalletButtonClick?: () => void;
|
|
194
|
+
onAssetsButtonClick?: () => void;
|
|
191
195
|
}
|
|
192
|
-
declare function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd, balance, isFetching, chain, token, direction, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare function SwapConfiguration({ priceImpactPercentage, amount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
193
197
|
|
|
194
198
|
interface SwapProgressViewHeaderProps {
|
|
195
199
|
title: string;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/0xsquid/squid-ui.git"
|
|
6
6
|
},
|
|
7
7
|
"description": "Squid's UI components",
|
|
8
|
-
"version": "0.4.
|
|
8
|
+
"version": "0.4.2",
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"scripts": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"release:pre": "release-it --preRelease=beta",
|
|
21
21
|
"release:ci": "release-it --ci",
|
|
22
22
|
"release:dry": "release-it --dry-run",
|
|
23
|
-
"build": "yarn build-tailwind && rollup -c && cp src/styles/compiled-tailwind.css dist/index.css"
|
|
23
|
+
"build": "yarn build-tailwind && rollup -c && cp src/styles/compiled-tailwind.css dist/index.css && yarn copy-fonts",
|
|
24
|
+
"copy-fonts": "cp -r src/styles/fonts dist/fonts"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"clsx": "2.1.0",
|
|
@@ -53,8 +54,8 @@
|
|
|
53
54
|
"@storybook/react-webpack5": "^8.0.1",
|
|
54
55
|
"@storybook/test": "^8.0.1",
|
|
55
56
|
"@types/color": "^3.0.6",
|
|
56
|
-
"@types/react": "^18
|
|
57
|
-
"@types/react-dom": "^18
|
|
57
|
+
"@types/react": "^18",
|
|
58
|
+
"@types/react-dom": "^18",
|
|
58
59
|
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
59
60
|
"autoprefixer": "10.4.18",
|
|
60
61
|
"concurrently": "8.2.2",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
}
|
|
102
103
|
},
|
|
103
104
|
"peerDependencies": {
|
|
104
|
-
"react": "^18.
|
|
105
|
-
"react-dom": "^18.
|
|
105
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
106
|
+
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
106
107
|
}
|
|
107
108
|
}
|