@0xsquid/ui 0.15.5 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +90 -28
- package/dist/cjs/types/components/buttons/AssetsButton.d.ts +3 -1
- package/dist/cjs/types/components/controls/Input.d.ts +8 -3
- package/dist/cjs/types/components/controls/SettingsSlider.d.ts +3 -3
- package/dist/cjs/types/components/lists/HistoryItem.d.ts +1 -1
- package/dist/cjs/types/stories/buttons/AssetsButton.stories.d.ts +2 -1
- package/dist/cjs/types/stories/controls/Input.stories.d.ts +1 -1
- package/dist/cjs/types/stories/controls/SettingsSlider.stories.d.ts +4 -0
- package/dist/cjs/types/types/components.d.ts +1 -0
- package/dist/cjs/types/types/index.d.ts +1 -1
- package/dist/esm/index.js +90 -28
- package/dist/esm/types/components/buttons/AssetsButton.d.ts +3 -1
- package/dist/esm/types/components/controls/Input.d.ts +8 -3
- package/dist/esm/types/components/controls/SettingsSlider.d.ts +3 -3
- package/dist/esm/types/components/lists/HistoryItem.d.ts +1 -1
- package/dist/esm/types/stories/buttons/AssetsButton.stories.d.ts +2 -1
- package/dist/esm/types/stories/controls/Input.stories.d.ts +1 -1
- package/dist/esm/types/stories/controls/SettingsSlider.stories.d.ts +4 -0
- package/dist/esm/types/types/components.d.ts +1 -0
- package/dist/esm/types/types/index.d.ts +1 -1
- package/dist/index.css +39 -62
- package/dist/index.d.ts +15 -9
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2588,7 +2588,7 @@ function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, roun
|
|
|
2588
2588
|
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { badgeLoaded: true })));
|
|
2589
2589
|
}, className: cn(badgeImageClassName,
|
|
2590
2590
|
// hide badge image while it is loading, and display it when it is loaded
|
|
2591
|
-
imagesLoadState.
|
|
2591
|
+
imagesLoadState.badgeLoaded ? 'tw-block' : 'tw-hidden') })] })) : null] })) : null;
|
|
2592
2592
|
}
|
|
2593
2593
|
|
|
2594
2594
|
function LoadingSkeleton({ className, height = '20', }) {
|
|
@@ -2845,8 +2845,22 @@ function PlusIcon() {
|
|
|
2845
2845
|
}
|
|
2846
2846
|
|
|
2847
2847
|
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2848
|
-
const
|
|
2849
|
-
|
|
2848
|
+
const themeKeyVariantMap = {
|
|
2849
|
+
primary: 'grey-800',
|
|
2850
|
+
accent: 'royal-500',
|
|
2851
|
+
};
|
|
2852
|
+
const buttonTextClassNameMap = {
|
|
2853
|
+
primary: 'tw-text-grey-300',
|
|
2854
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
2855
|
+
};
|
|
2856
|
+
const emptyChainIconTextClassNameMap = {
|
|
2857
|
+
primary: 'tw-text-grey-100',
|
|
2858
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
2859
|
+
};
|
|
2860
|
+
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor: _chainBgColor, tokenBgColor: _tokenBgColor, tokenTextColor, onClick, variant = 'primary', }) {
|
|
2861
|
+
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
2862
|
+
const chainBgColor = _chainBgColor !== null && _chainBgColor !== void 0 ? _chainBgColor : defaultBgColor;
|
|
2863
|
+
const tokenBgColor = _tokenBgColor !== null && _tokenBgColor !== void 0 ? _tokenBgColor : defaultBgColor;
|
|
2850
2864
|
const bgGradient = React.useMemo(() => {
|
|
2851
2865
|
if (!chainImageUrl) {
|
|
2852
2866
|
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
@@ -2856,9 +2870,9 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2856
2870
|
}
|
|
2857
2871
|
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
2858
2872
|
}, [chainBgColor, tokenBgColor]);
|
|
2859
|
-
return (jsxRuntime.jsxs("button", { onClick: onClick, className:
|
|
2873
|
+
return (jsxRuntime.jsxs("button", { onClick: onClick, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant]), children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-cursor-pointer tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-cursor-pointer tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2860
2874
|
backgroundImage: bgGradient,
|
|
2861
|
-
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsxRuntime.jsx("img", { src: chainImageUrl, alt: "", className: "tw-rounded-full" })) : (jsxRuntime.jsx(
|
|
2875
|
+
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsxRuntime.jsx("img", { src: chainImageUrl, alt: "", className: "tw-rounded-full" })) : (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsxRuntime.jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-cursor-pointer tw-overflow-hidden'), children: [jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
2862
2876
|
backgroundColor: tokenBgColor,
|
|
2863
2877
|
} }), jsxRuntime.jsx("img", { src: tokenImageUrl, alt: tokenSymbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2864
2878
|
backgroundColor: tokenBgColor,
|
|
@@ -2904,11 +2918,12 @@ function SearchIcon() {
|
|
|
2904
2918
|
}
|
|
2905
2919
|
|
|
2906
2920
|
function Input(_a) {
|
|
2907
|
-
var { placeholder = 'Search', showIcon = true,
|
|
2908
|
-
|
|
2921
|
+
var { placeholder = 'Search', showIcon = true, className, icon, isError = false, containerClassName, actionButtonProps } = _a, props = __rest(_a, ["placeholder", "showIcon", "className", "icon", "isError", "containerClassName", "actionButtonProps"]);
|
|
2922
|
+
const showActionButton = !!actionButtonProps;
|
|
2923
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative tw-w-full tw-text-grey-600', containerClassName), children: [jsxRuntime.jsx("input", Object.assign({}, props, { "aria-invalid": isError, className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-typography-regular tw-text-grey-300 placeholder:tw-text-grey-600 invalid:tw-outline-status-negative', showIcon ? 'tw-pl-[40px]' : 'tw-px-2.5', showActionButton ? 'tw-pr-[70px]' : 'tw-pr-2.5', isError && '!tw-outline-status-negative', className), placeholder: placeholder })), showIcon ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsxRuntime.jsx(SearchIcon, {}) })) : null, showActionButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(InputActionButton, Object.assign({}, actionButtonProps)) })) : null] }));
|
|
2909
2924
|
}
|
|
2910
|
-
const
|
|
2911
|
-
return (jsxRuntime.jsx(Button, { size: "md", variant:
|
|
2925
|
+
const InputActionButton = ({ onClick, variant = 'tertiary', label = 'Paste', }) => {
|
|
2926
|
+
return (jsxRuntime.jsx(Button, { size: "md", variant: variant, onClick: onClick, className: "!tw-h-[30px] !tw-w-fit !tw-min-w-0", children: jsxRuntime.jsx(CaptionText, { children: label }) }));
|
|
2912
2927
|
};
|
|
2913
2928
|
|
|
2914
2929
|
/*
|
|
@@ -6502,7 +6517,7 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
6502
6517
|
return 'full';
|
|
6503
6518
|
}, [errorMessage, isLoading, isEmpty]);
|
|
6504
6519
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
6505
|
-
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-
|
|
6520
|
+
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-card tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin 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(Tooltip, { tooltipContent: isFlipButtonDisabled ? flipButtonDisabledMessage : undefined, tooltipWidth: "max", children: jsxRuntime.jsx("button", { disabled: isFlipButtonDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsxRuntime.jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !isFlipButtonDisabled &&
|
|
6506
6521
|
'group-hover/flip-button:tw-rotate-180') }) }) })) }), 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 }) })] })) }));
|
|
6507
6522
|
}
|
|
6508
6523
|
|
|
@@ -6670,7 +6685,7 @@ function ListItem(_a) {
|
|
|
6670
6685
|
return (jsxRuntime.jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isSelected && 'tw-bg-material-light-thin', isInteractive && 'hover: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-xxs',
|
|
6671
6686
|
// 'large' variant has extra padding
|
|
6672
6687
|
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-max-w-full tw-truncate', subtitle && 'tw-h-[17px] !tw-leading-[17px]'), children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
6673
|
-
((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.jsxs(CaptionText, { className: subtitleClassName, children: [jsxRuntime.jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover }), subtitle] })) : null)] }), showDetail && (jsxRuntime.jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
6688
|
+
((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.jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsxRuntime.jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxRuntime.jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
6674
6689
|
? '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'
|
|
6675
6690
|
: 'tw-flex', isDetailInteractive && 'hover:tw-bg-material-light-thin', 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] })))] })) })));
|
|
6676
6691
|
}
|
|
@@ -6858,7 +6873,7 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
|
|
|
6858
6873
|
}
|
|
6859
6874
|
|
|
6860
6875
|
function ProductCard({ children }) {
|
|
6861
|
-
return (jsxRuntime.jsx("div", { className: "
|
|
6876
|
+
return (jsxRuntime.jsx("div", { className: "group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-3 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-3 tw-relative tw-flex tw-h-card tw-min-h-card tw-w-card tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300 tw-outline tw-outline-1 tw-outline-material-light-thin", children: children }));
|
|
6862
6877
|
}
|
|
6863
6878
|
function BorderedContainer({ children, className, }) {
|
|
6864
6879
|
return (jsxRuntime.jsx("section", { className: cn('tw-border-t tw-border-t-material-light-thin', className), children: children }));
|
|
@@ -6882,7 +6897,7 @@ function LogoContainer({ children }) {
|
|
|
6882
6897
|
|
|
6883
6898
|
function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, }) {
|
|
6884
6899
|
var _a, _b;
|
|
6885
|
-
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-
|
|
6900
|
+
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-card tw-overflow-hidden tw-border-t tw-border-t-material-light-thin 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 }) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-l tw-z-10 tw-overflow-hidden", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
|
|
6886
6901
|
decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
|
|
6887
6902
|
symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
|
|
6888
6903
|
price: tokenPrice,
|
|
@@ -7140,18 +7155,65 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
7140
7155
|
: amountFormatted }), ' ', jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: cn('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(buttonClassName, isInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsxs(CaptionText, { children: [balanceFormatted, " ", token.symbol] }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
7141
7156
|
}
|
|
7142
7157
|
|
|
7143
|
-
function SettingsSlider({ value, type, onChange,
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7158
|
+
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, }) {
|
|
7159
|
+
const [isInputVisible, setIsInputVisible] = React.useState(false);
|
|
7160
|
+
const [inputValue, setInputValue] = React.useState(String(value !== null && value !== void 0 ? value : 0));
|
|
7161
|
+
React.useEffect(() => {
|
|
7162
|
+
if (!isInputVisible)
|
|
7163
|
+
return;
|
|
7164
|
+
const handleOutsideClick = (event) => {
|
|
7165
|
+
var _a;
|
|
7166
|
+
const clickedElementIsDifferentThanMenu = event.target !== menuRef.current;
|
|
7167
|
+
const clickedElementIsDifferentThanSlider = event.target !== sliderRef.current;
|
|
7168
|
+
const sliderContainsClickedElement = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
7169
|
+
const hideInput = clickedElementIsDifferentThanMenu &&
|
|
7170
|
+
(!clickedElementIsDifferentThanSlider || !sliderContainsClickedElement);
|
|
7171
|
+
if (hideInput) {
|
|
7172
|
+
handleCloseInput();
|
|
7173
|
+
}
|
|
7174
|
+
};
|
|
7175
|
+
document.addEventListener('click', handleOutsideClick);
|
|
7176
|
+
return () => {
|
|
7177
|
+
document.removeEventListener('click', handleOutsideClick);
|
|
7178
|
+
};
|
|
7179
|
+
}, [isInputVisible]);
|
|
7180
|
+
const menuRef = React.useRef(null);
|
|
7181
|
+
const sliderRef = React.useRef(null);
|
|
7182
|
+
const handleSubmit = React.useCallback((value) => {
|
|
7183
|
+
handleCloseInput();
|
|
7184
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value === '' ? undefined : Number(value));
|
|
7185
|
+
}, [onChange]);
|
|
7186
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
7187
|
+
// block unwanted (but still valid) characters
|
|
7188
|
+
if (['e', 'E', '+', '-'].includes(e.key))
|
|
7189
|
+
return e.preventDefault();
|
|
7190
|
+
// close input when pressing escape
|
|
7191
|
+
if (e.key === 'Escape')
|
|
7192
|
+
return handleCloseInput();
|
|
7193
|
+
}, []);
|
|
7194
|
+
const handleOpenInput = React.useCallback(() => {
|
|
7195
|
+
setIsInputVisible(true);
|
|
7196
|
+
}, []);
|
|
7197
|
+
const handleCloseInput = React.useCallback(() => {
|
|
7198
|
+
setIsInputVisible(false);
|
|
7199
|
+
}, []);
|
|
7200
|
+
return (jsxRuntime.jsxs("div", { ref: sliderRef, className: "tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsxRuntime.jsxs("button", { className: cn('tw-relative tw-flex tw-h-[32px] tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-p-squid-xs tw-pr-[40px] tw-text-left tw-text-caption !tw-font-medium tw-leading-[10px] placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', value === 0 || value === undefined
|
|
7201
|
+
? 'tw-text-grey-600'
|
|
7202
|
+
: 'tw-text-grey-300', isInputVisible ? 'tw-bg-material-light-thin' : 'tw-bg-transparent'), children: [value !== null && value !== void 0 ? value : 0, jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: type === 'percentage' ? '%' : '$' })] }), jsxRuntime.jsx("button", { onClick: handleOpenInput, className: "tw-absolute tw-right-squid-xs tw-flex tw-h-[26px] tw-w-[26px] tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-xxs !tw-font-medium tw-leading-[10px] hover:tw-bg-material-light-thin", children: jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) }), isInputVisible && (jsxRuntime.jsx(Menu, { menuRef: menuRef, containerClassName: "tw-absolute tw-bottom-full tw-z-10 tw-pb-squid-m tw-w-[160px]", children: jsxRuntime.jsx("form", { onSubmit: (e) => {
|
|
7203
|
+
e.preventDefault();
|
|
7204
|
+
handleSubmit(inputValue);
|
|
7205
|
+
}, children: jsxRuntime.jsx(Input, { autoFocus: true, min: min, max: max, onKeyDown: handleKeyDown, step: decimalsFormat, placeholder: "0", type: "number", defaultValue: value, value: inputValue, onChange: (e) => {
|
|
7206
|
+
const isValid = e.target.checkValidity();
|
|
7207
|
+
if (!isValid)
|
|
7208
|
+
return;
|
|
7209
|
+
setInputValue(e.target.value);
|
|
7210
|
+
}, showIcon: false, actionButtonProps: {
|
|
7211
|
+
label: 'Ok',
|
|
7212
|
+
onClick: () => {
|
|
7213
|
+
handleSubmit(inputValue);
|
|
7214
|
+
},
|
|
7215
|
+
variant: 'primary',
|
|
7216
|
+
} }) }) }))] }));
|
|
7155
7217
|
}
|
|
7156
7218
|
|
|
7157
7219
|
const switchSizeClassMap = {
|
|
@@ -42409,8 +42471,8 @@ const lightTheme = {
|
|
|
42409
42471
|
// content
|
|
42410
42472
|
'content-100': '#17191C',
|
|
42411
42473
|
'content-200': '#292C32',
|
|
42412
|
-
'content-300': '#
|
|
42413
|
-
'content-400': '#
|
|
42474
|
+
'content-300': '#292C32',
|
|
42475
|
+
'content-400': '#676B7E',
|
|
42414
42476
|
'content-500': '#8A8FA8',
|
|
42415
42477
|
'content-600': '#A7ABBE',
|
|
42416
42478
|
'content-700': '#D1D6E0',
|
|
@@ -42420,7 +42482,7 @@ const lightTheme = {
|
|
|
42420
42482
|
'accent-400': '#9E79D2',
|
|
42421
42483
|
'accent-500': '#B893EC',
|
|
42422
42484
|
// status
|
|
42423
|
-
'status-positive': '#
|
|
42485
|
+
'status-positive': '#17CF26',
|
|
42424
42486
|
'status-negative': '#FF5B4D',
|
|
42425
42487
|
'status-warning': '#EC9213',
|
|
42426
42488
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type AssetsButtonVariant = 'primary' | 'accent';
|
|
1
2
|
interface AssetsButtonProps {
|
|
2
3
|
tokenImageUrl?: string;
|
|
3
4
|
chainImageUrl?: string;
|
|
@@ -6,6 +7,7 @@ interface AssetsButtonProps {
|
|
|
6
7
|
tokenBgColor?: string;
|
|
7
8
|
tokenTextColor?: string;
|
|
8
9
|
onClick?: () => void;
|
|
10
|
+
variant?: AssetsButtonVariant;
|
|
9
11
|
}
|
|
10
|
-
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, onClick, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor: _chainBgColor, tokenBgColor: _tokenBgColor, tokenTextColor, onClick, variant, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonVariant } from '../../types/components';
|
|
2
3
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
showIcon?: boolean;
|
|
5
|
-
showPasteButton?: boolean;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
isError?: boolean;
|
|
8
|
-
onPasteButtonClick?: () => void;
|
|
9
8
|
containerClassName?: string;
|
|
9
|
+
actionButtonProps?: InputActionButtonProps;
|
|
10
10
|
}
|
|
11
|
-
export declare function Input({ placeholder, showIcon,
|
|
11
|
+
export declare function Input({ placeholder, showIcon, className, icon, isError, containerClassName, actionButtonProps, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
type InputActionButtonProps = {
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
label?: string;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface SettingsSliderProps {
|
|
2
2
|
value: number;
|
|
3
3
|
type: 'percentage' | 'amount';
|
|
4
|
-
onChange?: (value: number) => void;
|
|
5
|
-
|
|
4
|
+
onChange?: (value: number | undefined) => void;
|
|
5
|
+
decimalsFormat?: number;
|
|
6
6
|
min?: number;
|
|
7
7
|
max?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare function SettingsSlider({ value, type, onChange,
|
|
9
|
+
export declare function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownMenuItemProps } from './DropdownMenuItem';
|
|
3
|
-
|
|
3
|
+
import { HistoryItemStatus } from '../../types/components';
|
|
4
4
|
interface HistoryItemProps {
|
|
5
5
|
firstImageUrl: string;
|
|
6
6
|
secondImageUrl: string;
|
|
@@ -3,7 +3,8 @@ import { AssetsButton } from '../../components/buttons/AssetsButton';
|
|
|
3
3
|
declare const meta: Meta<typeof AssetsButton>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const PrimaryVariantEmpty: Story;
|
|
7
|
+
export declare const AccentVariantEmpty: Story;
|
|
7
8
|
export declare const ChainOnly: Story;
|
|
8
9
|
export declare const ChainAndTokenLightText: Story;
|
|
9
10
|
export declare const ChainAndTokenDarkText: Story;
|
|
@@ -5,5 +5,5 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const WithoutIcon: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const WithActionButton: Story;
|
|
9
9
|
export declare const Error: Story;
|
|
@@ -5,3 +5,7 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Percentage: Story;
|
|
7
7
|
export declare const Amount: Story;
|
|
8
|
+
export declare const PercentageWith1DecimalPlaceAllowed: Story;
|
|
9
|
+
export declare const AmountWith2DecimalPlacesAllowed: Story;
|
|
10
|
+
export declare const PercentageMax50: Story;
|
|
11
|
+
export declare const AmountMax999: Story;
|
|
@@ -4,6 +4,7 @@ export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
|
4
4
|
export type ButtonSize = 'md' | 'lg';
|
|
5
5
|
export type SwapDirection = 'from' | 'to';
|
|
6
6
|
export type BoostMode = 'normal' | 'boost';
|
|
7
|
+
export type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
7
8
|
export type SwapStepDescriptionBlock = {
|
|
8
9
|
type: 'string';
|
|
9
10
|
value: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { SquidTheme } from './config';
|
|
2
|
-
export type { SwapState, ThemeType, SwapStep, SwapStepItemStatus, } from './components';
|
|
2
|
+
export type { SwapState, ThemeType, SwapStep, SwapStepItemStatus, HistoryItemStatus, } from './components';
|
package/dist/esm/index.js
CHANGED
|
@@ -2568,7 +2568,7 @@ function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, roun
|
|
|
2568
2568
|
setImageLoadState((prevState) => (Object.assign(Object.assign({}, prevState), { badgeLoaded: true })));
|
|
2569
2569
|
}, className: cn(badgeImageClassName,
|
|
2570
2570
|
// hide badge image while it is loading, and display it when it is loaded
|
|
2571
|
-
imagesLoadState.
|
|
2571
|
+
imagesLoadState.badgeLoaded ? 'tw-block' : 'tw-hidden') })] })) : null] })) : null;
|
|
2572
2572
|
}
|
|
2573
2573
|
|
|
2574
2574
|
function LoadingSkeleton({ className, height = '20', }) {
|
|
@@ -2825,8 +2825,22 @@ function PlusIcon() {
|
|
|
2825
2825
|
}
|
|
2826
2826
|
|
|
2827
2827
|
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2828
|
-
const
|
|
2829
|
-
|
|
2828
|
+
const themeKeyVariantMap = {
|
|
2829
|
+
primary: 'grey-800',
|
|
2830
|
+
accent: 'royal-500',
|
|
2831
|
+
};
|
|
2832
|
+
const buttonTextClassNameMap = {
|
|
2833
|
+
primary: 'tw-text-grey-300',
|
|
2834
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
2835
|
+
};
|
|
2836
|
+
const emptyChainIconTextClassNameMap = {
|
|
2837
|
+
primary: 'tw-text-grey-100',
|
|
2838
|
+
accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
|
|
2839
|
+
};
|
|
2840
|
+
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor: _chainBgColor, tokenBgColor: _tokenBgColor, tokenTextColor, onClick, variant = 'primary', }) {
|
|
2841
|
+
const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
|
|
2842
|
+
const chainBgColor = _chainBgColor !== null && _chainBgColor !== void 0 ? _chainBgColor : defaultBgColor;
|
|
2843
|
+
const tokenBgColor = _tokenBgColor !== null && _tokenBgColor !== void 0 ? _tokenBgColor : defaultBgColor;
|
|
2830
2844
|
const bgGradient = useMemo(() => {
|
|
2831
2845
|
if (!chainImageUrl) {
|
|
2832
2846
|
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
@@ -2836,9 +2850,9 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2836
2850
|
}
|
|
2837
2851
|
return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
|
|
2838
2852
|
}, [chainBgColor, tokenBgColor]);
|
|
2839
|
-
return (jsxs("button", { onClick: onClick, className:
|
|
2853
|
+
return (jsxs("button", { onClick: onClick, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant]), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-cursor-pointer tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-cursor-pointer tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2840
2854
|
backgroundImage: bgGradient,
|
|
2841
|
-
}, children: jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsx("img", { src: chainImageUrl, alt: "", className: "tw-rounded-full" })) : (jsx(
|
|
2855
|
+
}, children: jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsx("img", { src: chainImageUrl, alt: "", className: "tw-rounded-full" })) : (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-cursor-pointer tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
2842
2856
|
backgroundColor: tokenBgColor,
|
|
2843
2857
|
} }), jsx("img", { src: tokenImageUrl, alt: tokenSymbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2844
2858
|
backgroundColor: tokenBgColor,
|
|
@@ -2884,11 +2898,12 @@ function SearchIcon() {
|
|
|
2884
2898
|
}
|
|
2885
2899
|
|
|
2886
2900
|
function Input(_a) {
|
|
2887
|
-
var { placeholder = 'Search', showIcon = true,
|
|
2888
|
-
|
|
2901
|
+
var { placeholder = 'Search', showIcon = true, className, icon, isError = false, containerClassName, actionButtonProps } = _a, props = __rest(_a, ["placeholder", "showIcon", "className", "icon", "isError", "containerClassName", "actionButtonProps"]);
|
|
2902
|
+
const showActionButton = !!actionButtonProps;
|
|
2903
|
+
return (jsxs("div", { className: cn('tw-relative tw-w-full tw-text-grey-600', containerClassName), children: [jsx("input", Object.assign({}, props, { "aria-invalid": isError, className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-typography-regular tw-text-grey-300 placeholder:tw-text-grey-600 invalid:tw-outline-status-negative', showIcon ? 'tw-pl-[40px]' : 'tw-px-2.5', showActionButton ? 'tw-pr-[70px]' : 'tw-pr-2.5', isError && '!tw-outline-status-negative', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showActionButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(InputActionButton, Object.assign({}, actionButtonProps)) })) : null] }));
|
|
2889
2904
|
}
|
|
2890
|
-
const
|
|
2891
|
-
return (jsx(Button, { size: "md", variant:
|
|
2905
|
+
const InputActionButton = ({ onClick, variant = 'tertiary', label = 'Paste', }) => {
|
|
2906
|
+
return (jsx(Button, { size: "md", variant: variant, onClick: onClick, className: "!tw-h-[30px] !tw-w-fit !tw-min-w-0", children: jsx(CaptionText, { children: label }) }));
|
|
2892
2907
|
};
|
|
2893
2908
|
|
|
2894
2909
|
/*
|
|
@@ -6482,7 +6497,7 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
6482
6497
|
return 'full';
|
|
6483
6498
|
}, [errorMessage, isLoading, isEmpty]);
|
|
6484
6499
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
6485
|
-
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-
|
|
6500
|
+
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-card tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin 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 ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, { tooltipContent: isFlipButtonDisabled ? flipButtonDisabledMessage : undefined, tooltipWidth: "max", children: jsx("button", { disabled: isFlipButtonDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !isFlipButtonDisabled &&
|
|
6486
6501
|
'group-hover/flip-button:tw-rotate-180') }) }) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
6487
6502
|
}
|
|
6488
6503
|
|
|
@@ -6650,7 +6665,7 @@ function ListItem(_a) {
|
|
|
6650
6665
|
return (jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxs(ItemTag, Object.assign({}, itemProps, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isSelected && 'tw-bg-material-light-thin', isInteractive && 'hover:tw-bg-material-light-thin'), children: [size === 'large' ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs',
|
|
6651
6666
|
// 'large' variant has extra padding
|
|
6652
6667
|
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsx(BodyText, { size: "small", className: cn('tw-max-w-full tw-truncate', subtitle && 'tw-h-[17px] !tw-leading-[17px]'), children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
6653
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxs(CaptionText, { className: subtitleClassName, children: [jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover }), subtitle] })) : null)] }), showDetail && (jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
6668
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
6654
6669
|
? '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'
|
|
6655
6670
|
: 'tw-flex', isDetailInteractive && 'hover:tw-bg-material-light-thin', detailButtonClassName), children: [!!detail && (jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] })))] })) })));
|
|
6656
6671
|
}
|
|
@@ -6838,7 +6853,7 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
|
|
|
6838
6853
|
}
|
|
6839
6854
|
|
|
6840
6855
|
function ProductCard({ children }) {
|
|
6841
|
-
return (jsx("div", { className: "
|
|
6856
|
+
return (jsx("div", { className: "group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-3 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-3 tw-relative tw-flex tw-h-card tw-min-h-card tw-w-card tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300 tw-outline tw-outline-1 tw-outline-material-light-thin", children: children }));
|
|
6842
6857
|
}
|
|
6843
6858
|
function BorderedContainer({ children, className, }) {
|
|
6844
6859
|
return (jsx("section", { className: cn('tw-border-t tw-border-t-material-light-thin', className), children: children }));
|
|
@@ -6862,7 +6877,7 @@ function LogoContainer({ children }) {
|
|
|
6862
6877
|
|
|
6863
6878
|
function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, }) {
|
|
6864
6879
|
var _a, _b;
|
|
6865
|
-
return (jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-
|
|
6880
|
+
return (jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-card tw-overflow-hidden tw-border-t tw-border-t-material-light-thin 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 tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), 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 }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-l tw-z-10 tw-overflow-hidden", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
|
|
6866
6881
|
decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
|
|
6867
6882
|
symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
|
|
6868
6883
|
price: tokenPrice,
|
|
@@ -7120,18 +7135,65 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
7120
7135
|
: amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs(CaptionText, { children: [balanceFormatted, " ", token.symbol] }), jsx(MaxIcon, {})] })] }))] }));
|
|
7121
7136
|
}
|
|
7122
7137
|
|
|
7123
|
-
function SettingsSlider({ value, type, onChange,
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7138
|
+
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, }) {
|
|
7139
|
+
const [isInputVisible, setIsInputVisible] = useState(false);
|
|
7140
|
+
const [inputValue, setInputValue] = useState(String(value !== null && value !== void 0 ? value : 0));
|
|
7141
|
+
useEffect(() => {
|
|
7142
|
+
if (!isInputVisible)
|
|
7143
|
+
return;
|
|
7144
|
+
const handleOutsideClick = (event) => {
|
|
7145
|
+
var _a;
|
|
7146
|
+
const clickedElementIsDifferentThanMenu = event.target !== menuRef.current;
|
|
7147
|
+
const clickedElementIsDifferentThanSlider = event.target !== sliderRef.current;
|
|
7148
|
+
const sliderContainsClickedElement = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
7149
|
+
const hideInput = clickedElementIsDifferentThanMenu &&
|
|
7150
|
+
(!clickedElementIsDifferentThanSlider || !sliderContainsClickedElement);
|
|
7151
|
+
if (hideInput) {
|
|
7152
|
+
handleCloseInput();
|
|
7153
|
+
}
|
|
7154
|
+
};
|
|
7155
|
+
document.addEventListener('click', handleOutsideClick);
|
|
7156
|
+
return () => {
|
|
7157
|
+
document.removeEventListener('click', handleOutsideClick);
|
|
7158
|
+
};
|
|
7159
|
+
}, [isInputVisible]);
|
|
7160
|
+
const menuRef = useRef(null);
|
|
7161
|
+
const sliderRef = useRef(null);
|
|
7162
|
+
const handleSubmit = useCallback((value) => {
|
|
7163
|
+
handleCloseInput();
|
|
7164
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value === '' ? undefined : Number(value));
|
|
7165
|
+
}, [onChange]);
|
|
7166
|
+
const handleKeyDown = useCallback((e) => {
|
|
7167
|
+
// block unwanted (but still valid) characters
|
|
7168
|
+
if (['e', 'E', '+', '-'].includes(e.key))
|
|
7169
|
+
return e.preventDefault();
|
|
7170
|
+
// close input when pressing escape
|
|
7171
|
+
if (e.key === 'Escape')
|
|
7172
|
+
return handleCloseInput();
|
|
7173
|
+
}, []);
|
|
7174
|
+
const handleOpenInput = useCallback(() => {
|
|
7175
|
+
setIsInputVisible(true);
|
|
7176
|
+
}, []);
|
|
7177
|
+
const handleCloseInput = useCallback(() => {
|
|
7178
|
+
setIsInputVisible(false);
|
|
7179
|
+
}, []);
|
|
7180
|
+
return (jsxs("div", { ref: sliderRef, className: "tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsxs("button", { className: cn('tw-relative tw-flex tw-h-[32px] tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-p-squid-xs tw-pr-[40px] tw-text-left tw-text-caption !tw-font-medium tw-leading-[10px] placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', value === 0 || value === undefined
|
|
7181
|
+
? 'tw-text-grey-600'
|
|
7182
|
+
: 'tw-text-grey-300', isInputVisible ? 'tw-bg-material-light-thin' : 'tw-bg-transparent'), children: [value !== null && value !== void 0 ? value : 0, jsx(CaptionText, { className: "!tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: type === 'percentage' ? '%' : '$' })] }), jsx("button", { onClick: handleOpenInput, className: "tw-absolute tw-right-squid-xs tw-flex tw-h-[26px] tw-w-[26px] tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-xxs !tw-font-medium tw-leading-[10px] hover:tw-bg-material-light-thin", children: jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) }), isInputVisible && (jsx(Menu, { menuRef: menuRef, containerClassName: "tw-absolute tw-bottom-full tw-z-10 tw-pb-squid-m tw-w-[160px]", children: jsx("form", { onSubmit: (e) => {
|
|
7183
|
+
e.preventDefault();
|
|
7184
|
+
handleSubmit(inputValue);
|
|
7185
|
+
}, children: jsx(Input, { autoFocus: true, min: min, max: max, onKeyDown: handleKeyDown, step: decimalsFormat, placeholder: "0", type: "number", defaultValue: value, value: inputValue, onChange: (e) => {
|
|
7186
|
+
const isValid = e.target.checkValidity();
|
|
7187
|
+
if (!isValid)
|
|
7188
|
+
return;
|
|
7189
|
+
setInputValue(e.target.value);
|
|
7190
|
+
}, showIcon: false, actionButtonProps: {
|
|
7191
|
+
label: 'Ok',
|
|
7192
|
+
onClick: () => {
|
|
7193
|
+
handleSubmit(inputValue);
|
|
7194
|
+
},
|
|
7195
|
+
variant: 'primary',
|
|
7196
|
+
} }) }) }))] }));
|
|
7135
7197
|
}
|
|
7136
7198
|
|
|
7137
7199
|
const switchSizeClassMap = {
|
|
@@ -42389,8 +42451,8 @@ const lightTheme = {
|
|
|
42389
42451
|
// content
|
|
42390
42452
|
'content-100': '#17191C',
|
|
42391
42453
|
'content-200': '#292C32',
|
|
42392
|
-
'content-300': '#
|
|
42393
|
-
'content-400': '#
|
|
42454
|
+
'content-300': '#292C32',
|
|
42455
|
+
'content-400': '#676B7E',
|
|
42394
42456
|
'content-500': '#8A8FA8',
|
|
42395
42457
|
'content-600': '#A7ABBE',
|
|
42396
42458
|
'content-700': '#D1D6E0',
|
|
@@ -42400,7 +42462,7 @@ const lightTheme = {
|
|
|
42400
42462
|
'accent-400': '#9E79D2',
|
|
42401
42463
|
'accent-500': '#B893EC',
|
|
42402
42464
|
// status
|
|
42403
|
-
'status-positive': '#
|
|
42465
|
+
'status-positive': '#17CF26',
|
|
42404
42466
|
'status-negative': '#FF5B4D',
|
|
42405
42467
|
'status-warning': '#EC9213',
|
|
42406
42468
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type AssetsButtonVariant = 'primary' | 'accent';
|
|
1
2
|
interface AssetsButtonProps {
|
|
2
3
|
tokenImageUrl?: string;
|
|
3
4
|
chainImageUrl?: string;
|
|
@@ -6,6 +7,7 @@ interface AssetsButtonProps {
|
|
|
6
7
|
tokenBgColor?: string;
|
|
7
8
|
tokenTextColor?: string;
|
|
8
9
|
onClick?: () => void;
|
|
10
|
+
variant?: AssetsButtonVariant;
|
|
9
11
|
}
|
|
10
|
-
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, onClick, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor: _chainBgColor, tokenBgColor: _tokenBgColor, tokenTextColor, onClick, variant, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonVariant } from '../../types/components';
|
|
2
3
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
showIcon?: boolean;
|
|
5
|
-
showPasteButton?: boolean;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
isError?: boolean;
|
|
8
|
-
onPasteButtonClick?: () => void;
|
|
9
8
|
containerClassName?: string;
|
|
9
|
+
actionButtonProps?: InputActionButtonProps;
|
|
10
10
|
}
|
|
11
|
-
export declare function Input({ placeholder, showIcon,
|
|
11
|
+
export declare function Input({ placeholder, showIcon, className, icon, isError, containerClassName, actionButtonProps, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
type InputActionButtonProps = {
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
label?: string;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface SettingsSliderProps {
|
|
2
2
|
value: number;
|
|
3
3
|
type: 'percentage' | 'amount';
|
|
4
|
-
onChange?: (value: number) => void;
|
|
5
|
-
|
|
4
|
+
onChange?: (value: number | undefined) => void;
|
|
5
|
+
decimalsFormat?: number;
|
|
6
6
|
min?: number;
|
|
7
7
|
max?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare function SettingsSlider({ value, type, onChange,
|
|
9
|
+
export declare function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownMenuItemProps } from './DropdownMenuItem';
|
|
3
|
-
|
|
3
|
+
import { HistoryItemStatus } from '../../types/components';
|
|
4
4
|
interface HistoryItemProps {
|
|
5
5
|
firstImageUrl: string;
|
|
6
6
|
secondImageUrl: string;
|
|
@@ -3,7 +3,8 @@ import { AssetsButton } from '../../components/buttons/AssetsButton';
|
|
|
3
3
|
declare const meta: Meta<typeof AssetsButton>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const PrimaryVariantEmpty: Story;
|
|
7
|
+
export declare const AccentVariantEmpty: Story;
|
|
7
8
|
export declare const ChainOnly: Story;
|
|
8
9
|
export declare const ChainAndTokenLightText: Story;
|
|
9
10
|
export declare const ChainAndTokenDarkText: Story;
|
|
@@ -5,5 +5,5 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const WithoutIcon: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const WithActionButton: Story;
|
|
9
9
|
export declare const Error: Story;
|
|
@@ -5,3 +5,7 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Percentage: Story;
|
|
7
7
|
export declare const Amount: Story;
|
|
8
|
+
export declare const PercentageWith1DecimalPlaceAllowed: Story;
|
|
9
|
+
export declare const AmountWith2DecimalPlacesAllowed: Story;
|
|
10
|
+
export declare const PercentageMax50: Story;
|
|
11
|
+
export declare const AmountMax999: Story;
|
|
@@ -4,6 +4,7 @@ export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
|
4
4
|
export type ButtonSize = 'md' | 'lg';
|
|
5
5
|
export type SwapDirection = 'from' | 'to';
|
|
6
6
|
export type BoostMode = 'normal' | 'boost';
|
|
7
|
+
export type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
7
8
|
export type SwapStepDescriptionBlock = {
|
|
8
9
|
type: 'string';
|
|
9
10
|
value: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { SquidTheme } from './config';
|
|
2
|
-
export type { SwapState, ThemeType, SwapStep, SwapStepItemStatus, } from './components';
|
|
2
|
+
export type { SwapState, ThemeType, SwapStep, SwapStepItemStatus, HistoryItemStatus, } from './components';
|
package/dist/index.css
CHANGED
|
@@ -693,10 +693,6 @@ video {
|
|
|
693
693
|
left: 1.875rem;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
.tw-left-squid-xs {
|
|
697
|
-
left: 0.625rem;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
696
|
.tw-right-0 {
|
|
701
697
|
right: 0px;
|
|
702
698
|
}
|
|
@@ -928,10 +924,18 @@ video {
|
|
|
928
924
|
height: 240px;
|
|
929
925
|
}
|
|
930
926
|
|
|
927
|
+
.tw-h-\[26px\] {
|
|
928
|
+
height: 26px;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
931
|
.tw-h-\[30px\] {
|
|
932
932
|
height: 30px;
|
|
933
933
|
}
|
|
934
934
|
|
|
935
|
+
.tw-h-\[32px\] {
|
|
936
|
+
height: 32px;
|
|
937
|
+
}
|
|
938
|
+
|
|
935
939
|
.tw-h-\[40px\] {
|
|
936
940
|
height: 40px;
|
|
937
941
|
}
|
|
@@ -972,10 +976,6 @@ video {
|
|
|
972
976
|
height: 640px;
|
|
973
977
|
}
|
|
974
978
|
|
|
975
|
-
.tw-h-\[660px\] {
|
|
976
|
-
height: 660px;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
979
|
.tw-h-\[94px\] {
|
|
980
980
|
height: 94px;
|
|
981
981
|
}
|
|
@@ -989,7 +989,7 @@ video {
|
|
|
989
989
|
}
|
|
990
990
|
|
|
991
991
|
.tw-h-card {
|
|
992
|
-
height:
|
|
992
|
+
height: 660px;
|
|
993
993
|
}
|
|
994
994
|
|
|
995
995
|
.tw-h-full {
|
|
@@ -1085,7 +1085,7 @@ video {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
1087
1087
|
.tw-min-h-card {
|
|
1088
|
-
min-height:
|
|
1088
|
+
min-height: 660px;
|
|
1089
1089
|
}
|
|
1090
1090
|
|
|
1091
1091
|
.tw-min-h-squid-l {
|
|
@@ -1161,6 +1161,10 @@ video {
|
|
|
1161
1161
|
width: 150px;
|
|
1162
1162
|
}
|
|
1163
1163
|
|
|
1164
|
+
.tw-w-\[160px\] {
|
|
1165
|
+
width: 160px;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1164
1168
|
.tw-w-\[180px\] {
|
|
1165
1169
|
width: 180px;
|
|
1166
1170
|
}
|
|
@@ -1173,6 +1177,10 @@ video {
|
|
|
1173
1177
|
width: 22px;
|
|
1174
1178
|
}
|
|
1175
1179
|
|
|
1180
|
+
.tw-w-\[26px\] {
|
|
1181
|
+
width: 26px;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1176
1184
|
.tw-w-\[299px\] {
|
|
1177
1185
|
width: 299px;
|
|
1178
1186
|
}
|
|
@@ -1205,10 +1213,6 @@ video {
|
|
|
1205
1213
|
width: 470px;
|
|
1206
1214
|
}
|
|
1207
1215
|
|
|
1208
|
-
.tw-w-\[480px\] {
|
|
1209
|
-
width: 480px;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
1216
|
.tw-w-\[500px\] {
|
|
1213
1217
|
width: 500px;
|
|
1214
1218
|
}
|
|
@@ -1237,14 +1241,6 @@ video {
|
|
|
1237
1241
|
width: 72px;
|
|
1238
1242
|
}
|
|
1239
1243
|
|
|
1240
|
-
.tw-w-\[80px\] {
|
|
1241
|
-
width: 80px;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
.tw-w-\[84px\] {
|
|
1245
|
-
width: 84px;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
1244
|
.tw-w-\[90px\] {
|
|
1249
1245
|
width: 90px;
|
|
1250
1246
|
}
|
|
@@ -1258,7 +1254,7 @@ video {
|
|
|
1258
1254
|
}
|
|
1259
1255
|
|
|
1260
1256
|
.tw-w-card {
|
|
1261
|
-
width:
|
|
1257
|
+
width: 480px;
|
|
1262
1258
|
}
|
|
1263
1259
|
|
|
1264
1260
|
.tw-w-fit {
|
|
@@ -1295,8 +1291,8 @@ video {
|
|
|
1295
1291
|
width: 3.75rem;
|
|
1296
1292
|
}
|
|
1297
1293
|
|
|
1298
|
-
|
|
1299
|
-
min-width: 0px;
|
|
1294
|
+
.\!tw-min-w-0 {
|
|
1295
|
+
min-width: 0px !important;
|
|
1300
1296
|
}
|
|
1301
1297
|
|
|
1302
1298
|
.tw-min-w-96 {
|
|
@@ -1386,11 +1382,6 @@ video {
|
|
|
1386
1382
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1387
1383
|
}
|
|
1388
1384
|
|
|
1389
|
-
.tw-translate-y-\[0\.5px\] {
|
|
1390
|
-
--tw-translate-y: 0.5px;
|
|
1391
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
1385
|
.tw-rotate-180 {
|
|
1395
1386
|
--tw-rotate: 180deg;
|
|
1396
1387
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1754,10 +1745,6 @@ video {
|
|
|
1754
1745
|
border-radius: 0.9375rem;
|
|
1755
1746
|
}
|
|
1756
1747
|
|
|
1757
|
-
.tw-rounded-squid-xl {
|
|
1758
|
-
border-radius: 2.5rem;
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
1748
|
.tw-rounded-squid-xs {
|
|
1762
1749
|
border-radius: 0.625rem;
|
|
1763
1750
|
}
|
|
@@ -1850,10 +1837,6 @@ video {
|
|
|
1850
1837
|
border-color: var(--squid-theme-grey-900);
|
|
1851
1838
|
}
|
|
1852
1839
|
|
|
1853
|
-
.tw-border-material-light-thick {
|
|
1854
|
-
border-color: var(--squid-theme-material-light-thick);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
1840
|
.tw-border-material-light-thin {
|
|
1858
1841
|
border-color: var(--squid-theme-material-light-thin);
|
|
1859
1842
|
}
|
|
@@ -1927,10 +1910,6 @@ video {
|
|
|
1927
1910
|
background-color: var(--squid-theme-material-dark-thin);
|
|
1928
1911
|
}
|
|
1929
1912
|
|
|
1930
|
-
.tw-bg-material-light-thick {
|
|
1931
|
-
background-color: var(--squid-theme-material-light-thick);
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
1913
|
.tw-bg-material-light-thin {
|
|
1935
1914
|
background-color: var(--squid-theme-material-light-thin);
|
|
1936
1915
|
}
|
|
@@ -2057,11 +2036,6 @@ video {
|
|
|
2057
2036
|
padding: 3.75rem;
|
|
2058
2037
|
}
|
|
2059
2038
|
|
|
2060
|
-
.\!tw-px-2 {
|
|
2061
|
-
padding-left: 0.5rem !important;
|
|
2062
|
-
padding-right: 0.5rem !important;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
2039
|
.\!tw-px-4 {
|
|
2066
2040
|
padding-left: 1rem !important;
|
|
2067
2041
|
padding-right: 1rem !important;
|
|
@@ -2102,11 +2076,6 @@ video {
|
|
|
2102
2076
|
padding-right: 3px;
|
|
2103
2077
|
}
|
|
2104
2078
|
|
|
2105
|
-
.tw-px-\[70px\] {
|
|
2106
|
-
padding-left: 70px;
|
|
2107
|
-
padding-right: 70px;
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
2079
|
.tw-px-squid-l {
|
|
2111
2080
|
padding-left: 1.875rem;
|
|
2112
2081
|
padding-right: 1.875rem;
|
|
@@ -2208,16 +2177,12 @@ video {
|
|
|
2208
2177
|
padding-left: 0.25rem;
|
|
2209
2178
|
}
|
|
2210
2179
|
|
|
2211
|
-
.tw-pl-\[20px\] {
|
|
2212
|
-
padding-left: 20px;
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
2180
|
.tw-pl-\[33px\] {
|
|
2216
2181
|
padding-left: 33px;
|
|
2217
2182
|
}
|
|
2218
2183
|
|
|
2219
|
-
.tw-pl-\[
|
|
2220
|
-
padding-left:
|
|
2184
|
+
.tw-pl-\[40px\] {
|
|
2185
|
+
padding-left: 40px;
|
|
2221
2186
|
}
|
|
2222
2187
|
|
|
2223
2188
|
.tw-pl-\[7px\] {
|
|
@@ -2248,12 +2213,12 @@ video {
|
|
|
2248
2213
|
padding-right: 1rem;
|
|
2249
2214
|
}
|
|
2250
2215
|
|
|
2251
|
-
.tw-pr-\[
|
|
2252
|
-
padding-right:
|
|
2216
|
+
.tw-pr-\[40px\] {
|
|
2217
|
+
padding-right: 40px;
|
|
2253
2218
|
}
|
|
2254
2219
|
|
|
2255
|
-
.tw-pr-\[
|
|
2256
|
-
padding-right:
|
|
2220
|
+
.tw-pr-\[70px\] {
|
|
2221
|
+
padding-right: 70px;
|
|
2257
2222
|
}
|
|
2258
2223
|
|
|
2259
2224
|
.tw-pr-squid-m {
|
|
@@ -2992,12 +2957,24 @@ input[type='number'] {
|
|
|
2992
2957
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2993
2958
|
}
|
|
2994
2959
|
|
|
2960
|
+
.tw-group[data-squid-theme-type=dark] .group-data-\[squid-theme-type\=dark\]\:tw-shadow-elevation-dark-3 {
|
|
2961
|
+
--tw-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.20), 0px 5px 50px -1px rgba(0, 0, 0, 0.33);
|
|
2962
|
+
--tw-shadow-colored: 0px 2px 4px 0px var(--tw-shadow-color), 0px 5px 50px -1px var(--tw-shadow-color);
|
|
2963
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2995
2966
|
.tw-group[data-squid-theme-type=light] .group-data-\[squid-theme-type\=light\]\:tw-shadow-elevation-light-2 {
|
|
2996
2967
|
--tw-shadow: 0px 2px 5px 1px rgba(0, 0, 0, 0.10), 0px 5px 20px -1px rgba(0, 0, 0, 0.10);
|
|
2997
2968
|
--tw-shadow-colored: 0px 2px 5px 1px var(--tw-shadow-color), 0px 5px 20px -1px var(--tw-shadow-color);
|
|
2998
2969
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2999
2970
|
}
|
|
3000
2971
|
|
|
2972
|
+
.tw-group[data-squid-theme-type=light] .group-data-\[squid-theme-type\=light\]\:tw-shadow-elevation-light-3 {
|
|
2973
|
+
--tw-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.10), 0px 5px 50px -1px rgba(0, 0, 0, 0.20);
|
|
2974
|
+
--tw-shadow-colored: 0px 2px 4px 0px var(--tw-shadow-color), 0px 5px 50px -1px var(--tw-shadow-color);
|
|
2975
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2976
|
+
}
|
|
2977
|
+
|
|
3001
2978
|
.tw-peer[data-boost-mode=boost] ~ .peer-data-\[boost-mode\=boost\]\:tw-bg-status-positive {
|
|
3002
2979
|
background-color: var(--squid-theme-status-positive);
|
|
3003
2980
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ interface ArrowButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
37
37
|
}
|
|
38
38
|
declare function ArrowButton({ label, disabled, ...props }: ArrowButtonProps): react_jsx_runtime.JSX.Element;
|
|
39
39
|
|
|
40
|
+
type AssetsButtonVariant = 'primary' | 'accent';
|
|
40
41
|
interface AssetsButtonProps {
|
|
41
42
|
tokenImageUrl?: string;
|
|
42
43
|
chainImageUrl?: string;
|
|
@@ -45,8 +46,9 @@ interface AssetsButtonProps {
|
|
|
45
46
|
tokenBgColor?: string;
|
|
46
47
|
tokenTextColor?: string;
|
|
47
48
|
onClick?: () => void;
|
|
49
|
+
variant?: AssetsButtonVariant;
|
|
48
50
|
}
|
|
49
|
-
declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor, tokenBgColor, tokenTextColor, onClick, }: AssetsButtonProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
declare function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor: _chainBgColor, tokenBgColor: _tokenBgColor, tokenTextColor, onClick, variant, }: AssetsButtonProps): react_jsx_runtime.JSX.Element;
|
|
50
52
|
|
|
51
53
|
type TextSize = 'small' | 'medium' | 'large';
|
|
52
54
|
type SwitchSize = 'small' | 'large';
|
|
@@ -54,6 +56,7 @@ type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
|
54
56
|
type ButtonSize = 'md' | 'lg';
|
|
55
57
|
type SwapDirection = 'from' | 'to';
|
|
56
58
|
type BoostMode = 'normal' | 'boost';
|
|
59
|
+
type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
57
60
|
type SwapStepDescriptionBlock = {
|
|
58
61
|
type: 'string';
|
|
59
62
|
value: string;
|
|
@@ -121,13 +124,17 @@ declare function SettingsButton({ label, isSelected, onClick, }: SettingsButtonP
|
|
|
121
124
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
122
125
|
placeholder?: string;
|
|
123
126
|
showIcon?: boolean;
|
|
124
|
-
showPasteButton?: boolean;
|
|
125
127
|
icon?: React.ReactNode;
|
|
126
128
|
isError?: boolean;
|
|
127
|
-
onPasteButtonClick?: () => void;
|
|
128
129
|
containerClassName?: string;
|
|
130
|
+
actionButtonProps?: InputActionButtonProps;
|
|
129
131
|
}
|
|
130
|
-
declare function Input({ placeholder, showIcon,
|
|
132
|
+
declare function Input({ placeholder, showIcon, className, icon, isError, containerClassName, actionButtonProps, ...props }: InputProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
type InputActionButtonProps = {
|
|
134
|
+
onClick?: () => void;
|
|
135
|
+
variant?: ButtonVariant;
|
|
136
|
+
label?: string;
|
|
137
|
+
};
|
|
131
138
|
|
|
132
139
|
interface Token$1 {
|
|
133
140
|
price: number;
|
|
@@ -162,12 +169,12 @@ declare function NumericInput({ priceImpactPercentage, balance, error, criticalP
|
|
|
162
169
|
interface SettingsSliderProps {
|
|
163
170
|
value: number;
|
|
164
171
|
type: 'percentage' | 'amount';
|
|
165
|
-
onChange?: (value: number) => void;
|
|
166
|
-
|
|
172
|
+
onChange?: (value: number | undefined) => void;
|
|
173
|
+
decimalsFormat?: number;
|
|
167
174
|
min?: number;
|
|
168
175
|
max?: number;
|
|
169
176
|
}
|
|
170
|
-
declare function SettingsSlider({ value, type, onChange,
|
|
177
|
+
declare function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, }: SettingsSliderProps): react_jsx_runtime.JSX.Element;
|
|
171
178
|
|
|
172
179
|
interface SwitchProps {
|
|
173
180
|
checked?: boolean;
|
|
@@ -236,7 +243,6 @@ interface DropdownMenuItemProps {
|
|
|
236
243
|
}
|
|
237
244
|
declare function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }: DropdownMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
238
245
|
|
|
239
|
-
type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
240
246
|
interface HistoryItemProps {
|
|
241
247
|
firstImageUrl: string;
|
|
242
248
|
secondImageUrl: string;
|
|
@@ -575,4 +581,4 @@ declare function useDropdownMenu(props?: {
|
|
|
575
581
|
openDropdownButtonRef: React.RefObject<HTMLButtonElement>;
|
|
576
582
|
};
|
|
577
583
|
|
|
578
|
-
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, BorderedContainer, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, STEP_ITEM_HEIGHT, SectionTitle, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressView, SwapProgressViewHeader, SwapState, type SwapStep, SwapStepItem, type SwapStepItemStatus, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, Switch, type ThemeType, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, UsdAmount, useDropdownMenu };
|
|
584
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, BorderedContainer, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, type HistoryItemStatus, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, STEP_ITEM_HEIGHT, SectionTitle, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressView, SwapProgressViewHeader, SwapState, type SwapStep, SwapStepItem, type SwapStepItemStatus, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, Switch, type ThemeType, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, UsdAmount, useDropdownMenu };
|