@0xsquid/ui 0.13.0 → 0.13.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 +90 -71
- package/dist/cjs/types/components/controls/NumericInput.d.ts +2 -2
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +3 -1
- package/dist/cjs/types/stories/buttons/Button.stories.d.ts +2 -0
- package/dist/cjs/types/stories/lists/ListItem.stories.d.ts +3 -3
- package/dist/esm/index.js +90 -71
- package/dist/esm/types/components/controls/NumericInput.d.ts +2 -2
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +3 -1
- package/dist/esm/types/stories/buttons/Button.stories.d.ts +2 -0
- package/dist/esm/types/stories/lists/ListItem.stories.d.ts +3 -3
- package/dist/index.css +31 -44
- package/dist/index.d.ts +5 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2613,20 +2613,6 @@ function UsdAmount({ usdAmount }) {
|
|
|
2613
2613
|
return (jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "$" }), jsxRuntime.jsx(CaptionText, { children: usdAmount.toString() })] }));
|
|
2614
2614
|
}
|
|
2615
2615
|
|
|
2616
|
-
// font size, line height, and letter spacing classes
|
|
2617
|
-
const textClassMap$1 = {
|
|
2618
|
-
small: 'tw-text-body-small tw-tracking-body-small tw-leading-body-small',
|
|
2619
|
-
medium: 'tw-text-body-medium tw-tracking-body-medium tw-leading-body-medium',
|
|
2620
|
-
large: 'tw-text-body-large tw-tracking-body-large tw-leading-body-large',
|
|
2621
|
-
};
|
|
2622
|
-
function BodyText(_a) {
|
|
2623
|
-
var { size, children, bold } = _a, props = __rest(_a, ["size", "children", "bold"]);
|
|
2624
|
-
const fontWeightClass = bold
|
|
2625
|
-
? 'tw-font-typography-bold'
|
|
2626
|
-
: 'tw-font-typography-regular';
|
|
2627
|
-
return (jsxRuntime.jsx("span", Object.assign({}, props, { className: cn(textClassMap$1[size], fontWeightClass, props.className), children: children })));
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
2616
|
function Loader({ size = '24', strokeWidth = '1' }) {
|
|
2631
2617
|
return (jsxRuntime.jsxs("svg", { className: "squid-animated-loader", xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: [jsxRuntime.jsx("style", { children: `
|
|
2632
2618
|
.squid-animated-loader-dash {
|
|
@@ -2654,9 +2640,63 @@ function Loader({ size = '24', strokeWidth = '1' }) {
|
|
|
2654
2640
|
}` }), jsxRuntime.jsxs("g", { "clip-path": "url(#clip0_1387_2296)", children: [jsxRuntime.jsx("circle", { cx: "7.99967", cy: "8.00004", r: "6.66667", stroke: "currentColor", className: "group-data-[squid-theme-type=dark]:tw-text-material-light-thin group-data-[squid-theme-type=light]:tw-text-material-dark-thin", "stroke-width": strokeWidth }), jsxRuntime.jsx("path", { className: "squid-animated-loader-dash group-data-[squid-theme-type=dark]:tw-text-material-light-thick group-data-[squid-theme-type=light]:tw-text-material-dark-thick", d: "M14.6663 8.00004C14.6663 7.12456 14.4939 6.25766 14.1589 5.44882C13.8238 4.63998 13.3328 3.90505 12.7137 3.286C12.0947 2.66694 11.3597 2.17588 10.5509 1.84084C9.74206 1.50581 8.87515 1.33337 7.99967 1.33337", stroke: "currentColor", "stroke-width": strokeWidth, "stroke-linecap": "round" })] }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_1387_2296", children: jsxRuntime.jsx("rect", { width: "16", height: "16", fill: "white" }) }) })] }));
|
|
2655
2641
|
}
|
|
2656
2642
|
|
|
2643
|
+
// font size, line height, and letter spacing classes
|
|
2644
|
+
const textClassMap$1 = {
|
|
2645
|
+
small: 'tw-text-body-small tw-tracking-body-small tw-leading-body-small',
|
|
2646
|
+
medium: 'tw-text-body-medium tw-tracking-body-medium tw-leading-body-medium',
|
|
2647
|
+
large: 'tw-text-body-large tw-tracking-body-large tw-leading-body-large',
|
|
2648
|
+
};
|
|
2649
|
+
function BodyText(_a) {
|
|
2650
|
+
var { size, children, bold } = _a, props = __rest(_a, ["size", "children", "bold"]);
|
|
2651
|
+
const fontWeightClass = bold
|
|
2652
|
+
? 'tw-font-typography-bold'
|
|
2653
|
+
: 'tw-font-typography-regular';
|
|
2654
|
+
return (jsxRuntime.jsx("span", Object.assign({}, props, { className: cn(textClassMap$1[size], fontWeightClass, props.className), children: children })));
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
const baseButtonClassName = 'tw-border tw-relative tw-overflow-hidden tw-group/base-button tw-flex tw-items-center tw-justify-center';
|
|
2658
|
+
const buttonSizeClassMap = {
|
|
2659
|
+
md: 'tw-px-squid-xs tw-py-squid-xxs tw-min-w-[60px] tw-h-squid-xl',
|
|
2660
|
+
lg: 'tw-p-1 tw-h-button tw-w-full',
|
|
2661
|
+
};
|
|
2662
|
+
const roundedClassMap = {
|
|
2663
|
+
md: 'tw-rounded-squid-m',
|
|
2664
|
+
lg: 'tw-rounded-squid-xxl',
|
|
2665
|
+
};
|
|
2666
|
+
const buttonVariantClassMap = {
|
|
2667
|
+
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
|
|
2668
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2669
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2670
|
+
};
|
|
2671
|
+
// right now all variants have the same disabled styles
|
|
2672
|
+
// in the future, we can add more disabled styles for different variants
|
|
2673
|
+
const buttonDisabledClass = '!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed';
|
|
2674
|
+
function Button(_a) {
|
|
2675
|
+
var { label, disabled, size, variant, icon, link } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
|
|
2676
|
+
const children = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!disabled && jsxRuntime.jsx(ButtonHoverOverlay, { className: roundedClassMap[size] }), jsxRuntime.jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: !label && !icon ? (props.children) : size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2677
|
+
// label only
|
|
2678
|
+
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2679
|
+
// icon only
|
|
2680
|
+
icon) : (
|
|
2681
|
+
// icon and label
|
|
2682
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
|
|
2683
|
+
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], roundedClassMap[size],
|
|
2684
|
+
// disabled styles
|
|
2685
|
+
disabled && buttonDisabledClass,
|
|
2686
|
+
// custom classes from props
|
|
2687
|
+
props.className);
|
|
2688
|
+
if (link) {
|
|
2689
|
+
return (jsxRuntime.jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
|
|
2690
|
+
}
|
|
2691
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
|
|
2692
|
+
}
|
|
2693
|
+
const ButtonHoverOverlay = ({ className }) => {
|
|
2694
|
+
return (jsxRuntime.jsx("span", { className: cn('tw-absolute tw-inset-0 tw-z-0 tw-hidden tw-h-full tw-w-full tw-bg-material-light-thin group-hover/base-button:tw-block', className) }));
|
|
2695
|
+
};
|
|
2696
|
+
|
|
2657
2697
|
function AddressButton(_a) {
|
|
2658
2698
|
var { label, imageUrl, badgeUrl, isLoading } = _a, props = __rest(_a, ["label", "imageUrl", "badgeUrl", "isLoading"]);
|
|
2659
|
-
return (jsxRuntime.jsx(
|
|
2699
|
+
return (jsxRuntime.jsx(Button, Object.assign({ size: "md", variant: "tertiary" }, props, { disabled: isLoading, className: !isLoading && imageUrl ? 'tw-pl-1 tw-pr-4' : '!tw-px-4', children: isLoading ? (jsxRuntime.jsx("span", { className: "tw-mx-auto tw-px-4", children: jsxRuntime.jsx(Loader, {}) })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(BadgeImage, { imageUrl: imageUrl, badgeUrl: badgeUrl, extraMarginForBadge: true, rounded: true }), jsxRuntime.jsx(BodyText, { size: "small", children: label })] })) })));
|
|
2660
2700
|
}
|
|
2661
2701
|
|
|
2662
2702
|
function ArrowRightIcon() {
|
|
@@ -2689,9 +2729,7 @@ function SquareArrowTopRight2Icon({ className, size = '16', }) {
|
|
|
2689
2729
|
|
|
2690
2730
|
function ArrowButton(_a) {
|
|
2691
2731
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
2692
|
-
return (jsxRuntime.jsxs(
|
|
2693
|
-
// disabled styles
|
|
2694
|
-
'disabled:tw-bg-grey-800 disabled:tw-text-grey-600'), children: [jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) }), jsxRuntime.jsx("span", { "aria-disabled": disabled, className: clsx('tw-flex tw-aspect-square tw-h-[52px] tw-w-[52px] tw-items-center tw-justify-center tw-rounded-full tw-bg-royal-500 tw-text-grey-100',
|
|
2732
|
+
return (jsxRuntime.jsxs(Button, Object.assign({ size: "lg", variant: "tertiary" }, props, { disabled: disabled, children: [jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) }), jsxRuntime.jsx("span", { "aria-disabled": disabled, className: clsx('tw-flex tw-aspect-square tw-h-[52px] tw-w-[52px] tw-items-center tw-justify-center tw-rounded-full tw-bg-royal-500 tw-text-grey-100',
|
|
2695
2733
|
// disabled styles
|
|
2696
2734
|
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsxRuntime.jsx(ArrowRightIcon, {}) })] })));
|
|
2697
2735
|
}
|
|
@@ -2800,15 +2838,15 @@ function SearchIcon() {
|
|
|
2800
2838
|
|
|
2801
2839
|
function Input(_a) {
|
|
2802
2840
|
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon, isError = false, onPasteButtonClick } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon", "isError", "onPasteButtonClick"]);
|
|
2803
|
-
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", 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-
|
|
2841
|
+
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", 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-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[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, showPasteButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(PasteButton, { onClick: onPasteButtonClick }) })) : null] }));
|
|
2804
2842
|
}
|
|
2805
2843
|
const PasteButton = ({ onClick }) => {
|
|
2806
|
-
return (jsxRuntime.jsx("
|
|
2844
|
+
return (jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", onClick: onClick, className: "!tw-h-[30px] !tw-w-fit tw-min-w-0 !tw-px-2", children: jsxRuntime.jsx(CaptionText, { children: "Paste" }) }));
|
|
2807
2845
|
};
|
|
2808
2846
|
|
|
2809
2847
|
const NumericInput = (_a) => {
|
|
2810
2848
|
var _b;
|
|
2811
|
-
var { onParsedValueChanged, initialValue = '', forcedUpdateValue, maxDecimals, balance,
|
|
2849
|
+
var { onParsedValueChanged, initialValue = '', forcedUpdateValue, maxDecimals, balance = '0', tokenPrice = 0 } = _a, props = __rest(_a, ["onParsedValueChanged", "initialValue", "forcedUpdateValue", "maxDecimals", "balance", "tokenPrice"]);
|
|
2812
2850
|
const [inputValue, setInputValue] = react.useState(initialValue);
|
|
2813
2851
|
// Probably a better way to handle this
|
|
2814
2852
|
// This was introduce to handle the "MAX" button setting an amount
|
|
@@ -2924,8 +2962,12 @@ const NumericInput = (_a) => {
|
|
|
2924
2962
|
}
|
|
2925
2963
|
if (inputValue.includes('$')) {
|
|
2926
2964
|
const usdAmount = Number(inputValue.replace('$', ''));
|
|
2927
|
-
if (usdAmount
|
|
2928
|
-
|
|
2965
|
+
if (tokenPrice === 0 || usdAmount === 0) {
|
|
2966
|
+
setInputValue('0');
|
|
2967
|
+
onParsedValueChanged('0');
|
|
2968
|
+
}
|
|
2969
|
+
else if (usdAmount > 0) {
|
|
2970
|
+
const newValue = usdAmount / Number(tokenPrice);
|
|
2929
2971
|
const newValueFormatted = newValue.toFixed(4);
|
|
2930
2972
|
setInputValue(newValueFormatted);
|
|
2931
2973
|
onParsedValueChanged(newValueFormatted);
|
|
@@ -3068,39 +3110,6 @@ function generateMarkerLines(count) {
|
|
|
3068
3110
|
return allShadows.join(', ');
|
|
3069
3111
|
}
|
|
3070
3112
|
|
|
3071
|
-
const baseButtonClassName = 'tw-flex tw-items-center tw-gap-squid-xxs tw-justify-center tw-border';
|
|
3072
|
-
const buttonSizeClassMap = {
|
|
3073
|
-
md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-min-w-[60px] tw-h-squid-xl',
|
|
3074
|
-
lg: 'tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
3075
|
-
};
|
|
3076
|
-
const buttonVariantClassMap = {
|
|
3077
|
-
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
|
|
3078
|
-
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
3079
|
-
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
3080
|
-
};
|
|
3081
|
-
// right now all variants have the same disabled styles
|
|
3082
|
-
// in the future, we can add more disabled styles for different variants
|
|
3083
|
-
const buttonDisabledClass = '!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed';
|
|
3084
|
-
function Button(_a) {
|
|
3085
|
-
var { label, disabled, size, variant, icon, link } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
|
|
3086
|
-
const children = (jsxRuntime.jsx(jsxRuntime.Fragment, { children: size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
3087
|
-
// label only
|
|
3088
|
-
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
3089
|
-
// icon only
|
|
3090
|
-
icon) : (
|
|
3091
|
-
// icon and label
|
|
3092
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null }));
|
|
3093
|
-
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
3094
|
-
// disabled styles
|
|
3095
|
-
disabled && buttonDisabledClass,
|
|
3096
|
-
// custom classes from props
|
|
3097
|
-
props.className);
|
|
3098
|
-
if (link) {
|
|
3099
|
-
return (jsxRuntime.jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
|
|
3100
|
-
}
|
|
3101
|
-
return (jsxRuntime.jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3104
3113
|
function Chip(_a) {
|
|
3105
3114
|
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
3106
3115
|
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
@@ -3153,7 +3162,7 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3153
3162
|
return 'full';
|
|
3154
3163
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3155
3164
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3156
|
-
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] 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(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-group/arrow-button tw-border-transparent tw-bg-transparent
|
|
3165
|
+
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] 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(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-group/arrow-button tw-border-transparent tw-bg-transparent", icon: jsxRuntime.jsx(ChevronLargeDownIcon, { className: "tw-transition-transform tw-duration-150 group-hover/arrow-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 }) })] })) }));
|
|
3157
3166
|
}
|
|
3158
3167
|
|
|
3159
3168
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -3295,23 +3304,33 @@ function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount,
|
|
|
3295
3304
|
}
|
|
3296
3305
|
|
|
3297
3306
|
const listItemSizeMap = {
|
|
3298
|
-
small: 'tw-
|
|
3299
|
-
large: 'tw-
|
|
3307
|
+
small: 'tw-h-list-item-small tw-px-squid-xs',
|
|
3308
|
+
large: 'tw-h-list-item-large tw-px-squid-xs',
|
|
3300
3309
|
};
|
|
3301
3310
|
function ListItem(_a) {
|
|
3302
3311
|
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading, containerProps } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps"]);
|
|
3303
3312
|
// 'small' variant does not have detail
|
|
3304
3313
|
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
3305
|
-
|
|
3314
|
+
const isDetailInteractive = !!onDetailClick;
|
|
3315
|
+
const DetailTag = isDetailInteractive ? 'button' : 'div';
|
|
3316
|
+
const detailProps = isDetailInteractive
|
|
3317
|
+
? {
|
|
3318
|
+
onClick: (event) => {
|
|
3319
|
+
// prevent click event from bubbling up to parent
|
|
3320
|
+
event.stopPropagation();
|
|
3321
|
+
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
3322
|
+
},
|
|
3323
|
+
}
|
|
3324
|
+
: {};
|
|
3325
|
+
const isInteractive = !!props.onClick;
|
|
3326
|
+
const ItemTag = isInteractive ? 'button' : 'div';
|
|
3327
|
+
const itemProps = isInteractive ? props : {};
|
|
3328
|
+
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',
|
|
3306
3329
|
// 'large' variant has extra padding
|
|
3307
3330
|
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' &&
|
|
3308
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsxRuntime.jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500", children: subtitle })) : null)] }), showDetail && (jsxRuntime.jsxs(
|
|
3309
|
-
// prevent click event from bubbling up to parent
|
|
3310
|
-
event.stopPropagation();
|
|
3311
|
-
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
3312
|
-
}, className: cn('tw-flex tw-w-fit tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
3331
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsxRuntime.jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500", children: 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
|
|
3313
3332
|
? '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'
|
|
3314
|
-
: 'tw-flex', detailButtonClassName), children: [!!detail && (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] }))] })) })));
|
|
3333
|
+
: '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] })))] })) })));
|
|
3315
3334
|
}
|
|
3316
3335
|
|
|
3317
3336
|
function MenuItem({ label, imageUrl, icon }) {
|
|
@@ -3335,7 +3354,7 @@ function SettingsItem({ icon, label, control, link, transparent = false, helpToo
|
|
|
3335
3354
|
target: '_blank',
|
|
3336
3355
|
}
|
|
3337
3356
|
: {};
|
|
3338
|
-
const helpIcon = !!helpTooltip && (jsxRuntime.jsx(HelpIcon, { className:
|
|
3357
|
+
const helpIcon = !!helpTooltip && (jsxRuntime.jsx(HelpIcon, { className: "tw-cursor-help tw-text-grey-600 hover:tw-text-grey-400" }));
|
|
3339
3358
|
const showDetailsBorder = !!control && !link && !(control.type === 'switch');
|
|
3340
3359
|
return (jsxRuntime.jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-800'), children: jsxRuntime.jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsxRuntime.jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsxRuntime.jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: helpIcon }))] }), jsxRuntime.jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', showDetailsBorder &&
|
|
3341
3360
|
'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsxRuntime.jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (!!control && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [control.type === 'amount' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { onClick: () => control.onChange(control.resetValueControl.value), label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value }), control.options.map(({ value }, index, _controls) => (jsxRuntime.jsx(SettingsButton, { label: '$' + value, isSelected: control.value === value, onClick: () => control.onChange(value) }, index))), jsxRuntime.jsx(SettingsSlider, { type: control.type, value: control.value, onChange: control.onChange, hasDecimals: false, max: 999 })] })), control.type === 'switch' &&
|
|
@@ -3469,8 +3488,8 @@ function SwapInputsIcon() {
|
|
|
3469
3488
|
}
|
|
3470
3489
|
|
|
3471
3490
|
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
3472
|
-
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage = 5, emptyAddressLabel = 'Connect wallet', }) {
|
|
3473
|
-
var _a;
|
|
3491
|
+
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage = 5, emptyAddressLabel = 'Connect wallet', }) {
|
|
3492
|
+
var _a, _b;
|
|
3474
3493
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
3475
3494
|
? 'tw-text-status-negative'
|
|
3476
3495
|
: 'tw-text-grey-300';
|
|
@@ -3478,7 +3497,7 @@ function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAm
|
|
|
3478
3497
|
const BalanceChipTag = isBalanceChipInteractive ? 'button' : 'div';
|
|
3479
3498
|
const isSwapAmountChipInteractive = !!onSwapAmountButtonClick;
|
|
3480
3499
|
const SwapAmountChipTag = isSwapAmountChipInteractive ? 'button' : 'div';
|
|
3481
|
-
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-[480px] 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-animate-move-loading-cover-to-right tw-bg-dark-cover
|
|
3500
|
+
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-[480px] 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" }) })), direction === 'from' ? (jsxRuntime.jsx(NumericInput, { balance: balance, tokenPrice: tokenPrice, forcedUpdateValue: forcedAmount, initialValue: amount, maxDecimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18, onParsedValueChanged: (value) => onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value) })) : (jsxRuntime.jsx("div", { className: cn('tw-w-full tw-px-squid-m tw-pb-[15px] tw-pt-[5px]', isFetching && 'tw-opacity-50'), children: jsxRuntime.jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsxRuntime.jsx("span", { children: amount }) }) })), !(token === null || token === void 0 ? void 0 : token.iconUrl) ? null : (jsxRuntime.jsxs("footer", { className: cn('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', isFetching && 'tw-opacity-50'), children: [error ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsxs(SwapAmountChipTag, { onClick: onSwapAmountButtonClick, className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isSwapAmountChipInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}), jsxRuntime.jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, {}), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isBalanceChipInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsxs(CaptionText, { children: [balance, " ", token.symbol] }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
3482
3501
|
}
|
|
3483
3502
|
|
|
3484
3503
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -3516,7 +3535,7 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
|
3516
3535
|
};
|
|
3517
3536
|
}, [isShowRouteAnimationRunning]);
|
|
3518
3537
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3519
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("button", { className: "tw-group/swap-step-item-button tw-relative tw-max-h-button tw-max-w-[400px] tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800
|
|
3538
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("button", { className: "tw-group/swap-step-item-button tw-relative tw-max-h-button tw-max-w-[400px] tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800 hover:tw-bg-grey-700", onClick: () => {
|
|
3520
3539
|
// mount route component and start animation
|
|
3521
3540
|
setIsRouteVisible(true);
|
|
3522
3541
|
setIsShowRouteAnimationRunning(true);
|
|
@@ -5,7 +5,7 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
5
5
|
forcedUpdateValue?: string;
|
|
6
6
|
maxDecimals?: number;
|
|
7
7
|
balance?: string;
|
|
8
|
-
|
|
8
|
+
tokenPrice?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance,
|
|
10
|
+
export declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -5,6 +5,7 @@ interface SwapConfigurationProps {
|
|
|
5
5
|
amount?: string;
|
|
6
6
|
forcedAmount?: string;
|
|
7
7
|
swapAmountUsd?: string;
|
|
8
|
+
tokenPrice?: number;
|
|
8
9
|
balance?: string;
|
|
9
10
|
isFetching?: boolean;
|
|
10
11
|
chain?: {
|
|
@@ -16,6 +17,7 @@ interface SwapConfigurationProps {
|
|
|
16
17
|
symbol: string;
|
|
17
18
|
bgColor: string;
|
|
18
19
|
textColor: string;
|
|
20
|
+
decimals: number;
|
|
19
21
|
};
|
|
20
22
|
address?: string;
|
|
21
23
|
onAmountChange?: (amount: string) => void;
|
|
@@ -29,5 +31,5 @@ interface SwapConfigurationProps {
|
|
|
29
31
|
emptyAddressLabel?: string;
|
|
30
32
|
onSwapAmountButtonClick?: () => void;
|
|
31
33
|
}
|
|
32
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
33
35
|
export {};
|
|
@@ -7,6 +7,8 @@ export declare const MediumPrimary: Story;
|
|
|
7
7
|
export declare const MediumSecondary: Story;
|
|
8
8
|
export declare const MediumTertiary: Story;
|
|
9
9
|
export declare const MediumDisabled: Story;
|
|
10
|
+
export declare const MediumAndLink: Story;
|
|
11
|
+
export declare const MediumAndLinkDisabled: Story;
|
|
10
12
|
export declare const MediumPrimaryIconOnly: Story;
|
|
11
13
|
export declare const MediumSecondaryIconOnly: Story;
|
|
12
14
|
export declare const MediumTertiaryIconOnly: Story;
|
|
@@ -4,21 +4,21 @@ declare const meta: Meta<typeof ListItem>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Large: Story;
|
|
7
|
+
export declare const LargeInteractive: Story;
|
|
7
8
|
export declare const LargeWithLongTitle: Story;
|
|
8
9
|
export declare const LargeWithLongTitleAndSubtitle: Story;
|
|
9
10
|
export declare const LargeRoundedFull: Story;
|
|
10
11
|
export declare const LargeWithSubtitle: Story;
|
|
11
12
|
export declare const LargeWithDetail: Story;
|
|
12
13
|
export declare const LargeWithIcon: Story;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const LargeWithDetailAndIconInteractive: Story;
|
|
14
15
|
export declare const LargeShowDetailOnHoverOnly: Story;
|
|
15
16
|
export declare const LargeWithSecondaryImage: Story;
|
|
16
17
|
export declare const LargeSelected: Story;
|
|
17
18
|
export declare const LargeWithCustomIconAsImage: Story;
|
|
18
19
|
export declare const LargeLoading: Story;
|
|
19
20
|
export declare const Small: Story;
|
|
21
|
+
export declare const SmallInteractive: Story;
|
|
20
22
|
export declare const SmallWithLongTitle: Story;
|
|
21
|
-
export declare const SmallWithIcon: Story;
|
|
22
|
-
export declare const SmallShowDetailOnHoverOnly: Story;
|
|
23
23
|
export declare const SmallSelected: Story;
|
|
24
24
|
export declare const SmallWithCustomIconAsImage: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -2611,20 +2611,6 @@ function UsdAmount({ usdAmount }) {
|
|
|
2611
2611
|
return (jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsx(CaptionText, { className: "tw-opacity-66", children: "$" }), jsx(CaptionText, { children: usdAmount.toString() })] }));
|
|
2612
2612
|
}
|
|
2613
2613
|
|
|
2614
|
-
// font size, line height, and letter spacing classes
|
|
2615
|
-
const textClassMap$1 = {
|
|
2616
|
-
small: 'tw-text-body-small tw-tracking-body-small tw-leading-body-small',
|
|
2617
|
-
medium: 'tw-text-body-medium tw-tracking-body-medium tw-leading-body-medium',
|
|
2618
|
-
large: 'tw-text-body-large tw-tracking-body-large tw-leading-body-large',
|
|
2619
|
-
};
|
|
2620
|
-
function BodyText(_a) {
|
|
2621
|
-
var { size, children, bold } = _a, props = __rest(_a, ["size", "children", "bold"]);
|
|
2622
|
-
const fontWeightClass = bold
|
|
2623
|
-
? 'tw-font-typography-bold'
|
|
2624
|
-
: 'tw-font-typography-regular';
|
|
2625
|
-
return (jsx("span", Object.assign({}, props, { className: cn(textClassMap$1[size], fontWeightClass, props.className), children: children })));
|
|
2626
|
-
}
|
|
2627
|
-
|
|
2628
2614
|
function Loader({ size = '24', strokeWidth = '1' }) {
|
|
2629
2615
|
return (jsxs("svg", { className: "squid-animated-loader", xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: [jsx("style", { children: `
|
|
2630
2616
|
.squid-animated-loader-dash {
|
|
@@ -2652,9 +2638,63 @@ function Loader({ size = '24', strokeWidth = '1' }) {
|
|
|
2652
2638
|
}` }), jsxs("g", { "clip-path": "url(#clip0_1387_2296)", children: [jsx("circle", { cx: "7.99967", cy: "8.00004", r: "6.66667", stroke: "currentColor", className: "group-data-[squid-theme-type=dark]:tw-text-material-light-thin group-data-[squid-theme-type=light]:tw-text-material-dark-thin", "stroke-width": strokeWidth }), jsx("path", { className: "squid-animated-loader-dash group-data-[squid-theme-type=dark]:tw-text-material-light-thick group-data-[squid-theme-type=light]:tw-text-material-dark-thick", d: "M14.6663 8.00004C14.6663 7.12456 14.4939 6.25766 14.1589 5.44882C13.8238 4.63998 13.3328 3.90505 12.7137 3.286C12.0947 2.66694 11.3597 2.17588 10.5509 1.84084C9.74206 1.50581 8.87515 1.33337 7.99967 1.33337", stroke: "currentColor", "stroke-width": strokeWidth, "stroke-linecap": "round" })] }), jsx("defs", { children: jsx("clipPath", { id: "clip0_1387_2296", children: jsx("rect", { width: "16", height: "16", fill: "white" }) }) })] }));
|
|
2653
2639
|
}
|
|
2654
2640
|
|
|
2641
|
+
// font size, line height, and letter spacing classes
|
|
2642
|
+
const textClassMap$1 = {
|
|
2643
|
+
small: 'tw-text-body-small tw-tracking-body-small tw-leading-body-small',
|
|
2644
|
+
medium: 'tw-text-body-medium tw-tracking-body-medium tw-leading-body-medium',
|
|
2645
|
+
large: 'tw-text-body-large tw-tracking-body-large tw-leading-body-large',
|
|
2646
|
+
};
|
|
2647
|
+
function BodyText(_a) {
|
|
2648
|
+
var { size, children, bold } = _a, props = __rest(_a, ["size", "children", "bold"]);
|
|
2649
|
+
const fontWeightClass = bold
|
|
2650
|
+
? 'tw-font-typography-bold'
|
|
2651
|
+
: 'tw-font-typography-regular';
|
|
2652
|
+
return (jsx("span", Object.assign({}, props, { className: cn(textClassMap$1[size], fontWeightClass, props.className), children: children })));
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
const baseButtonClassName = 'tw-border tw-relative tw-overflow-hidden tw-group/base-button tw-flex tw-items-center tw-justify-center';
|
|
2656
|
+
const buttonSizeClassMap = {
|
|
2657
|
+
md: 'tw-px-squid-xs tw-py-squid-xxs tw-min-w-[60px] tw-h-squid-xl',
|
|
2658
|
+
lg: 'tw-p-1 tw-h-button tw-w-full',
|
|
2659
|
+
};
|
|
2660
|
+
const roundedClassMap = {
|
|
2661
|
+
md: 'tw-rounded-squid-m',
|
|
2662
|
+
lg: 'tw-rounded-squid-xxl',
|
|
2663
|
+
};
|
|
2664
|
+
const buttonVariantClassMap = {
|
|
2665
|
+
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
|
|
2666
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2667
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2668
|
+
};
|
|
2669
|
+
// right now all variants have the same disabled styles
|
|
2670
|
+
// in the future, we can add more disabled styles for different variants
|
|
2671
|
+
const buttonDisabledClass = '!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed';
|
|
2672
|
+
function Button(_a) {
|
|
2673
|
+
var { label, disabled, size, variant, icon, link } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
|
|
2674
|
+
const children = (jsxs(Fragment, { children: [!disabled && jsx(ButtonHoverOverlay, { className: roundedClassMap[size] }), jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: !label && !icon ? (props.children) : size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2675
|
+
// label only
|
|
2676
|
+
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2677
|
+
// icon only
|
|
2678
|
+
icon) : (
|
|
2679
|
+
// icon and label
|
|
2680
|
+
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
|
|
2681
|
+
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], roundedClassMap[size],
|
|
2682
|
+
// disabled styles
|
|
2683
|
+
disabled && buttonDisabledClass,
|
|
2684
|
+
// custom classes from props
|
|
2685
|
+
props.className);
|
|
2686
|
+
if (link) {
|
|
2687
|
+
return (jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
|
|
2688
|
+
}
|
|
2689
|
+
return (jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
|
|
2690
|
+
}
|
|
2691
|
+
const ButtonHoverOverlay = ({ className }) => {
|
|
2692
|
+
return (jsx("span", { className: cn('tw-absolute tw-inset-0 tw-z-0 tw-hidden tw-h-full tw-w-full tw-bg-material-light-thin group-hover/base-button:tw-block', className) }));
|
|
2693
|
+
};
|
|
2694
|
+
|
|
2655
2695
|
function AddressButton(_a) {
|
|
2656
2696
|
var { label, imageUrl, badgeUrl, isLoading } = _a, props = __rest(_a, ["label", "imageUrl", "badgeUrl", "isLoading"]);
|
|
2657
|
-
return (jsx(
|
|
2697
|
+
return (jsx(Button, Object.assign({ size: "md", variant: "tertiary" }, props, { disabled: isLoading, className: !isLoading && imageUrl ? 'tw-pl-1 tw-pr-4' : '!tw-px-4', children: isLoading ? (jsx("span", { className: "tw-mx-auto tw-px-4", children: jsx(Loader, {}) })) : (jsxs(Fragment, { children: [jsx(BadgeImage, { imageUrl: imageUrl, badgeUrl: badgeUrl, extraMarginForBadge: true, rounded: true }), jsx(BodyText, { size: "small", children: label })] })) })));
|
|
2658
2698
|
}
|
|
2659
2699
|
|
|
2660
2700
|
function ArrowRightIcon() {
|
|
@@ -2687,9 +2727,7 @@ function SquareArrowTopRight2Icon({ className, size = '16', }) {
|
|
|
2687
2727
|
|
|
2688
2728
|
function ArrowButton(_a) {
|
|
2689
2729
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
2690
|
-
return (jsxs(
|
|
2691
|
-
// disabled styles
|
|
2692
|
-
'disabled:tw-bg-grey-800 disabled:tw-text-grey-600'), children: [jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) }), jsx("span", { "aria-disabled": disabled, className: clsx('tw-flex tw-aspect-square tw-h-[52px] tw-w-[52px] tw-items-center tw-justify-center tw-rounded-full tw-bg-royal-500 tw-text-grey-100',
|
|
2730
|
+
return (jsxs(Button, Object.assign({ size: "lg", variant: "tertiary" }, props, { disabled: disabled, children: [jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) }), jsx("span", { "aria-disabled": disabled, className: clsx('tw-flex tw-aspect-square tw-h-[52px] tw-w-[52px] tw-items-center tw-justify-center tw-rounded-full tw-bg-royal-500 tw-text-grey-100',
|
|
2693
2731
|
// disabled styles
|
|
2694
2732
|
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsx(ArrowRightIcon, {}) })] })));
|
|
2695
2733
|
}
|
|
@@ -2798,15 +2836,15 @@ function SearchIcon() {
|
|
|
2798
2836
|
|
|
2799
2837
|
function Input(_a) {
|
|
2800
2838
|
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon, isError = false, onPasteButtonClick } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon", "isError", "onPasteButtonClick"]);
|
|
2801
|
-
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", 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-
|
|
2839
|
+
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", 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-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[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, showPasteButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(PasteButton, { onClick: onPasteButtonClick }) })) : null] }));
|
|
2802
2840
|
}
|
|
2803
2841
|
const PasteButton = ({ onClick }) => {
|
|
2804
|
-
return (jsx("
|
|
2842
|
+
return (jsx(Button, { size: "md", variant: "tertiary", onClick: onClick, className: "!tw-h-[30px] !tw-w-fit tw-min-w-0 !tw-px-2", children: jsx(CaptionText, { children: "Paste" }) }));
|
|
2805
2843
|
};
|
|
2806
2844
|
|
|
2807
2845
|
const NumericInput = (_a) => {
|
|
2808
2846
|
var _b;
|
|
2809
|
-
var { onParsedValueChanged, initialValue = '', forcedUpdateValue, maxDecimals, balance,
|
|
2847
|
+
var { onParsedValueChanged, initialValue = '', forcedUpdateValue, maxDecimals, balance = '0', tokenPrice = 0 } = _a, props = __rest(_a, ["onParsedValueChanged", "initialValue", "forcedUpdateValue", "maxDecimals", "balance", "tokenPrice"]);
|
|
2810
2848
|
const [inputValue, setInputValue] = useState(initialValue);
|
|
2811
2849
|
// Probably a better way to handle this
|
|
2812
2850
|
// This was introduce to handle the "MAX" button setting an amount
|
|
@@ -2922,8 +2960,12 @@ const NumericInput = (_a) => {
|
|
|
2922
2960
|
}
|
|
2923
2961
|
if (inputValue.includes('$')) {
|
|
2924
2962
|
const usdAmount = Number(inputValue.replace('$', ''));
|
|
2925
|
-
if (usdAmount
|
|
2926
|
-
|
|
2963
|
+
if (tokenPrice === 0 || usdAmount === 0) {
|
|
2964
|
+
setInputValue('0');
|
|
2965
|
+
onParsedValueChanged('0');
|
|
2966
|
+
}
|
|
2967
|
+
else if (usdAmount > 0) {
|
|
2968
|
+
const newValue = usdAmount / Number(tokenPrice);
|
|
2927
2969
|
const newValueFormatted = newValue.toFixed(4);
|
|
2928
2970
|
setInputValue(newValueFormatted);
|
|
2929
2971
|
onParsedValueChanged(newValueFormatted);
|
|
@@ -3066,39 +3108,6 @@ function generateMarkerLines(count) {
|
|
|
3066
3108
|
return allShadows.join(', ');
|
|
3067
3109
|
}
|
|
3068
3110
|
|
|
3069
|
-
const baseButtonClassName = 'tw-flex tw-items-center tw-gap-squid-xxs tw-justify-center tw-border';
|
|
3070
|
-
const buttonSizeClassMap = {
|
|
3071
|
-
md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-min-w-[60px] tw-h-squid-xl',
|
|
3072
|
-
lg: 'tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
3073
|
-
};
|
|
3074
|
-
const buttonVariantClassMap = {
|
|
3075
|
-
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
|
|
3076
|
-
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
3077
|
-
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
3078
|
-
};
|
|
3079
|
-
// right now all variants have the same disabled styles
|
|
3080
|
-
// in the future, we can add more disabled styles for different variants
|
|
3081
|
-
const buttonDisabledClass = '!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed';
|
|
3082
|
-
function Button(_a) {
|
|
3083
|
-
var { label, disabled, size, variant, icon, link } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
|
|
3084
|
-
const children = (jsx(Fragment, { children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
3085
|
-
// label only
|
|
3086
|
-
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
3087
|
-
// icon only
|
|
3088
|
-
icon) : (
|
|
3089
|
-
// icon and label
|
|
3090
|
-
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null }));
|
|
3091
|
-
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
3092
|
-
// disabled styles
|
|
3093
|
-
disabled && buttonDisabledClass,
|
|
3094
|
-
// custom classes from props
|
|
3095
|
-
props.className);
|
|
3096
|
-
if (link) {
|
|
3097
|
-
return (jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
|
|
3098
|
-
}
|
|
3099
|
-
return (jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
3111
|
function Chip(_a) {
|
|
3103
3112
|
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
3104
3113
|
return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
@@ -3151,7 +3160,7 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3151
3160
|
return 'full';
|
|
3152
3161
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3153
3162
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3154
|
-
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] 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(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-group/arrow-button tw-border-transparent tw-bg-transparent
|
|
3163
|
+
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] 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(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-group/arrow-button tw-border-transparent tw-bg-transparent", icon: jsx(ChevronLargeDownIcon, { className: "tw-transition-transform tw-duration-150 group-hover/arrow-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 }) })] })) }));
|
|
3155
3164
|
}
|
|
3156
3165
|
|
|
3157
3166
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -3293,23 +3302,33 @@ function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount,
|
|
|
3293
3302
|
}
|
|
3294
3303
|
|
|
3295
3304
|
const listItemSizeMap = {
|
|
3296
|
-
small: 'tw-
|
|
3297
|
-
large: 'tw-
|
|
3305
|
+
small: 'tw-h-list-item-small tw-px-squid-xs',
|
|
3306
|
+
large: 'tw-h-list-item-large tw-px-squid-xs',
|
|
3298
3307
|
};
|
|
3299
3308
|
function ListItem(_a) {
|
|
3300
3309
|
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading, containerProps } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps"]);
|
|
3301
3310
|
// 'small' variant does not have detail
|
|
3302
3311
|
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
3303
|
-
|
|
3312
|
+
const isDetailInteractive = !!onDetailClick;
|
|
3313
|
+
const DetailTag = isDetailInteractive ? 'button' : 'div';
|
|
3314
|
+
const detailProps = isDetailInteractive
|
|
3315
|
+
? {
|
|
3316
|
+
onClick: (event) => {
|
|
3317
|
+
// prevent click event from bubbling up to parent
|
|
3318
|
+
event.stopPropagation();
|
|
3319
|
+
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
3320
|
+
},
|
|
3321
|
+
}
|
|
3322
|
+
: {};
|
|
3323
|
+
const isInteractive = !!props.onClick;
|
|
3324
|
+
const ItemTag = isInteractive ? 'button' : 'div';
|
|
3325
|
+
const itemProps = isInteractive ? props : {};
|
|
3326
|
+
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',
|
|
3304
3327
|
// 'large' variant has extra padding
|
|
3305
3328
|
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' &&
|
|
3306
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsx(CaptionText, { className: "tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500", children: subtitle })) : null)] }), showDetail && (jsxs(
|
|
3307
|
-
// prevent click event from bubbling up to parent
|
|
3308
|
-
event.stopPropagation();
|
|
3309
|
-
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
3310
|
-
}, className: cn('tw-flex tw-w-fit tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
3329
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsx(CaptionText, { className: "tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500", children: 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
|
|
3311
3330
|
? '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'
|
|
3312
|
-
: 'tw-flex', 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] }))] })) })));
|
|
3331
|
+
: '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] })))] })) })));
|
|
3313
3332
|
}
|
|
3314
3333
|
|
|
3315
3334
|
function MenuItem({ label, imageUrl, icon }) {
|
|
@@ -3333,7 +3352,7 @@ function SettingsItem({ icon, label, control, link, transparent = false, helpToo
|
|
|
3333
3352
|
target: '_blank',
|
|
3334
3353
|
}
|
|
3335
3354
|
: {};
|
|
3336
|
-
const helpIcon = !!helpTooltip && (jsx(HelpIcon, { className:
|
|
3355
|
+
const helpIcon = !!helpTooltip && (jsx(HelpIcon, { className: "tw-cursor-help tw-text-grey-600 hover:tw-text-grey-400" }));
|
|
3337
3356
|
const showDetailsBorder = !!control && !link && !(control.type === 'switch');
|
|
3338
3357
|
return (jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-800'), children: jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsx(Fragment, { children: helpIcon }))] }), jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', showDetailsBorder &&
|
|
3339
3358
|
'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (!!control && (jsxs(Fragment, { children: [control.type === 'amount' && (jsxs(Fragment, { children: [jsx(SettingsButton, { onClick: () => control.onChange(control.resetValueControl.value), label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value }), control.options.map(({ value }, index, _controls) => (jsx(SettingsButton, { label: '$' + value, isSelected: control.value === value, onClick: () => control.onChange(value) }, index))), jsx(SettingsSlider, { type: control.type, value: control.value, onChange: control.onChange, hasDecimals: false, max: 999 })] })), control.type === 'switch' &&
|
|
@@ -3467,8 +3486,8 @@ function SwapInputsIcon() {
|
|
|
3467
3486
|
}
|
|
3468
3487
|
|
|
3469
3488
|
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
3470
|
-
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage = 5, emptyAddressLabel = 'Connect wallet', }) {
|
|
3471
|
-
var _a;
|
|
3489
|
+
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage = 5, emptyAddressLabel = 'Connect wallet', }) {
|
|
3490
|
+
var _a, _b;
|
|
3472
3491
|
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
3473
3492
|
? 'tw-text-status-negative'
|
|
3474
3493
|
: 'tw-text-grey-300';
|
|
@@ -3476,7 +3495,7 @@ function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAm
|
|
|
3476
3495
|
const BalanceChipTag = isBalanceChipInteractive ? 'button' : 'div';
|
|
3477
3496
|
const isSwapAmountChipInteractive = !!onSwapAmountButtonClick;
|
|
3478
3497
|
const SwapAmountChipTag = isSwapAmountChipInteractive ? 'button' : 'div';
|
|
3479
|
-
return (jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-[480px] 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-animate-move-loading-cover-to-right tw-bg-dark-cover
|
|
3498
|
+
return (jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-[480px] 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" }) })), direction === 'from' ? (jsx(NumericInput, { balance: balance, tokenPrice: tokenPrice, forcedUpdateValue: forcedAmount, initialValue: amount, maxDecimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18, onParsedValueChanged: (value) => onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value) })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-m tw-pb-[15px] tw-pt-[5px]', isFetching && 'tw-opacity-50'), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: amount }) }) })), !(token === null || token === void 0 ? void 0 : token.iconUrl) ? null : (jsxs("footer", { className: cn('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', isFetching && 'tw-opacity-50'), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs(SwapAmountChipTag, { onClick: onSwapAmountButtonClick, className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isSwapAmountChipInteractive && interactiveChipClassName), children: [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(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn('tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs', isBalanceChipInteractive && interactiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs(CaptionText, { children: [balance, " ", token.symbol] }), jsx(MaxIcon, {})] })] }))] }));
|
|
3480
3499
|
}
|
|
3481
3500
|
|
|
3482
3501
|
function SwapProgressViewHeader({ title, description, }) {
|
|
@@ -3514,7 +3533,7 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
|
3514
3533
|
};
|
|
3515
3534
|
}, [isShowRouteAnimationRunning]);
|
|
3516
3535
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3517
|
-
return (jsxs(Fragment, { children: [jsxs("button", { className: "tw-group/swap-step-item-button tw-relative tw-max-h-button tw-max-w-[400px] tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800
|
|
3536
|
+
return (jsxs(Fragment, { children: [jsxs("button", { className: "tw-group/swap-step-item-button tw-relative tw-max-h-button tw-max-w-[400px] tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800 hover:tw-bg-grey-700", onClick: () => {
|
|
3518
3537
|
// mount route component and start animation
|
|
3519
3538
|
setIsRouteVisible(true);
|
|
3520
3539
|
setIsShowRouteAnimationRunning(true);
|
|
@@ -5,7 +5,7 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
5
5
|
forcedUpdateValue?: string;
|
|
6
6
|
maxDecimals?: number;
|
|
7
7
|
balance?: string;
|
|
8
|
-
|
|
8
|
+
tokenPrice?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance,
|
|
10
|
+
export declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -5,6 +5,7 @@ interface SwapConfigurationProps {
|
|
|
5
5
|
amount?: string;
|
|
6
6
|
forcedAmount?: string;
|
|
7
7
|
swapAmountUsd?: string;
|
|
8
|
+
tokenPrice?: number;
|
|
8
9
|
balance?: string;
|
|
9
10
|
isFetching?: boolean;
|
|
10
11
|
chain?: {
|
|
@@ -16,6 +17,7 @@ interface SwapConfigurationProps {
|
|
|
16
17
|
symbol: string;
|
|
17
18
|
bgColor: string;
|
|
18
19
|
textColor: string;
|
|
20
|
+
decimals: number;
|
|
19
21
|
};
|
|
20
22
|
address?: string;
|
|
21
23
|
onAmountChange?: (amount: string) => void;
|
|
@@ -29,5 +31,5 @@ interface SwapConfigurationProps {
|
|
|
29
31
|
emptyAddressLabel?: string;
|
|
30
32
|
onSwapAmountButtonClick?: () => void;
|
|
31
33
|
}
|
|
32
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
33
35
|
export {};
|
|
@@ -7,6 +7,8 @@ export declare const MediumPrimary: Story;
|
|
|
7
7
|
export declare const MediumSecondary: Story;
|
|
8
8
|
export declare const MediumTertiary: Story;
|
|
9
9
|
export declare const MediumDisabled: Story;
|
|
10
|
+
export declare const MediumAndLink: Story;
|
|
11
|
+
export declare const MediumAndLinkDisabled: Story;
|
|
10
12
|
export declare const MediumPrimaryIconOnly: Story;
|
|
11
13
|
export declare const MediumSecondaryIconOnly: Story;
|
|
12
14
|
export declare const MediumTertiaryIconOnly: Story;
|
|
@@ -4,21 +4,21 @@ declare const meta: Meta<typeof ListItem>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Large: Story;
|
|
7
|
+
export declare const LargeInteractive: Story;
|
|
7
8
|
export declare const LargeWithLongTitle: Story;
|
|
8
9
|
export declare const LargeWithLongTitleAndSubtitle: Story;
|
|
9
10
|
export declare const LargeRoundedFull: Story;
|
|
10
11
|
export declare const LargeWithSubtitle: Story;
|
|
11
12
|
export declare const LargeWithDetail: Story;
|
|
12
13
|
export declare const LargeWithIcon: Story;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const LargeWithDetailAndIconInteractive: Story;
|
|
14
15
|
export declare const LargeShowDetailOnHoverOnly: Story;
|
|
15
16
|
export declare const LargeWithSecondaryImage: Story;
|
|
16
17
|
export declare const LargeSelected: Story;
|
|
17
18
|
export declare const LargeWithCustomIconAsImage: Story;
|
|
18
19
|
export declare const LargeLoading: Story;
|
|
19
20
|
export declare const Small: Story;
|
|
21
|
+
export declare const SmallInteractive: Story;
|
|
20
22
|
export declare const SmallWithLongTitle: Story;
|
|
21
|
-
export declare const SmallWithIcon: Story;
|
|
22
|
-
export declare const SmallShowDetailOnHoverOnly: Story;
|
|
23
23
|
export declare const SmallSelected: Story;
|
|
24
24
|
export declare const SmallWithCustomIconAsImage: Story;
|
package/dist/index.css
CHANGED
|
@@ -781,6 +781,10 @@ video {
|
|
|
781
781
|
z-index: 50;
|
|
782
782
|
}
|
|
783
783
|
|
|
784
|
+
.tw-z-\[5\] {
|
|
785
|
+
z-index: 5;
|
|
786
|
+
}
|
|
787
|
+
|
|
784
788
|
.tw-m-0 {
|
|
785
789
|
margin: 0px;
|
|
786
790
|
}
|
|
@@ -860,6 +864,10 @@ video {
|
|
|
860
864
|
aspect-ratio: 1 / 1;
|
|
861
865
|
}
|
|
862
866
|
|
|
867
|
+
.\!tw-h-\[30px\] {
|
|
868
|
+
height: 30px !important;
|
|
869
|
+
}
|
|
870
|
+
|
|
863
871
|
.tw-h-1 {
|
|
864
872
|
height: 0.25rem;
|
|
865
873
|
}
|
|
@@ -924,10 +932,6 @@ video {
|
|
|
924
932
|
height: 30px;
|
|
925
933
|
}
|
|
926
934
|
|
|
927
|
-
.tw-h-\[34px\] {
|
|
928
|
-
height: 34px;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
935
|
.tw-h-\[40px\] {
|
|
932
936
|
height: 40px;
|
|
933
937
|
}
|
|
@@ -1076,6 +1080,11 @@ video {
|
|
|
1076
1080
|
min-height: 1.875rem;
|
|
1077
1081
|
}
|
|
1078
1082
|
|
|
1083
|
+
.\!tw-w-fit {
|
|
1084
|
+
width: -moz-fit-content !important;
|
|
1085
|
+
width: fit-content !important;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1079
1088
|
.tw-w-1\/2 {
|
|
1080
1089
|
width: 50%;
|
|
1081
1090
|
}
|
|
@@ -1156,10 +1165,6 @@ video {
|
|
|
1156
1165
|
width: 30px;
|
|
1157
1166
|
}
|
|
1158
1167
|
|
|
1159
|
-
.tw-w-\[34px\] {
|
|
1160
|
-
width: 34px;
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
1168
|
.tw-w-\[36px\] {
|
|
1164
1169
|
width: 36px;
|
|
1165
1170
|
}
|
|
@@ -1274,6 +1279,10 @@ video {
|
|
|
1274
1279
|
width: 3.75rem;
|
|
1275
1280
|
}
|
|
1276
1281
|
|
|
1282
|
+
.tw-min-w-0 {
|
|
1283
|
+
min-width: 0px;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1277
1286
|
.tw-min-w-96 {
|
|
1278
1287
|
min-width: 24rem;
|
|
1279
1288
|
}
|
|
@@ -1294,10 +1303,6 @@ video {
|
|
|
1294
1303
|
min-width: 2.5rem;
|
|
1295
1304
|
}
|
|
1296
1305
|
|
|
1297
|
-
.tw-min-w-squid-xxl {
|
|
1298
|
-
min-width: 3.75rem;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
1306
|
.tw-max-w-\[180px\] {
|
|
1302
1307
|
max-width: 180px;
|
|
1303
1308
|
}
|
|
@@ -1326,14 +1331,6 @@ video {
|
|
|
1326
1331
|
max-width: 100%;
|
|
1327
1332
|
}
|
|
1328
1333
|
|
|
1329
|
-
.tw-max-w-list-item-large {
|
|
1330
|
-
max-width: 23.75rem;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
.tw-max-w-list-item-small {
|
|
1334
|
-
max-width: 21.25rem;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
1334
|
.tw-max-w-none {
|
|
1338
1335
|
max-width: none;
|
|
1339
1336
|
}
|
|
@@ -1805,10 +1802,6 @@ video {
|
|
|
1805
1802
|
border-style: solid;
|
|
1806
1803
|
}
|
|
1807
1804
|
|
|
1808
|
-
.tw-border-grey-700 {
|
|
1809
|
-
border-color: var(--squid-theme-grey-700);
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
1805
|
.tw-border-grey-800 {
|
|
1813
1806
|
border-color: var(--squid-theme-grey-800);
|
|
1814
1807
|
}
|
|
@@ -2021,6 +2014,16 @@ video {
|
|
|
2021
2014
|
padding: 0.625rem;
|
|
2022
2015
|
}
|
|
2023
2016
|
|
|
2017
|
+
.\!tw-px-2 {
|
|
2018
|
+
padding-left: 0.5rem !important;
|
|
2019
|
+
padding-right: 0.5rem !important;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.\!tw-px-4 {
|
|
2023
|
+
padding-left: 1rem !important;
|
|
2024
|
+
padding-right: 1rem !important;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2024
2027
|
.\!tw-px-squid-m {
|
|
2025
2028
|
padding-left: 1.25rem !important;
|
|
2026
2029
|
padding-right: 1.25rem !important;
|
|
@@ -2304,10 +2307,6 @@ video {
|
|
|
2304
2307
|
font-weight: 400;
|
|
2305
2308
|
}
|
|
2306
2309
|
|
|
2307
|
-
.tw-font-medium {
|
|
2308
|
-
font-weight: 500;
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
2310
|
.tw-font-semibold {
|
|
2312
2311
|
font-weight: 600;
|
|
2313
2312
|
}
|
|
@@ -2594,18 +2593,10 @@ video {
|
|
|
2594
2593
|
transition-duration: 150ms;
|
|
2595
2594
|
}
|
|
2596
2595
|
|
|
2597
|
-
.tw-duration-200 {
|
|
2598
|
-
transition-duration: 200ms;
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
2596
|
.tw-duration-300 {
|
|
2602
2597
|
transition-duration: 300ms;
|
|
2603
2598
|
}
|
|
2604
2599
|
|
|
2605
|
-
.tw-duration-\[50ms\] {
|
|
2606
|
-
transition-duration: 50ms;
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2609
2600
|
.tw-ease-in-out {
|
|
2610
2601
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
2611
2602
|
}
|
|
@@ -2749,18 +2740,14 @@ input[type='number'] {
|
|
|
2749
2740
|
outline-offset: 2px;
|
|
2750
2741
|
}
|
|
2751
2742
|
|
|
2752
|
-
.disabled\:tw-bg-grey-800:disabled {
|
|
2753
|
-
background-color: var(--squid-theme-grey-800);
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2756
|
-
.disabled\:tw-text-grey-600:disabled {
|
|
2757
|
-
color: var(--squid-theme-grey-600);
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
2743
|
.disabled\:tw-opacity-60:disabled {
|
|
2761
2744
|
opacity: 0.6;
|
|
2762
2745
|
}
|
|
2763
2746
|
|
|
2747
|
+
.tw-group\/base-button:hover .group-hover\/base-button\:tw-block {
|
|
2748
|
+
display: block;
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2764
2751
|
.tw-group\/history-item:hover .group-hover\/history-item\:tw-hidden {
|
|
2765
2752
|
display: none;
|
|
2766
2753
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -121,9 +121,9 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
121
121
|
forcedUpdateValue?: string;
|
|
122
122
|
maxDecimals?: number;
|
|
123
123
|
balance?: string;
|
|
124
|
-
|
|
124
|
+
tokenPrice?: number;
|
|
125
125
|
}
|
|
126
|
-
declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance,
|
|
126
|
+
declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, ...props }: Props) => react_jsx_runtime.JSX.Element;
|
|
127
127
|
|
|
128
128
|
interface SettingsSliderProps {
|
|
129
129
|
value: number;
|
|
@@ -394,6 +394,7 @@ interface SwapConfigurationProps {
|
|
|
394
394
|
amount?: string;
|
|
395
395
|
forcedAmount?: string;
|
|
396
396
|
swapAmountUsd?: string;
|
|
397
|
+
tokenPrice?: number;
|
|
397
398
|
balance?: string;
|
|
398
399
|
isFetching?: boolean;
|
|
399
400
|
chain?: {
|
|
@@ -405,6 +406,7 @@ interface SwapConfigurationProps {
|
|
|
405
406
|
symbol: string;
|
|
406
407
|
bgColor: string;
|
|
407
408
|
textColor: string;
|
|
409
|
+
decimals: number;
|
|
408
410
|
};
|
|
409
411
|
address?: string;
|
|
410
412
|
onAmountChange?: (amount: string) => void;
|
|
@@ -418,7 +420,7 @@ interface SwapConfigurationProps {
|
|
|
418
420
|
emptyAddressLabel?: string;
|
|
419
421
|
onSwapAmountButtonClick?: () => void;
|
|
420
422
|
}
|
|
421
|
-
declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
423
|
+
declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
422
424
|
|
|
423
425
|
interface SwapProgressViewHeaderProps {
|
|
424
426
|
title: string;
|