@0xsquid/ui 0.8.3 → 0.9.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/README.md +22 -0
- package/dist/cjs/index.js +104 -65
- package/dist/cjs/types/components/badges/index.d.ts +1 -0
- package/dist/cjs/types/components/controls/Input.d.ts +2 -2
- package/dist/cjs/types/components/controls/Tooltip.d.ts +1 -2
- package/dist/cjs/types/components/layout/DropdownMenu.d.ts +4 -1
- package/dist/cjs/types/components/layout/InfoBox.d.ts +8 -0
- package/dist/cjs/types/components/layout/Menu.d.ts +2 -1
- package/dist/cjs/types/components/layout/index.d.ts +1 -0
- package/dist/cjs/types/components/lists/DropdownMenuItem.d.ts +2 -1
- package/dist/cjs/types/components/lists/HistoryItem.d.ts +3 -1
- package/dist/cjs/types/components/lists/SettingsItem.d.ts +4 -1
- package/dist/cjs/types/hooks/index.d.ts +1 -1
- package/dist/cjs/types/hooks/useDropdownMenu.d.ts +10 -0
- package/dist/cjs/types/stories/buttons/AssetsButton.stories.d.ts +2 -1
- package/dist/cjs/types/stories/layout/InfoBox.stories.d.ts +7 -0
- package/dist/cjs/types/stories/lists/HistoryItem.stories.d.ts +1 -0
- package/dist/cjs/types/stories/lists/SettingsItem.stories.d.ts +2 -0
- package/dist/esm/index.js +102 -65
- package/dist/esm/types/components/badges/index.d.ts +1 -0
- package/dist/esm/types/components/controls/Input.d.ts +2 -2
- package/dist/esm/types/components/controls/Tooltip.d.ts +1 -2
- package/dist/esm/types/components/layout/DropdownMenu.d.ts +4 -1
- package/dist/esm/types/components/layout/InfoBox.d.ts +8 -0
- package/dist/esm/types/components/layout/Menu.d.ts +2 -1
- package/dist/esm/types/components/layout/index.d.ts +1 -0
- package/dist/esm/types/components/lists/DropdownMenuItem.d.ts +2 -1
- package/dist/esm/types/components/lists/HistoryItem.d.ts +3 -1
- package/dist/esm/types/components/lists/SettingsItem.d.ts +4 -1
- package/dist/esm/types/hooks/index.d.ts +1 -1
- package/dist/esm/types/hooks/useDropdownMenu.d.ts +10 -0
- package/dist/esm/types/stories/buttons/AssetsButton.stories.d.ts +2 -1
- package/dist/esm/types/stories/layout/InfoBox.stories.d.ts +7 -0
- package/dist/esm/types/stories/lists/HistoryItem.stories.d.ts +1 -0
- package/dist/esm/types/stories/lists/SettingsItem.stories.d.ts +2 -0
- package/dist/index.css +34 -10
- package/dist/index.d.ts +34 -14
- package/package.json +1 -1
- package/dist/cjs/types/hooks/useModal.d.ts +0 -10
- package/dist/esm/types/hooks/useModal.d.ts +0 -10
package/dist/esm/index.js
CHANGED
|
@@ -2561,6 +2561,10 @@ function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, roun
|
|
|
2561
2561
|
return imageUrl ? (jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [jsx("img", { src: imageUrl, alt: "", className: cn('tw-h-full tw-w-full', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs') }), badgeUrl ? (jsx("img", { src: badgeUrl, alt: "", className: cn('tw-absolute -tw-right-1/3 tw-bottom-0 tw-z-10 tw-m-0 -tw-translate-x-1/3 tw-rounded-md tw-border-[1px] tw-border-grey-800', badgeSizeClassMap[size]) })) : null] })) : null;
|
|
2562
2562
|
}
|
|
2563
2563
|
|
|
2564
|
+
function LoadingSkeleton({ className, height = '20', }) {
|
|
2565
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100", height: height, viewBox: "0 0 100 20", fill: "none", className: className, children: [jsxs("g", { "clip-path": "url(#clip0_1083_18992)", children: [jsx("mask", { id: "mask0_1083_18992", style: { maskType: 'alpha' }, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "100", height: "20", children: jsx("rect", { width: "100", height: "20", fill: "url(#paint0_linear_1083_18992)" }) }), jsx("g", { mask: "url(#mask0_1083_18992)", children: jsx("rect", { width: "100", height: "20", fill: "currentColor" }) })] }), jsxs("defs", { children: [jsxs("linearGradient", { id: "paint0_linear_1083_18992", x1: "0", y1: "10", x2: "100", y2: "10", gradientUnits: "userSpaceOnUse", className: "tw-animate-loading-gradient", children: [jsx("stop", { "stop-color": "#D9D9D9", "stop-opacity": "0.33" }), jsx("stop", { offset: "0.395881", "stop-color": "#737373", "stop-opacity": "0.33" }), jsx("stop", { offset: "0.597867", "stop-color": "#737373", "stop-opacity": "0.66" }), jsx("stop", { offset: "0.697004", "stop-color": "#737373", "stop-opacity": "0.33" })] }), jsx("clipPath", { id: "clip0_1083_18992", children: jsx("path", { d: "M0 10C0 4.47715 4.47715 0 10 0H90C95.5228 0 100 4.47715 100 10C100 15.5228 95.5229 20 90 20H10C4.47716 20 0 15.5228 0 10Z", fill: "white" }) })] })] }));
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2564
2568
|
/******************************************************************************
|
|
2565
2569
|
Copyright (c) Microsoft Corporation.
|
|
2566
2570
|
|
|
@@ -2666,10 +2670,6 @@ function ArrowButton(_a) {
|
|
|
2666
2670
|
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsx(ArrowRightIcon, {}) })] })));
|
|
2667
2671
|
}
|
|
2668
2672
|
|
|
2669
|
-
function PlusIcon() {
|
|
2670
|
-
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
|
|
2671
|
-
}
|
|
2672
|
-
|
|
2673
2673
|
const SQUID_THEME_CSS_VARIABLE_PREFIX = '--squid-theme-';
|
|
2674
2674
|
/**
|
|
2675
2675
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
@@ -2776,6 +2776,10 @@ const themeTypesKeys = {
|
|
|
2776
2776
|
},
|
|
2777
2777
|
};
|
|
2778
2778
|
|
|
2779
|
+
function PlusIcon() {
|
|
2780
|
+
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2779
2783
|
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2780
2784
|
const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
|
|
2781
2785
|
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, onClick, }) {
|
|
@@ -2795,7 +2799,7 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2795
2799
|
}, children: jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px] tw-rounded-full" }) })) : 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: {
|
|
2796
2800
|
backgroundColor: tokenBgColor,
|
|
2797
2801
|
color: tokenTextColor,
|
|
2798
|
-
}, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, { className: "tw-
|
|
2802
|
+
}, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
|
|
2799
2803
|
}
|
|
2800
2804
|
|
|
2801
2805
|
function SearchIcon() {
|
|
@@ -2803,8 +2807,8 @@ function SearchIcon() {
|
|
|
2803
2807
|
}
|
|
2804
2808
|
|
|
2805
2809
|
function Input(_a) {
|
|
2806
|
-
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon,
|
|
2807
|
-
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { 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-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5',
|
|
2810
|
+
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon, isError = false, onPasteButtonClick } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon", "isError", "onPasteButtonClick"]);
|
|
2811
|
+
return (jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsx("input", Object.assign({}, props, { 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-medium tw-text-grey-300 tw-outline-none tw-outline-offset-0 placeholder:tw-text-grey-600 focus:tw-outline-2', showIcon ? 'tw-pl-[44px]' : 'tw-px-2.5', showPasteButton ? 'tw-px-[70px]' : 'tw-pr-2.5', isError ? 'tw-outline-status-negative' : 'focus:tw-outline-royal-500', 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] }));
|
|
2808
2812
|
}
|
|
2809
2813
|
const PasteButton = ({ onClick }) => {
|
|
2810
2814
|
return (jsx("button", { onClick: onClick, className: "tw-h-[30px] tw-rounded-full tw-border tw-border-grey-700 tw-bg-grey-800 tw-px-2 tw-text-grey-300", children: jsx(CaptionText, { children: "Paste" }) }));
|
|
@@ -2953,7 +2957,7 @@ function HeadingText({ children, bold, size }) {
|
|
|
2953
2957
|
}
|
|
2954
2958
|
|
|
2955
2959
|
function SettingsSlider({ value, type }) {
|
|
2956
|
-
return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-xs tw-border-royal-500 tw-p-squid-xs", children: [jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) }), jsx(CaptionText, { className: "tw-text-grey-300", children: "%" })] })) : (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-grey-300", children: "$" }), jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) })] })) }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
|
|
2960
|
+
return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-xs tw-border-royal-500 tw-p-squid-xs", children: [jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxs(Fragment, { children: [jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) }), jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "%" })] })) : (jsxs(Fragment, { children: [jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "$" }), jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) })] })) }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
|
|
2957
2961
|
}
|
|
2958
2962
|
|
|
2959
2963
|
const switchSizeClassMap = {
|
|
@@ -2989,8 +2993,8 @@ const borderRadiusClassMap = {
|
|
|
2989
2993
|
lg: 'tw-rounded-squid-m',
|
|
2990
2994
|
};
|
|
2991
2995
|
function Menu(_a) {
|
|
2992
|
-
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg' } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded"]);
|
|
2993
|
-
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsx("div", { className: "tw-z-20", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2996
|
+
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
|
|
2997
|
+
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsx("div", { className: "tw-z-20 tw-max-w-full", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2994
2998
|
}
|
|
2995
2999
|
|
|
2996
3000
|
const tooltipWidthClassMap = {
|
|
@@ -3088,7 +3092,7 @@ function FeeButton(_a) {
|
|
|
3088
3092
|
}
|
|
3089
3093
|
|
|
3090
3094
|
function SettingsButton({ label }) {
|
|
3091
|
-
return (jsx("button", { className: "tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs", children: jsx(CaptionText, { children: label }) }));
|
|
3095
|
+
return (jsx("button", { className: "tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs", children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
3092
3096
|
}
|
|
3093
3097
|
|
|
3094
3098
|
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, }) {
|
|
@@ -3125,21 +3129,21 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3125
3129
|
return (jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (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-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), 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 }) })] })) }));
|
|
3126
3130
|
}
|
|
3127
3131
|
|
|
3128
|
-
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
3129
|
-
return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-
|
|
3132
|
+
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
3133
|
+
return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", onClick: onClick, children: jsxs("div", { className: "tw-flex tw-h-squid-l tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-px-squid-xxs hover:tw-bg-material-light-thin", children: [jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsx(CaptionText, { className: cn(labelClassName, 'tw-max-w-full tw-truncate !tw-leading-[18px]'), children: label })] }) }));
|
|
3130
3134
|
}
|
|
3131
3135
|
|
|
3132
|
-
function
|
|
3133
|
-
const [
|
|
3134
|
-
const
|
|
3135
|
-
const
|
|
3136
|
+
function useDropdownMenu(props) {
|
|
3137
|
+
const [isDropdownOpen, setIsModalOpen] = useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
|
|
3138
|
+
const dropdownRef = useRef(null);
|
|
3139
|
+
const openDropdownButtonRef = useRef(null);
|
|
3136
3140
|
useEffect(() => {
|
|
3137
3141
|
const handleClickOutside = (event) => {
|
|
3138
3142
|
var _a;
|
|
3139
3143
|
// close modal if the user clicked outside of it
|
|
3140
|
-
if (
|
|
3141
|
-
!
|
|
3142
|
-
!((_a =
|
|
3144
|
+
if (dropdownRef.current &&
|
|
3145
|
+
!dropdownRef.current.contains(event.target) &&
|
|
3146
|
+
!((_a = openDropdownButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
3143
3147
|
setIsModalOpen(false);
|
|
3144
3148
|
}
|
|
3145
3149
|
};
|
|
@@ -3147,58 +3151,83 @@ function useModal(props) {
|
|
|
3147
3151
|
return () => {
|
|
3148
3152
|
document.removeEventListener('click', handleClickOutside);
|
|
3149
3153
|
};
|
|
3150
|
-
}, [
|
|
3151
|
-
const
|
|
3154
|
+
}, [dropdownRef]);
|
|
3155
|
+
const openDropdown = useCallback(() => {
|
|
3152
3156
|
setIsModalOpen((prev) => !prev);
|
|
3153
3157
|
}, []);
|
|
3154
|
-
const
|
|
3158
|
+
const closeDropdown = useCallback(() => {
|
|
3155
3159
|
setIsModalOpen(false);
|
|
3156
3160
|
}, []);
|
|
3157
3161
|
return {
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3162
|
+
isDropdownOpen,
|
|
3163
|
+
openDropdown,
|
|
3164
|
+
closeDropdown,
|
|
3165
|
+
dropdownRef,
|
|
3166
|
+
openDropdownButtonRef,
|
|
3163
3167
|
};
|
|
3164
3168
|
}
|
|
3165
3169
|
|
|
3166
|
-
function CompassRound({ size = '20', className, }) {
|
|
3167
|
-
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("path", { d: "M17.7087 9.99996C17.7087 14.2572 14.2575 17.7083 10.0003 17.7083C5.74313 17.7083 2.29199 14.2572 2.29199 9.99996C2.29199 5.74276 5.74313 2.29163 10.0003 2.29163C14.2575 2.29163 17.7087 5.74276 17.7087 9.99996Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" }), jsx("path", { d: "M12.2135 7.27515L8.79307 8.208C8.5084 8.28564 8.286 8.50803 8.20837 8.7927L7.27552 12.2132C7.19069 12.5242 7.47609 12.8096 7.78713 12.7248L11.2076 11.7919C11.4923 11.7143 11.7146 11.4919 11.7923 11.2072L12.7251 7.78677C12.81 7.47573 12.5246 7.19032 12.2135 7.27515Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linejoin": "round" })] }));
|
|
3168
|
-
}
|
|
3169
|
-
function CircleX({ size = '20', className, }) {
|
|
3170
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { d: "M12.5003 7.49996L7.50033 12.5M12.5003 12.5L7.50033 7.49996M17.7087 9.99996C17.7087 14.2572 14.2575 17.7083 10.0003 17.7083C5.74313 17.7083 2.29199 14.2572 2.29199 9.99996C2.29199 5.74276 5.74313 2.29163 10.0003 2.29163C14.2575 2.29163 17.7087 5.74276 17.7087 9.99996Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) }));
|
|
3171
|
-
}
|
|
3172
|
-
|
|
3173
3170
|
function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
|
|
3174
3171
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M1.33325 8.00008C1.33325 7.2637 1.93021 6.66675 2.66659 6.66675C3.40297 6.66675 3.99992 7.2637 3.99992 8.00008C3.99992 8.73646 3.40297 9.33341 2.66659 9.33341C1.93021 9.33341 1.33325 8.73646 1.33325 8.00008ZM6.66659 8.00008C6.66659 7.2637 7.26354 6.66675 7.99992 6.66675C8.7363 6.66675 9.33325 7.2637 9.33325 8.00008C9.33325 8.73646 8.7363 9.33341 7.99992 9.33341C7.26354 9.33341 6.66659 8.73646 6.66659 8.00008ZM11.9999 8.00008C11.9999 7.2637 12.5969 6.66675 13.3333 6.66675C14.0696 6.66675 14.6666 7.2637 14.6666 8.00008C14.6666 8.73646 14.0696 9.33341 13.3333 9.33341C12.5969 9.33341 11.9999 8.73646 11.9999 8.00008Z", fill: "currentColor" }) }));
|
|
3175
3172
|
}
|
|
3176
3173
|
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3174
|
+
const dropdownPositionClassMap = {
|
|
3175
|
+
top: 'tw-right-[calc(100%-10px)] tw-bottom-7',
|
|
3176
|
+
bottom: 'tw-right-[calc(100%-10px)] tw-top-7',
|
|
3177
|
+
center: 'tw-right-[40px] -tw-top-[55px]',
|
|
3178
|
+
};
|
|
3179
|
+
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', dropdownMenuItems, }) {
|
|
3180
|
+
const { isDropdownOpen, dropdownRef, openDropdownButtonRef, openDropdown } = useDropdownMenu();
|
|
3181
|
+
const [dropdownPosition, setDropdownPosition] = useState(null);
|
|
3182
|
+
const itemRef = useRef(null);
|
|
3183
|
+
const menuRef = useRef(null);
|
|
3184
|
+
// Effect to find the best position for the dropdown menu, so it's always visible for the user
|
|
3185
|
+
useEffect(() => {
|
|
3186
|
+
if (!isDropdownOpen) {
|
|
3187
|
+
// when the dropdown is closed, we want to reset its position
|
|
3188
|
+
// because user may scroll, and the old position may be out of view, so we'll need to recalculate it
|
|
3189
|
+
setDropdownPosition(null);
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
const item = itemRef.current;
|
|
3193
|
+
const itemsContainer = item === null || item === void 0 ? void 0 : item.parentElement;
|
|
3194
|
+
const dropdownMenu = menuRef.current;
|
|
3195
|
+
if (!item || !dropdownRef.current || !itemsContainer || !dropdownMenu) {
|
|
3196
|
+
return;
|
|
3197
|
+
}
|
|
3198
|
+
// Get the bounding rectangle of the item
|
|
3199
|
+
const itemRect = item.getBoundingClientRect();
|
|
3200
|
+
// Get the bounding rectangle of the container element
|
|
3201
|
+
const containerRect = itemsContainer.getBoundingClientRect();
|
|
3202
|
+
// Calculate the bottom position of the visible area of the the items container
|
|
3203
|
+
const containerVisibleBottom = containerRect.top + containerRect.height;
|
|
3204
|
+
// Calculate the distance from the bottom of the item to the visible bottom of the items container
|
|
3205
|
+
const distanceBetweenItemBottomAndContainerBottomEdge = containerVisibleBottom - itemRect.bottom;
|
|
3206
|
+
// the same but for the top
|
|
3207
|
+
const distanceBetweenItemTopAndContainerTopEdge = itemRect.top - containerRect.top;
|
|
3208
|
+
const dropdownMenuHeight = dropdownMenu.clientHeight;
|
|
3209
|
+
// check if the height of the dropdown is less than the longest distance, either top or bottom
|
|
3210
|
+
// if so, means that the dropdown keeps visible when positioned at the top or bottom of the item
|
|
3211
|
+
const isDropdownVisibleAtItemTopOrBottom = dropdownMenuHeight <=
|
|
3212
|
+
Math.max(distanceBetweenItemBottomAndContainerBottomEdge, distanceBetweenItemTopAndContainerTopEdge);
|
|
3213
|
+
// if the dropdown is not visible at top or bottom of the item
|
|
3214
|
+
// we just center it
|
|
3215
|
+
if (!isDropdownVisibleAtItemTopOrBottom) {
|
|
3216
|
+
return setDropdownPosition('center');
|
|
3217
|
+
}
|
|
3218
|
+
// finally, if the dropdown fits, position it where it has more space
|
|
3219
|
+
if (distanceBetweenItemBottomAndContainerBottomEdge >=
|
|
3220
|
+
distanceBetweenItemTopAndContainerTopEdge) {
|
|
3221
|
+
setDropdownPosition('bottom');
|
|
3222
|
+
}
|
|
3223
|
+
else {
|
|
3224
|
+
setDropdownPosition('top');
|
|
3225
|
+
}
|
|
3226
|
+
}, [isDropdownOpen, menuRef, dropdownPosition, itemRef]);
|
|
3227
|
+
return (jsx("li", { ref: itemRef, className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxs("div", { className: "tw-group/history-item tw-relative tw-flex tw-flex-shrink-0 tw-cursor-pointer tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin", children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsx("span", { className: "tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-30 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-rounded-full tw-border tw-border-grey-900 tw-bg-royal-400 tw-p-0.5", children: jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), jsx("div", { className: cn(!!dropdownMenuItems &&
|
|
3228
|
+
'tw-transition-opacity group-hover/history-item:tw-opacity-0'), children: isPending ? (jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsx(CaptionText, { children: dateCompleted })) }), !!dropdownMenuItems && (jsx("button", { className: "tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity group-hover/history-item:tw-opacity-100", onClick: openDropdown, ref: openDropdownButtonRef, children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) }))] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsx(DropdownMenu, { menuRef: menuRef,
|
|
3229
|
+
// only show dropdown menu if there is a position defined for it
|
|
3230
|
+
isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] }) }));
|
|
3202
3231
|
}
|
|
3203
3232
|
|
|
3204
3233
|
const listItemSizeMap = {
|
|
@@ -3231,7 +3260,7 @@ function HelpIcon({ size = '20', className, }) {
|
|
|
3231
3260
|
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsx("g", { "clip-path": "url(#clip0_457_36778)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM6 7C6 4.46214 8.03736 3 10 3C12.1193 3 14 4.66531 14 7C14 7.93746 13.7596 8.6603 13.368 9.2586C13.0353 9.76679 12.6034 10.1601 12.2697 10.4639L12.1757 10.5497C11.8041 10.8904 11.534 11.1593 11.337 11.504C11.1513 11.8288 11 12.2794 11 13C11 13.5523 10.5523 14 10 14C9.44772 14 9 13.5523 9 13C9 11.9706 9.22366 11.1712 9.60051 10.5117C9.96604 9.87199 10.4459 9.42214 10.8243 9.07535L10.8834 9.02116L10.8834 9.02116L10.8834 9.02115C11.2572 8.67885 11.5066 8.45039 11.6945 8.16328C11.8654 7.9022 12 7.56254 12 7C12 5.83469 11.0807 5 10 5C8.96264 5 8 5.73786 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7ZM10 15C9.44771 15 9 15.4477 9 16C9 16.5523 9.44771 17 10 17C10.5523 17 11 16.5523 11 16C11 15.4477 10.5523 15 10 15Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_457_36778", children: jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
|
|
3232
3261
|
}
|
|
3233
3262
|
|
|
3234
|
-
function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, }) {
|
|
3263
|
+
function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, transparent = false, helpTooltip, }) {
|
|
3235
3264
|
const ContentTag = link ? 'a' : 'div';
|
|
3236
3265
|
const contentTagProps = link
|
|
3237
3266
|
? {
|
|
@@ -3239,7 +3268,11 @@ function SettingsItem({ icon, label, controls, transparentControls = false, show
|
|
|
3239
3268
|
target: '_blank',
|
|
3240
3269
|
}
|
|
3241
3270
|
: {};
|
|
3242
|
-
|
|
3271
|
+
const helpIcon = showHelpIcon && (jsx(HelpIcon, { className: cn('tw-text-grey-600',
|
|
3272
|
+
// only add hover styles if helpTooltip is provided
|
|
3273
|
+
!!helpTooltip &&
|
|
3274
|
+
'tw-cursor-help tw-transition-colors tw-duration-200 hover:tw-text-grey-400') }));
|
|
3275
|
+
return (jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900 '), 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', transparentControls ? '' : 'tw-bg-grey-800'), children: controls })] })) }));
|
|
3243
3276
|
}
|
|
3244
3277
|
|
|
3245
3278
|
function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
|
|
@@ -3284,8 +3317,12 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3284
3317
|
}) }), !!link && (jsx(ChevronLargeRightIcon, { className: "tw-mr-squid-xxs tw-hidden tw-text-material-light-average group-hover/swap-step-item:tw-block" }))] })] }));
|
|
3285
3318
|
}
|
|
3286
3319
|
|
|
3287
|
-
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
3288
|
-
return (jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsx("ul", { className:
|
|
3320
|
+
function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
|
|
3321
|
+
return (jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsx(Menu, { menuRef: menuRef, rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: !isHidden && (jsx("ul", { className: cn('tw-flex tw-max-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs', listClassName), children: items.map((item) => (jsx(DropdownMenuItem, Object.assign({}, item), item.label))) })) }) }));
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
function InfoBox({ title, description, icon }) {
|
|
3325
|
+
return (jsxs("div", { className: "tw-align-self-stretch tw-flex tw-flex-col tw-items-center tw-gap-squid-xs tw-px-squid-m tw-pb-squid-l tw-pt-squid-xs tw-text-royal-400", children: [icon, jsxs("div", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xxs tw-text-center", children: [jsx(BodyText, { size: "small", className: "!tw-leading-[9px]", children: title }), jsx(CaptionText, { className: "tw-text-grey-500", children: description })] })] }));
|
|
3289
3326
|
}
|
|
3290
3327
|
|
|
3291
3328
|
function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, }) {
|
|
@@ -3478,4 +3515,4 @@ function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
|
3478
3515
|
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3479
3516
|
}
|
|
3480
3517
|
|
|
3481
|
-
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount,
|
|
3518
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, InfoBox, Input, ListItem, LoadingSkeleton, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, ProfileHeaderBackground, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, useDropdownMenu };
|
|
@@ -4,8 +4,8 @@ interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
|
4
4
|
showIcon?: boolean;
|
|
5
5
|
showPasteButton?: boolean;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
|
-
|
|
7
|
+
isError?: boolean;
|
|
8
8
|
onPasteButtonClick?: () => void;
|
|
9
9
|
}
|
|
10
|
-
export declare function Input({ placeholder, showIcon, showPasteButton, className, icon,
|
|
10
|
+
export declare function Input({ placeholder, showIcon, showPasteButton, className, icon, isError, onPasteButtonClick, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type TooltipWidth = 'max' | 'container';
|
|
3
3
|
export type TooltipThreshold = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
4
|
-
interface TooltipProps {
|
|
4
|
+
export interface TooltipProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
tooltipContent: React.ReactNode;
|
|
7
7
|
threshold?: TooltipThreshold;
|
|
@@ -11,4 +11,3 @@ interface TooltipProps {
|
|
|
11
11
|
tooltipClassName?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare function Tooltip({ children, tooltipContent, tooltipWidth, threshold, containerClassName, childrenClassName, tooltipClassName, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
import { DropdownMenuItemProps } from '../lists';
|
|
3
3
|
interface DropdownMenuProps {
|
|
4
4
|
dropdownRef?: React.RefObject<HTMLDivElement>;
|
|
5
|
+
menuRef?: React.RefObject<HTMLDivElement>;
|
|
5
6
|
items: DropdownMenuItemProps[];
|
|
6
7
|
className?: string;
|
|
8
|
+
isHidden?: boolean;
|
|
9
|
+
listClassName?: string;
|
|
7
10
|
}
|
|
8
|
-
export declare function DropdownMenu({ dropdownRef, items, className, }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden, listClassName, }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -6,6 +6,7 @@ interface MenuProps extends React.ComponentProps<'div'> {
|
|
|
6
6
|
title?: string;
|
|
7
7
|
displayControls?: boolean;
|
|
8
8
|
rounded?: Rounded;
|
|
9
|
+
menuRef?: React.RefObject<HTMLDivElement>;
|
|
9
10
|
}
|
|
10
|
-
export declare function Menu({ children, containerClassName, contentClassName, title, displayControls, rounded, ...props }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Menu({ children, containerClassName, contentClassName, title, displayControls, rounded, menuRef, ...props }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -4,5 +4,6 @@ export interface DropdownMenuItemProps {
|
|
|
4
4
|
labelClassName?: string;
|
|
5
5
|
imageUrl?: string;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
|
+
onClick?: () => void;
|
|
7
8
|
}
|
|
8
|
-
export declare function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }: DropdownMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }: DropdownMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DropdownMenuItemProps } from './DropdownMenuItem';
|
|
1
2
|
interface HistoryItemProps {
|
|
2
3
|
firstImageUrl: string;
|
|
3
4
|
secondImageUrl: string;
|
|
@@ -8,6 +9,7 @@ interface HistoryItemProps {
|
|
|
8
9
|
dateCompleted: string;
|
|
9
10
|
fromAmount: string;
|
|
10
11
|
toAmount: string;
|
|
12
|
+
dropdownMenuItems?: DropdownMenuItemProps[];
|
|
11
13
|
}
|
|
12
|
-
export declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel, dropdownMenuItems, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TooltipProps } from '../controls';
|
|
2
3
|
export interface SettingsItemProps {
|
|
3
4
|
icon: React.ReactNode;
|
|
4
5
|
label: string;
|
|
@@ -6,5 +7,7 @@ export interface SettingsItemProps {
|
|
|
6
7
|
transparentControls?: boolean;
|
|
7
8
|
showHelpIcon?: boolean;
|
|
8
9
|
link?: string;
|
|
10
|
+
transparent?: boolean;
|
|
11
|
+
helpTooltip?: Omit<TooltipProps, 'children'>;
|
|
9
12
|
}
|
|
10
|
-
export declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function SettingsItem({ icon, label, controls, transparentControls, showHelpIcon, link, transparent, helpTooltip, }: SettingsItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './useDropdownMenu';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function useDropdownMenu(props?: {
|
|
3
|
+
initialIsModalOpen?: boolean;
|
|
4
|
+
}): {
|
|
5
|
+
isDropdownOpen: boolean;
|
|
6
|
+
openDropdown: () => void;
|
|
7
|
+
closeDropdown: () => void;
|
|
8
|
+
dropdownRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
openDropdownButtonRef: React.RefObject<HTMLButtonElement>;
|
|
10
|
+
};
|
|
@@ -5,5 +5,6 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Empty: Story;
|
|
7
7
|
export declare const ChainOnly: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const ChainAndTokenLightText: Story;
|
|
9
|
+
export declare const ChainAndTokenDarkText: Story;
|
|
9
10
|
export declare const LongTokenSymbol: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { InfoBox } from '../../components/layout/InfoBox';
|
|
3
|
+
declare const meta: Meta<typeof InfoBox>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithIcon: Story;
|
package/dist/index.css
CHANGED
|
@@ -605,10 +605,6 @@ video {
|
|
|
605
605
|
left: -5px;
|
|
606
606
|
}
|
|
607
607
|
|
|
608
|
-
.-tw-left-\[85px\] {
|
|
609
|
-
left: -85px;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
608
|
.-tw-right-1\/3 {
|
|
613
609
|
right: -33.333333%;
|
|
614
610
|
}
|
|
@@ -633,6 +629,10 @@ video {
|
|
|
633
629
|
top: -4px;
|
|
634
630
|
}
|
|
635
631
|
|
|
632
|
+
.-tw-top-\[55px\] {
|
|
633
|
+
top: -55px;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
636
|
.-tw-top-full {
|
|
637
637
|
top: -100%;
|
|
638
638
|
}
|
|
@@ -649,6 +649,10 @@ video {
|
|
|
649
649
|
bottom: 0.5rem;
|
|
650
650
|
}
|
|
651
651
|
|
|
652
|
+
.tw-bottom-7 {
|
|
653
|
+
bottom: 1.75rem;
|
|
654
|
+
}
|
|
655
|
+
|
|
652
656
|
.tw-bottom-full {
|
|
653
657
|
bottom: 100%;
|
|
654
658
|
}
|
|
@@ -669,8 +673,8 @@ video {
|
|
|
669
673
|
left: -14px;
|
|
670
674
|
}
|
|
671
675
|
|
|
672
|
-
.tw-left-\[
|
|
673
|
-
left:
|
|
676
|
+
.tw-left-\[15px\] {
|
|
677
|
+
left: 15px;
|
|
674
678
|
}
|
|
675
679
|
|
|
676
680
|
.tw-left-\[54px\] {
|
|
@@ -697,6 +701,14 @@ video {
|
|
|
697
701
|
right: 1rem;
|
|
698
702
|
}
|
|
699
703
|
|
|
704
|
+
.tw-right-\[40px\] {
|
|
705
|
+
right: 40px;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
.tw-right-\[calc\(100\%-10px\)\] {
|
|
709
|
+
right: calc(100% - 10px);
|
|
710
|
+
}
|
|
711
|
+
|
|
700
712
|
.tw-right-squid-xxs {
|
|
701
713
|
right: 0.3125rem;
|
|
702
714
|
}
|
|
@@ -1495,6 +1507,10 @@ video {
|
|
|
1495
1507
|
animation: tw-translate-to-top 0.4s ease-in-out both;
|
|
1496
1508
|
}
|
|
1497
1509
|
|
|
1510
|
+
.tw-cursor-help {
|
|
1511
|
+
cursor: help;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1498
1514
|
.tw-cursor-not-allowed {
|
|
1499
1515
|
cursor: not-allowed;
|
|
1500
1516
|
}
|
|
@@ -1627,10 +1643,6 @@ video {
|
|
|
1627
1643
|
border-radius: 1rem;
|
|
1628
1644
|
}
|
|
1629
1645
|
|
|
1630
|
-
.tw-rounded-\[25px\] {
|
|
1631
|
-
border-radius: 25px;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
1646
|
.tw-rounded-full {
|
|
1635
1647
|
border-radius: 9999px;
|
|
1636
1648
|
}
|
|
@@ -2218,6 +2230,10 @@ video {
|
|
|
2218
2230
|
line-height: 1rem;
|
|
2219
2231
|
}
|
|
2220
2232
|
|
|
2233
|
+
.\!tw-font-medium {
|
|
2234
|
+
font-weight: 500 !important;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2221
2237
|
.tw-font-heading-bold {
|
|
2222
2238
|
font-weight: 600;
|
|
2223
2239
|
}
|
|
@@ -2497,6 +2513,10 @@ video {
|
|
|
2497
2513
|
transition-duration: 150ms;
|
|
2498
2514
|
}
|
|
2499
2515
|
|
|
2516
|
+
.tw-duration-200 {
|
|
2517
|
+
transition-duration: 200ms;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2500
2520
|
.tw-duration-300 {
|
|
2501
2521
|
transition-duration: 300ms;
|
|
2502
2522
|
}
|
|
@@ -2569,6 +2589,10 @@ li {
|
|
|
2569
2589
|
background-color: var(--squid-theme-material-light-thin);
|
|
2570
2590
|
}
|
|
2571
2591
|
|
|
2592
|
+
.hover\:tw-text-grey-400:hover {
|
|
2593
|
+
color: var(--squid-theme-grey-400);
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2572
2596
|
.focus\:tw-bg-material-light-thin:focus {
|
|
2573
2597
|
background-color: var(--squid-theme-material-light-thin);
|
|
2574
2598
|
}
|