@0xsquid/ui 0.8.3 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/cjs/index.js +116 -75
- 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/icons/Clock.d.ts +4 -0
- 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/Modal.d.ts +2 -1
- package/dist/cjs/types/components/layout/ModalContent.d.ts +8 -0
- package/dist/cjs/types/components/layout/NavigationBar.d.ts +7 -4
- 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/layout/ModalContent.stories.d.ts +8 -0
- package/dist/cjs/types/stories/layout/NavigationBar.stories.d.ts +1 -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 +114 -75
- 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/icons/Clock.d.ts +4 -0
- 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/Modal.d.ts +2 -1
- package/dist/esm/types/components/layout/ModalContent.d.ts +8 -0
- package/dist/esm/types/components/layout/NavigationBar.d.ts +7 -4
- 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/layout/ModalContent.stories.d.ts +8 -0
- package/dist/esm/types/stories/layout/NavigationBar.stories.d.ts +1 -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 +47 -18
- package/dist/index.d.ts +42 -19
- 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/README.md
CHANGED
|
@@ -71,6 +71,28 @@ yarn format:fix
|
|
|
71
71
|
yarn lint:fix
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
### Folder structure
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
- src
|
|
78
|
+
- index.ts <- barrel file
|
|
79
|
+
- components
|
|
80
|
+
- index.ts <- barrel file
|
|
81
|
+
- buttons
|
|
82
|
+
- index.ts <- barrel file
|
|
83
|
+
- Button.tsx
|
|
84
|
+
- lists
|
|
85
|
+
- index.ts <- barrel file
|
|
86
|
+
- HistoryItem.tsx
|
|
87
|
+
- stories
|
|
88
|
+
- buttons
|
|
89
|
+
- Button.stories.tsx
|
|
90
|
+
- lists
|
|
91
|
+
- HistoryItem.stories.tsx
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
When creating a new component, don't forget to update the barrel file, exporting your component in the `index.ts` file in the corresponding component folder. You can also install the [AutoBarrel VSCode extension](https://marketplace.visualstudio.com/items?itemName=imgildev.vscode-auto-barrel).
|
|
95
|
+
|
|
74
96
|
### Images
|
|
75
97
|
|
|
76
98
|
In case you need to add images somewhere that need to be included in the final bundle, convert them to base64 instead.
|
package/dist/cjs/index.js
CHANGED
|
@@ -2563,6 +2563,10 @@ function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, roun
|
|
|
2563
2563
|
return imageUrl ? (jsxRuntime.jsxs("div", { className: cn('tw-relative', extraMarginForBadge && badgeUrl ? 'tw-mr-1.5' : null, mainImageSizeClassMap[size]), children: [jsxRuntime.jsx("img", { src: imageUrl, alt: "", className: cn('tw-h-full tw-w-full', rounded ? ' tw-rounded-full' : 'tw-rounded-squid-xs') }), badgeUrl ? (jsxRuntime.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;
|
|
2564
2564
|
}
|
|
2565
2565
|
|
|
2566
|
+
function LoadingSkeleton({ className, height = '20', }) {
|
|
2567
|
+
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100", height: height, viewBox: "0 0 100 20", fill: "none", className: className, children: [jsxRuntime.jsxs("g", { "clip-path": "url(#clip0_1083_18992)", children: [jsxRuntime.jsx("mask", { id: "mask0_1083_18992", style: { maskType: 'alpha' }, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "100", height: "20", children: jsxRuntime.jsx("rect", { width: "100", height: "20", fill: "url(#paint0_linear_1083_18992)" }) }), jsxRuntime.jsx("g", { mask: "url(#mask0_1083_18992)", children: jsxRuntime.jsx("rect", { width: "100", height: "20", fill: "currentColor" }) })] }), jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsxs("linearGradient", { id: "paint0_linear_1083_18992", x1: "0", y1: "10", x2: "100", y2: "10", gradientUnits: "userSpaceOnUse", className: "tw-animate-loading-gradient", children: [jsxRuntime.jsx("stop", { "stop-color": "#D9D9D9", "stop-opacity": "0.33" }), jsxRuntime.jsx("stop", { offset: "0.395881", "stop-color": "#737373", "stop-opacity": "0.33" }), jsxRuntime.jsx("stop", { offset: "0.597867", "stop-color": "#737373", "stop-opacity": "0.66" }), jsxRuntime.jsx("stop", { offset: "0.697004", "stop-color": "#737373", "stop-opacity": "0.33" })] }), jsxRuntime.jsx("clipPath", { id: "clip0_1083_18992", children: jsxRuntime.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" }) })] })] }));
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2566
2570
|
/******************************************************************************
|
|
2567
2571
|
Copyright (c) Microsoft Corporation.
|
|
2568
2572
|
|
|
@@ -2668,10 +2672,6 @@ function ArrowButton(_a) {
|
|
|
2668
2672
|
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsxRuntime.jsx(ArrowRightIcon, {}) })] })));
|
|
2669
2673
|
}
|
|
2670
2674
|
|
|
2671
|
-
function PlusIcon() {
|
|
2672
|
-
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2675
2675
|
const SQUID_THEME_CSS_VARIABLE_PREFIX = '--squid-theme-';
|
|
2676
2676
|
/**
|
|
2677
2677
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
@@ -2778,6 +2778,10 @@ const themeTypesKeys = {
|
|
|
2778
2778
|
},
|
|
2779
2779
|
};
|
|
2780
2780
|
|
|
2781
|
+
function PlusIcon() {
|
|
2782
|
+
return (jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 17V12M12 12V7M12 12H17M12 12H7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round" }) }));
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2781
2785
|
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2782
2786
|
const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
|
|
2783
2787
|
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, onClick, }) {
|
|
@@ -2797,7 +2801,7 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2797
2801
|
}, children: jsxRuntime.jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl -tw-translate-x-[2px] tw-rounded-full" }) })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2798
2802
|
backgroundColor: tokenBgColor,
|
|
2799
2803
|
color: tokenTextColor,
|
|
2800
|
-
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-
|
|
2804
|
+
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
|
|
2801
2805
|
}
|
|
2802
2806
|
|
|
2803
2807
|
function SearchIcon() {
|
|
@@ -2805,8 +2809,8 @@ function SearchIcon() {
|
|
|
2805
2809
|
}
|
|
2806
2810
|
|
|
2807
2811
|
function Input(_a) {
|
|
2808
|
-
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon,
|
|
2809
|
-
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsxRuntime.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',
|
|
2812
|
+
var { placeholder = 'Search', showIcon = true, showPasteButton = false, className, icon, isError = false, onPasteButtonClick } = _a, props = __rest(_a, ["placeholder", "showIcon", "showPasteButton", "className", "icon", "isError", "onPasteButtonClick"]);
|
|
2813
|
+
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-w-full tw-text-grey-600", children: [jsxRuntime.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 ? (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] }));
|
|
2810
2814
|
}
|
|
2811
2815
|
const PasteButton = ({ onClick }) => {
|
|
2812
2816
|
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { children: "Paste" }) }));
|
|
@@ -2955,7 +2959,7 @@ function HeadingText({ children, bold, size }) {
|
|
|
2955
2959
|
}
|
|
2956
2960
|
|
|
2957
2961
|
function SettingsSlider({ value, type }) {
|
|
2958
|
-
return (jsxRuntime.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: [jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-300", children: "%" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-300", children: "$" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-600", children: String(value) })] })) }), jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
|
|
2962
|
+
return (jsxRuntime.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: [jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center", children: type === 'percentage' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) }), jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "%" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-300", children: "$" }), jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium tw-text-grey-600", children: String(value) })] })) }), jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
|
|
2959
2963
|
}
|
|
2960
2964
|
|
|
2961
2965
|
const switchSizeClassMap = {
|
|
@@ -2982,7 +2986,7 @@ function Switch({ checked = false, onChange, size, disabled = false, }) {
|
|
|
2982
2986
|
switchCircleSizeClassMap[size],
|
|
2983
2987
|
// disabled and checked styles
|
|
2984
2988
|
checked
|
|
2985
|
-
? 'tw-translate-x-0 tw-bg-
|
|
2989
|
+
? 'tw-translate-x-0 tw-bg-[#FBFBFD]'
|
|
2986
2990
|
: '-tw-translate-x-full tw-bg-grey-500') })] }));
|
|
2987
2991
|
}
|
|
2988
2992
|
|
|
@@ -2991,8 +2995,8 @@ const borderRadiusClassMap = {
|
|
|
2991
2995
|
lg: 'tw-rounded-squid-m',
|
|
2992
2996
|
};
|
|
2993
2997
|
function Menu(_a) {
|
|
2994
|
-
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg' } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded"]);
|
|
2995
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), children: jsxRuntime.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 ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsxRuntime.jsx("div", { className: "tw-z-20", children: children })), displayControls ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsxRuntime.jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2998
|
+
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
|
|
2999
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsxRuntime.jsx("div", { className: "tw-z-20 tw-max-w-full", children: children })), displayControls ? (jsxRuntime.jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsxRuntime.jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2996
3000
|
}
|
|
2997
3001
|
|
|
2998
3002
|
const tooltipWidthClassMap = {
|
|
@@ -3090,7 +3094,7 @@ function FeeButton(_a) {
|
|
|
3090
3094
|
}
|
|
3091
3095
|
|
|
3092
3096
|
function SettingsButton({ label }) {
|
|
3093
|
-
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { children: label }) }));
|
|
3097
|
+
return (jsxRuntime.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: jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
3094
3098
|
}
|
|
3095
3099
|
|
|
3096
3100
|
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, }) {
|
|
@@ -3127,21 +3131,21 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3127
3131
|
return (jsxRuntime.jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage }) })] })) }));
|
|
3128
3132
|
}
|
|
3129
3133
|
|
|
3130
|
-
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
3131
|
-
return (jsxRuntime.jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-l tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-
|
|
3134
|
+
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
3135
|
+
return (jsxRuntime.jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", onClick: onClick, children: jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsxRuntime.jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsxRuntime.jsx(CaptionText, { className: cn(labelClassName, 'tw-max-w-full tw-truncate !tw-leading-[18px]'), children: label })] }) }));
|
|
3132
3136
|
}
|
|
3133
3137
|
|
|
3134
|
-
function
|
|
3135
|
-
const [
|
|
3136
|
-
const
|
|
3137
|
-
const
|
|
3138
|
+
function useDropdownMenu(props) {
|
|
3139
|
+
const [isDropdownOpen, setIsModalOpen] = react.useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
|
|
3140
|
+
const dropdownRef = react.useRef(null);
|
|
3141
|
+
const openDropdownButtonRef = react.useRef(null);
|
|
3138
3142
|
react.useEffect(() => {
|
|
3139
3143
|
const handleClickOutside = (event) => {
|
|
3140
3144
|
var _a;
|
|
3141
3145
|
// close modal if the user clicked outside of it
|
|
3142
|
-
if (
|
|
3143
|
-
!
|
|
3144
|
-
!((_a =
|
|
3146
|
+
if (dropdownRef.current &&
|
|
3147
|
+
!dropdownRef.current.contains(event.target) &&
|
|
3148
|
+
!((_a = openDropdownButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
3145
3149
|
setIsModalOpen(false);
|
|
3146
3150
|
}
|
|
3147
3151
|
};
|
|
@@ -3149,58 +3153,83 @@ function useModal(props) {
|
|
|
3149
3153
|
return () => {
|
|
3150
3154
|
document.removeEventListener('click', handleClickOutside);
|
|
3151
3155
|
};
|
|
3152
|
-
}, [
|
|
3153
|
-
const
|
|
3156
|
+
}, [dropdownRef]);
|
|
3157
|
+
const openDropdown = react.useCallback(() => {
|
|
3154
3158
|
setIsModalOpen((prev) => !prev);
|
|
3155
3159
|
}, []);
|
|
3156
|
-
const
|
|
3160
|
+
const closeDropdown = react.useCallback(() => {
|
|
3157
3161
|
setIsModalOpen(false);
|
|
3158
3162
|
}, []);
|
|
3159
3163
|
return {
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3164
|
+
isDropdownOpen,
|
|
3165
|
+
openDropdown,
|
|
3166
|
+
closeDropdown,
|
|
3167
|
+
dropdownRef,
|
|
3168
|
+
openDropdownButtonRef,
|
|
3165
3169
|
};
|
|
3166
3170
|
}
|
|
3167
3171
|
|
|
3168
|
-
function CompassRound({ size = '20', className, }) {
|
|
3169
|
-
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsxRuntime.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" }), jsxRuntime.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" })] }));
|
|
3170
|
-
}
|
|
3171
|
-
function CircleX({ size = '20', className, }) {
|
|
3172
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsxRuntime.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" }) }));
|
|
3173
|
-
}
|
|
3174
|
-
|
|
3175
3172
|
function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
|
|
3176
3173
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.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" }) }));
|
|
3177
3174
|
}
|
|
3178
3175
|
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3176
|
+
const dropdownPositionClassMap = {
|
|
3177
|
+
top: 'tw-right-[calc(100%-10px)] tw-bottom-7',
|
|
3178
|
+
bottom: 'tw-right-[calc(100%-10px)] tw-top-7',
|
|
3179
|
+
center: 'tw-right-[40px] -tw-top-[55px]',
|
|
3180
|
+
};
|
|
3181
|
+
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', dropdownMenuItems, }) {
|
|
3182
|
+
const { isDropdownOpen, dropdownRef, openDropdownButtonRef, openDropdown } = useDropdownMenu();
|
|
3183
|
+
const [dropdownPosition, setDropdownPosition] = react.useState(null);
|
|
3184
|
+
const itemRef = react.useRef(null);
|
|
3185
|
+
const menuRef = react.useRef(null);
|
|
3186
|
+
// Effect to find the best position for the dropdown menu, so it's always visible for the user
|
|
3187
|
+
react.useEffect(() => {
|
|
3188
|
+
if (!isDropdownOpen) {
|
|
3189
|
+
// when the dropdown is closed, we want to reset its position
|
|
3190
|
+
// because user may scroll, and the old position may be out of view, so we'll need to recalculate it
|
|
3191
|
+
setDropdownPosition(null);
|
|
3192
|
+
return;
|
|
3193
|
+
}
|
|
3194
|
+
const item = itemRef.current;
|
|
3195
|
+
const itemsContainer = item === null || item === void 0 ? void 0 : item.parentElement;
|
|
3196
|
+
const dropdownMenu = menuRef.current;
|
|
3197
|
+
if (!item || !dropdownRef.current || !itemsContainer || !dropdownMenu) {
|
|
3198
|
+
return;
|
|
3199
|
+
}
|
|
3200
|
+
// Get the bounding rectangle of the item
|
|
3201
|
+
const itemRect = item.getBoundingClientRect();
|
|
3202
|
+
// Get the bounding rectangle of the container element
|
|
3203
|
+
const containerRect = itemsContainer.getBoundingClientRect();
|
|
3204
|
+
// Calculate the bottom position of the visible area of the the items container
|
|
3205
|
+
const containerVisibleBottom = containerRect.top + containerRect.height;
|
|
3206
|
+
// Calculate the distance from the bottom of the item to the visible bottom of the items container
|
|
3207
|
+
const distanceBetweenItemBottomAndContainerBottomEdge = containerVisibleBottom - itemRect.bottom;
|
|
3208
|
+
// the same but for the top
|
|
3209
|
+
const distanceBetweenItemTopAndContainerTopEdge = itemRect.top - containerRect.top;
|
|
3210
|
+
const dropdownMenuHeight = dropdownMenu.clientHeight;
|
|
3211
|
+
// check if the height of the dropdown is less than the longest distance, either top or bottom
|
|
3212
|
+
// if so, means that the dropdown keeps visible when positioned at the top or bottom of the item
|
|
3213
|
+
const isDropdownVisibleAtItemTopOrBottom = dropdownMenuHeight <=
|
|
3214
|
+
Math.max(distanceBetweenItemBottomAndContainerBottomEdge, distanceBetweenItemTopAndContainerTopEdge);
|
|
3215
|
+
// if the dropdown is not visible at top or bottom of the item
|
|
3216
|
+
// we just center it
|
|
3217
|
+
if (!isDropdownVisibleAtItemTopOrBottom) {
|
|
3218
|
+
return setDropdownPosition('center');
|
|
3219
|
+
}
|
|
3220
|
+
// finally, if the dropdown fits, position it where it has more space
|
|
3221
|
+
if (distanceBetweenItemBottomAndContainerBottomEdge >=
|
|
3222
|
+
distanceBetweenItemTopAndContainerTopEdge) {
|
|
3223
|
+
setDropdownPosition('bottom');
|
|
3224
|
+
}
|
|
3225
|
+
else {
|
|
3226
|
+
setDropdownPosition('top');
|
|
3227
|
+
}
|
|
3228
|
+
}, [isDropdownOpen, menuRef, dropdownPosition, itemRef]);
|
|
3229
|
+
return (jsxRuntime.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: jsxRuntime.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: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [isPending ? (jsxRuntime.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: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, {}) })) : null, jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.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" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), !!dropdownMenuItems && (jsxRuntime.jsx("button", { className: "tw-peer 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 focus:tw-opacity-100 group-hover/history-item:tw-opacity-100", onClick: openDropdown, ref: openDropdownButtonRef, children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })), jsxRuntime.jsx("div", { className: cn(!!dropdownMenuItems &&
|
|
3230
|
+
'tw-transition-opacity group-hover/history-item:tw-opacity-0 peer-focus:tw-opacity-0'), children: isPending ? (jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsxRuntime.jsx(CaptionText, { children: dateCompleted })) })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef,
|
|
3231
|
+
// only show dropdown menu if there is a position defined for it
|
|
3232
|
+
isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] }) }));
|
|
3204
3233
|
}
|
|
3205
3234
|
|
|
3206
3235
|
const listItemSizeMap = {
|
|
@@ -3233,7 +3262,7 @@ function HelpIcon({ size = '20', className, }) {
|
|
|
3233
3262
|
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_457_36778)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_457_36778", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
|
|
3234
3263
|
}
|
|
3235
3264
|
|
|
3236
|
-
function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, }) {
|
|
3265
|
+
function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, link, transparent = false, helpTooltip, }) {
|
|
3237
3266
|
const ContentTag = link ? 'a' : 'div';
|
|
3238
3267
|
const contentTagProps = link
|
|
3239
3268
|
? {
|
|
@@ -3241,7 +3270,11 @@ function SettingsItem({ icon, label, controls, transparentControls = false, show
|
|
|
3241
3270
|
target: '_blank',
|
|
3242
3271
|
}
|
|
3243
3272
|
: {};
|
|
3244
|
-
|
|
3273
|
+
const helpIcon = showHelpIcon && (jsxRuntime.jsx(HelpIcon, { className: cn('tw-text-grey-600',
|
|
3274
|
+
// only add hover styles if helpTooltip is provided
|
|
3275
|
+
!!helpTooltip &&
|
|
3276
|
+
'tw-cursor-help tw-transition-colors tw-duration-200 hover:tw-text-grey-400') }));
|
|
3277
|
+
return (jsxRuntime.jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900 '), 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', transparentControls ? '' : 'tw-bg-grey-800'), children: controls })] })) }));
|
|
3245
3278
|
}
|
|
3246
3279
|
|
|
3247
3280
|
function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
|
|
@@ -3286,11 +3319,15 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3286
3319
|
}) }), !!link && (jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-mr-squid-xxs tw-hidden tw-text-material-light-average group-hover/swap-step-item:tw-block" }))] })] }));
|
|
3287
3320
|
}
|
|
3288
3321
|
|
|
3289
|
-
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
3290
|
-
return (jsxRuntime.jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsxRuntime.jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsxRuntime.jsx("ul", { className:
|
|
3322
|
+
function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
|
|
3323
|
+
return (jsxRuntime.jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsxRuntime.jsx(Menu, { menuRef: menuRef, rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: !isHidden && (jsxRuntime.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) => (jsxRuntime.jsx(DropdownMenuItem, Object.assign({}, item), item.label))) })) }) }));
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
function InfoBox({ title, description, icon }) {
|
|
3327
|
+
return (jsxRuntime.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, jsxRuntime.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: [jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[9px]", children: title }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: description })] })] }));
|
|
3291
3328
|
}
|
|
3292
3329
|
|
|
3293
|
-
function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, }) {
|
|
3330
|
+
function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, maxHeight = false, }) {
|
|
3294
3331
|
const [isOpen, setIsOpen] = react.useState(_isOpen);
|
|
3295
3332
|
react.useEffect(() => {
|
|
3296
3333
|
if (_isOpen)
|
|
@@ -3310,15 +3347,17 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, }
|
|
|
3310
3347
|
onBackdropClick();
|
|
3311
3348
|
}
|
|
3312
3349
|
}
|
|
3313
|
-
: undefined, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsxRuntime.jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom'), children: children }) })));
|
|
3350
|
+
: undefined, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsxRuntime.jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom', maxHeight && 'tw-h-full'), children: children }) })));
|
|
3314
3351
|
}
|
|
3315
3352
|
|
|
3316
|
-
function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick,
|
|
3353
|
+
function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
|
|
3317
3354
|
return (jsxRuntime.jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton ? 'tw-px-squid-m' : 'tw-pl-squid-l tw-pr-squid-m'), children: [displayBackButton ? (jsxRuntime.jsx(Button, { className: displayButtonShadows
|
|
3318
3355
|
? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
|
|
3319
|
-
: undefined, variant: "tertiary", size: "md", icon: jsxRuntime.jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsxRuntime.jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: jsxRuntime.jsx(
|
|
3320
|
-
?
|
|
3321
|
-
: undefined,
|
|
3356
|
+
: undefined, variant: "tertiary", size: "md", icon: jsxRuntime.jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsxRuntime.jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsxRuntime.jsx(Button, { size: "md", variant: "tertiary", label: typeof action.labelOrIcon === 'string'
|
|
3357
|
+
? action.labelOrIcon
|
|
3358
|
+
: undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
|
|
3359
|
+
? null
|
|
3360
|
+
: action.labelOrIcon, onClick: action.onClick }))) })] }), title ? (jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-l tw-py-squid-xxs", children: jsxRuntime.jsx(HeadingText, { size: "small", children: title }) })) : null] }));
|
|
3322
3361
|
}
|
|
3323
3362
|
|
|
3324
3363
|
function ProductCard({ children }) {
|
|
@@ -3397,12 +3436,12 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
|
3397
3436
|
};
|
|
3398
3437
|
}, [isShowRouteAnimationRunning]);
|
|
3399
3438
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3400
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxRuntime.jsxs("button", { className: "tw-relative tw-max-h-button tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800", onClick: () => {
|
|
3439
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxRuntime.jsxs("button", { className: "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", onClick: () => {
|
|
3401
3440
|
// mount route component and start animation
|
|
3402
3441
|
setIsRouteVisible(true);
|
|
3403
3442
|
setIsShowRouteAnimationRunning(true);
|
|
3404
|
-
}, children: [newStepIndex > currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-
|
|
3405
|
-
'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-
|
|
3443
|
+
}, children: [newStepIndex > currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-absolute -tw-top-full tw-left-0 tw-w-full tw-animate-translate-to-bottom", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx(CurrentStep, { className: cn(newStepIndex > currentStepIndex &&
|
|
3444
|
+
'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-absolute tw-left-0 tw-top-full tw-w-full tw-animate-translate-to-top", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800" }), jsxRuntime.jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800" })] }) }), isRouteVisible && (jsxRuntime.jsxs("div", { className: "tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-justify-end tw-gap-squid-xxs", children: [jsxRuntime.jsx("div", { className: cn('tw-absolute tw-top-0 tw-h-[536px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10', isShowRouteAnimationRunning
|
|
3406
3445
|
? 'tw-animate-fade-in'
|
|
3407
3446
|
: 'tw-animate-fade-out'), onClick: collapseRouteSteps }), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-max-h-[536px] tw-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
3408
3447
|
? 'tw-animate-slide-to-top'
|
|
@@ -3497,8 +3536,10 @@ exports.ErrorMessage = ErrorMessage;
|
|
|
3497
3536
|
exports.FeeButton = FeeButton;
|
|
3498
3537
|
exports.HeadingText = HeadingText;
|
|
3499
3538
|
exports.HistoryItem = HistoryItem;
|
|
3539
|
+
exports.InfoBox = InfoBox;
|
|
3500
3540
|
exports.Input = Input;
|
|
3501
3541
|
exports.ListItem = ListItem;
|
|
3542
|
+
exports.LoadingSkeleton = LoadingSkeleton;
|
|
3502
3543
|
exports.Menu = Menu;
|
|
3503
3544
|
exports.MenuItem = MenuItem;
|
|
3504
3545
|
exports.Modal = Modal;
|
|
@@ -3520,4 +3561,4 @@ exports.Switch = Switch;
|
|
|
3520
3561
|
exports.TokenPair = TokenPair;
|
|
3521
3562
|
exports.Tooltip = Tooltip;
|
|
3522
3563
|
exports.UsdAmount = UsdAmount;
|
|
3523
|
-
exports.
|
|
3564
|
+
exports.useDropdownMenu = 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 {};
|
|
@@ -6,3 +6,7 @@ export declare function ClockOutlineIcon({ className, size, }: {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
size?: string;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const SettingsGearIcon: ({ size, className, }: {
|
|
10
|
+
className?: string;
|
|
11
|
+
size?: string;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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,6 +4,7 @@ interface ModalProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
onBackdropClick?: () => void;
|
|
6
6
|
isOpen?: boolean;
|
|
7
|
+
maxHeight?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, }: ModalProps): false | import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, maxHeight, }: ModalProps): false | import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ModalContentBorderType = 'border' | 'outline';
|
|
3
|
+
export declare function ModalContent({ children, addGap, borderType, }: {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
addGap?: boolean;
|
|
6
|
+
borderType?: ModalContentBorderType;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ActionButton = {
|
|
3
|
+
labelOrIcon: string | React.ReactNode;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
};
|
|
1
6
|
interface NavigationBarProps {
|
|
2
7
|
title?: string;
|
|
3
8
|
displayBackButton?: boolean;
|
|
@@ -5,9 +10,7 @@ interface NavigationBarProps {
|
|
|
5
10
|
transparent?: boolean;
|
|
6
11
|
displayButtonShadows?: boolean;
|
|
7
12
|
onBackButtonClick?: () => void;
|
|
8
|
-
|
|
9
|
-
label?: string;
|
|
10
|
-
isLoading?: boolean;
|
|
13
|
+
actions?: ActionButton[];
|
|
11
14
|
}
|
|
12
|
-
export declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick,
|
|
15
|
+
export declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, }: NavigationBarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
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';
|