@0xsquid/ui 0.2.0 → 0.4.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 +20 -0
- package/dist/cjs/index.js +375 -310
- package/dist/cjs/types/components/buttons/AssetsButton.d.ts +10 -0
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +1 -1
- package/dist/cjs/types/components/buttons/SettingsButton.d.ts +4 -0
- package/dist/cjs/types/components/buttons/index.d.ts +2 -1
- package/dist/cjs/types/components/controls/SettingsSlider.d.ts +5 -0
- package/dist/cjs/types/components/controls/Switch.d.ts +2 -2
- package/dist/cjs/types/components/controls/Tooltip.d.ts +4 -2
- package/dist/cjs/types/components/controls/index.d.ts +1 -0
- package/dist/cjs/types/components/icons/Arrow.d.ts +20 -0
- package/dist/cjs/types/components/icons/Clock.d.ts +8 -0
- package/dist/cjs/types/components/icons/Coins.d.ts +4 -0
- package/dist/cjs/types/components/icons/CompassRound.d.ts +8 -0
- package/dist/cjs/types/components/icons/DashboardFast.d.ts +4 -0
- package/dist/cjs/types/components/icons/DotGrid.d.ts +4 -1
- package/dist/cjs/types/components/icons/Help.d.ts +16 -0
- package/dist/cjs/types/components/icons/Infinity.d.ts +4 -0
- package/dist/cjs/types/components/icons/Lightning.d.ts +4 -0
- package/dist/cjs/types/components/icons/SquidLogo.d.ts +1 -0
- package/dist/cjs/types/components/icons/SwapStepSeparator.d.ts +1 -0
- package/dist/cjs/types/components/icons/TradingViewSteps.d.ts +4 -0
- package/dist/cjs/types/components/layout/Boost.d.ts +9 -1
- package/dist/cjs/types/components/layout/DropdownMenu.d.ts +9 -0
- package/dist/cjs/types/components/layout/Menu.d.ts +6 -2
- package/dist/cjs/types/components/layout/NavigationBar.d.ts +3 -1
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +3 -0
- package/dist/cjs/types/components/layout/SwapProgressViewHeader.d.ts +6 -0
- package/dist/cjs/types/components/layout/SwapStepsCollapsed.d.ts +5 -0
- package/dist/cjs/types/components/layout/TokenPair.d.ts +12 -0
- package/dist/cjs/types/components/layout/index.d.ts +3 -0
- package/dist/cjs/types/components/lists/DropdownMenuItem.d.ts +3 -3
- package/dist/cjs/types/components/lists/SettingsItem.d.ts +9 -0
- package/dist/cjs/types/components/lists/SwapDetailListItem.d.ts +8 -0
- package/dist/cjs/types/components/lists/SwapStepItem.d.ts +9 -0
- package/dist/cjs/types/components/lists/index.d.ts +3 -0
- package/dist/cjs/types/components/views/ProfileView.d.ts +1 -0
- package/dist/cjs/types/components/views/SwapDetailsView.d.ts +1 -0
- package/dist/cjs/types/core/themes.d.ts +2 -0
- package/dist/cjs/types/hooks/index.d.ts +1 -0
- package/dist/cjs/types/hooks/useModal.d.ts +10 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +4 -2
- package/dist/cjs/types/stories/buttons/{Dropdown.stories.d.ts → AssetsButton.stories.d.ts} +3 -2
- package/dist/cjs/types/stories/buttons/SettingsButton.stories.d.ts +6 -0
- package/dist/cjs/types/stories/controls/SettingsSlider.stories.d.ts +7 -0
- package/dist/cjs/types/stories/layout/Boost.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/DropdownMenu.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/Menu.stories.d.ts +2 -0
- package/dist/cjs/types/stories/layout/NavigationBar.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/SwapProgressView.stories.d.ts +9 -0
- package/dist/cjs/types/stories/layout/SwapProgressViewHeader.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/TokenPair.stories.d.ts +6 -0
- package/dist/cjs/types/stories/lists/SettingsItem.stories.d.ts +9 -0
- package/dist/cjs/types/stories/lists/SwapDetailListItem.stories.d.ts +7 -0
- package/dist/cjs/types/stories/lists/SwapStepItem.stories.d.ts +10 -0
- package/dist/cjs/types/stories/views/ProfileView.stories.d.ts +6 -0
- package/dist/cjs/types/stories/views/SwapDetailsView.stories.d.ts +6 -0
- package/dist/cjs/types/types/components.d.ts +11 -0
- package/dist/cjs/types/types/config.d.ts +1 -0
- package/dist/esm/index.js +367 -311
- package/dist/esm/types/components/buttons/AssetsButton.d.ts +10 -0
- package/dist/esm/types/components/buttons/BoostButton.d.ts +1 -1
- package/dist/esm/types/components/buttons/SettingsButton.d.ts +4 -0
- package/dist/esm/types/components/buttons/index.d.ts +2 -1
- package/dist/esm/types/components/controls/SettingsSlider.d.ts +5 -0
- package/dist/esm/types/components/controls/Switch.d.ts +2 -2
- package/dist/esm/types/components/controls/Tooltip.d.ts +4 -2
- package/dist/esm/types/components/controls/index.d.ts +1 -0
- package/dist/esm/types/components/icons/Arrow.d.ts +20 -0
- package/dist/esm/types/components/icons/Clock.d.ts +8 -0
- package/dist/esm/types/components/icons/Coins.d.ts +4 -0
- package/dist/esm/types/components/icons/CompassRound.d.ts +8 -0
- package/dist/esm/types/components/icons/DashboardFast.d.ts +4 -0
- package/dist/esm/types/components/icons/DotGrid.d.ts +4 -1
- package/dist/esm/types/components/icons/Help.d.ts +16 -0
- package/dist/esm/types/components/icons/Infinity.d.ts +4 -0
- package/dist/esm/types/components/icons/Lightning.d.ts +4 -0
- package/dist/esm/types/components/icons/SquidLogo.d.ts +1 -0
- package/dist/esm/types/components/icons/SwapStepSeparator.d.ts +1 -0
- package/dist/esm/types/components/icons/TradingViewSteps.d.ts +4 -0
- package/dist/esm/types/components/layout/Boost.d.ts +9 -1
- package/dist/esm/types/components/layout/DropdownMenu.d.ts +9 -0
- package/dist/esm/types/components/layout/Menu.d.ts +6 -2
- package/dist/esm/types/components/layout/NavigationBar.d.ts +3 -1
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +3 -0
- package/dist/esm/types/components/layout/SwapProgressViewHeader.d.ts +6 -0
- package/dist/esm/types/components/layout/SwapStepsCollapsed.d.ts +5 -0
- package/dist/esm/types/components/layout/TokenPair.d.ts +12 -0
- package/dist/esm/types/components/layout/index.d.ts +3 -0
- package/dist/esm/types/components/lists/DropdownMenuItem.d.ts +3 -3
- package/dist/esm/types/components/lists/SettingsItem.d.ts +9 -0
- package/dist/esm/types/components/lists/SwapDetailListItem.d.ts +8 -0
- package/dist/esm/types/components/lists/SwapStepItem.d.ts +9 -0
- package/dist/esm/types/components/lists/index.d.ts +3 -0
- package/dist/esm/types/components/views/ProfileView.d.ts +1 -0
- package/dist/esm/types/components/views/SwapDetailsView.d.ts +1 -0
- package/dist/esm/types/core/themes.d.ts +2 -0
- package/dist/esm/types/hooks/index.d.ts +1 -0
- package/dist/esm/types/hooks/useModal.d.ts +10 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +4 -2
- package/dist/esm/types/stories/buttons/{Dropdown.stories.d.ts → AssetsButton.stories.d.ts} +3 -2
- package/dist/esm/types/stories/buttons/SettingsButton.stories.d.ts +6 -0
- package/dist/esm/types/stories/controls/SettingsSlider.stories.d.ts +7 -0
- package/dist/esm/types/stories/layout/Boost.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/DropdownMenu.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/Menu.stories.d.ts +2 -0
- package/dist/esm/types/stories/layout/NavigationBar.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/SwapProgressView.stories.d.ts +9 -0
- package/dist/esm/types/stories/layout/SwapProgressViewHeader.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/TokenPair.stories.d.ts +6 -0
- package/dist/esm/types/stories/lists/SettingsItem.stories.d.ts +9 -0
- package/dist/esm/types/stories/lists/SwapDetailListItem.stories.d.ts +7 -0
- package/dist/esm/types/stories/lists/SwapStepItem.stories.d.ts +10 -0
- package/dist/esm/types/stories/views/ProfileView.stories.d.ts +6 -0
- package/dist/esm/types/stories/views/SwapDetailsView.stories.d.ts +6 -0
- package/dist/esm/types/types/components.d.ts +11 -0
- package/dist/esm/types/types/config.d.ts +1 -0
- package/dist/index.css +338 -55
- package/dist/index.d.ts +119 -20
- package/package.json +3 -3
- package/dist/cjs/types/components/buttons/Dropdown.d.ts +0 -7
- package/dist/esm/types/components/buttons/Dropdown.d.ts +0 -7
package/dist/cjs/index.js
CHANGED
|
@@ -2574,16 +2574,6 @@ function __rest(s, e) {
|
|
|
2574
2574
|
return t;
|
|
2575
2575
|
}
|
|
2576
2576
|
|
|
2577
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2578
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2579
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2580
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2581
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2582
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2583
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2584
|
-
});
|
|
2585
|
-
}
|
|
2586
|
-
|
|
2587
2577
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2588
2578
|
var e = new Error(message);
|
|
2589
2579
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -2647,6 +2637,9 @@ function ChevronRightSmallIcon() {
|
|
|
2647
2637
|
function ArrowLeftIcon() {
|
|
2648
2638
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsxRuntime.jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2649
2639
|
}
|
|
2640
|
+
function ChevronGrabberVerticalIcon({ size = '16', className, }) {
|
|
2641
|
+
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", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2642
|
+
}
|
|
2650
2643
|
|
|
2651
2644
|
function ArrowButton(_a) {
|
|
2652
2645
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
@@ -2657,350 +2650,229 @@ function ArrowButton(_a) {
|
|
|
2657
2650
|
'aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800'), children: jsxRuntime.jsx(ArrowRightIcon, {}) })] })));
|
|
2658
2651
|
}
|
|
2659
2652
|
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
const boostIndicatorRef = react.useRef(null);
|
|
2663
|
-
function handleToggleBoostMode() {
|
|
2664
|
-
if (!boostIndicatorRef.current)
|
|
2665
|
-
return;
|
|
2666
|
-
// we don't want to trigger the animation when the component is mounted
|
|
2667
|
-
// so we set the animation duration only when user clicks the button
|
|
2668
|
-
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2669
|
-
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2670
|
-
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2671
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2672
|
-
}
|
|
2673
|
-
else {
|
|
2674
|
-
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2675
|
-
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
return (jsxRuntime.jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsxRuntime.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxRuntime.jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
2679
|
-
boxShadow: generateMarkerLines(40),
|
|
2680
|
-
} })] }), jsxRuntime.jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current', `tw-duration-${animationDuration}`) })] }));
|
|
2681
|
-
}
|
|
2682
|
-
function generateMarkerLines(count) {
|
|
2683
|
-
const halfCount = Math.ceil(count / 2);
|
|
2684
|
-
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2685
|
-
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2686
|
-
});
|
|
2687
|
-
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2688
|
-
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2689
|
-
});
|
|
2690
|
-
const allShadows = [...rightShadows, ...leftShadows];
|
|
2691
|
-
return allShadows.join(', ');
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
const buttonSizeClassMap = {
|
|
2695
|
-
md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-border tw-flex tw-items-center tw-gap-squid-xxs tw-min-w-[60px] tw-h-squid-xl tw-justify-center',
|
|
2696
|
-
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2697
|
-
};
|
|
2698
|
-
const buttonVariantClassMap = {
|
|
2699
|
-
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2700
|
-
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2701
|
-
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2702
|
-
};
|
|
2703
|
-
// right now all variants have the same disabled styles
|
|
2704
|
-
// in the future, we can add more disabled styles for different variants
|
|
2705
|
-
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2706
|
-
function Button(_a) {
|
|
2707
|
-
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2708
|
-
return (jsxRuntime.jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2709
|
-
// disabled styles
|
|
2710
|
-
buttonDisabledClass,
|
|
2711
|
-
// custom classes from props
|
|
2712
|
-
props.className), children: size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2713
|
-
// label only
|
|
2714
|
-
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2715
|
-
// icon only
|
|
2716
|
-
icon) : (
|
|
2717
|
-
// icon and label
|
|
2718
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
function Chip(_a) {
|
|
2722
|
-
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2723
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2653
|
+
function PlusIcon() {
|
|
2654
|
+
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" }) }));
|
|
2724
2655
|
}
|
|
2725
2656
|
|
|
2657
|
+
const SQUID_THEME_CSS_VARIABLE_PREFIX = '--squid-theme-';
|
|
2726
2658
|
/**
|
|
2727
2659
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
2728
2660
|
*/
|
|
2729
2661
|
const themeTypesKeys = {
|
|
2730
2662
|
'accent-gold': {
|
|
2731
|
-
cssVariable:
|
|
2663
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-gold`,
|
|
2732
2664
|
},
|
|
2733
2665
|
'accent-salmon': {
|
|
2734
|
-
cssVariable:
|
|
2666
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-salmon`,
|
|
2735
2667
|
},
|
|
2736
2668
|
'grey-100': {
|
|
2737
|
-
cssVariable:
|
|
2669
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-100`,
|
|
2738
2670
|
},
|
|
2739
2671
|
'grey-200': {
|
|
2740
|
-
cssVariable:
|
|
2672
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-200`,
|
|
2741
2673
|
},
|
|
2742
2674
|
'grey-300': {
|
|
2743
|
-
cssVariable:
|
|
2675
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-300`,
|
|
2744
2676
|
},
|
|
2745
2677
|
'grey-400': {
|
|
2746
|
-
cssVariable:
|
|
2678
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-400`,
|
|
2747
2679
|
},
|
|
2748
2680
|
'grey-500': {
|
|
2749
|
-
cssVariable:
|
|
2681
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-500`,
|
|
2750
2682
|
},
|
|
2751
2683
|
'grey-600': {
|
|
2752
|
-
cssVariable:
|
|
2684
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-600`,
|
|
2753
2685
|
},
|
|
2754
2686
|
'grey-700': {
|
|
2755
|
-
cssVariable:
|
|
2687
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-700`,
|
|
2756
2688
|
},
|
|
2757
2689
|
'grey-800': {
|
|
2758
|
-
cssVariable:
|
|
2690
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-800`,
|
|
2759
2691
|
},
|
|
2760
2692
|
'grey-900': {
|
|
2761
|
-
cssVariable:
|
|
2693
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-900`,
|
|
2762
2694
|
},
|
|
2763
2695
|
'material-dark-average': {
|
|
2764
|
-
cssVariable:
|
|
2696
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-average`,
|
|
2765
2697
|
},
|
|
2766
2698
|
'material-dark-thick': {
|
|
2767
|
-
cssVariable:
|
|
2699
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-thick`,
|
|
2768
2700
|
},
|
|
2769
2701
|
'material-dark-thin': {
|
|
2770
|
-
cssVariable:
|
|
2702
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-dark-thin`,
|
|
2771
2703
|
},
|
|
2772
2704
|
'material-light-average': {
|
|
2773
|
-
cssVariable:
|
|
2705
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-average`,
|
|
2774
2706
|
},
|
|
2775
2707
|
'material-light-thick': {
|
|
2776
|
-
cssVariable:
|
|
2708
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thick`,
|
|
2777
2709
|
},
|
|
2778
2710
|
'material-light-thin': {
|
|
2779
|
-
cssVariable:
|
|
2711
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thin`,
|
|
2780
2712
|
},
|
|
2781
2713
|
'royal-100': {
|
|
2782
|
-
cssVariable:
|
|
2714
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-100`,
|
|
2783
2715
|
},
|
|
2784
2716
|
'royal-200': {
|
|
2785
|
-
cssVariable:
|
|
2717
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-200`,
|
|
2786
2718
|
},
|
|
2787
2719
|
'royal-300': {
|
|
2788
|
-
cssVariable:
|
|
2720
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-300`,
|
|
2789
2721
|
},
|
|
2790
2722
|
'royal-400': {
|
|
2791
|
-
cssVariable:
|
|
2723
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-400`,
|
|
2792
2724
|
},
|
|
2793
2725
|
'royal-500': {
|
|
2794
|
-
cssVariable:
|
|
2726
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-500`,
|
|
2795
2727
|
},
|
|
2796
2728
|
'royal-600': {
|
|
2797
|
-
cssVariable:
|
|
2729
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-600`,
|
|
2798
2730
|
},
|
|
2799
2731
|
'royal-700': {
|
|
2800
|
-
cssVariable:
|
|
2732
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-700`,
|
|
2801
2733
|
},
|
|
2802
2734
|
'royal-800': {
|
|
2803
|
-
cssVariable:
|
|
2735
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-800`,
|
|
2804
2736
|
},
|
|
2805
2737
|
'status-negative': {
|
|
2806
|
-
cssVariable:
|
|
2738
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-negative`,
|
|
2807
2739
|
},
|
|
2808
2740
|
'status-positive': {
|
|
2809
|
-
cssVariable:
|
|
2741
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-positive`,
|
|
2810
2742
|
},
|
|
2811
2743
|
'volt-300': {
|
|
2812
|
-
cssVariable:
|
|
2744
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-300`,
|
|
2813
2745
|
},
|
|
2814
2746
|
'volt-400': {
|
|
2815
|
-
cssVariable:
|
|
2747
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-400`,
|
|
2816
2748
|
},
|
|
2817
2749
|
'volt-600': {
|
|
2818
|
-
cssVariable:
|
|
2750
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-600`,
|
|
2819
2751
|
},
|
|
2820
2752
|
'volt-700': {
|
|
2821
|
-
cssVariable:
|
|
2753
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-700`,
|
|
2822
2754
|
},
|
|
2823
2755
|
'volt-800': {
|
|
2824
|
-
cssVariable:
|
|
2756
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-800`,
|
|
2825
2757
|
},
|
|
2826
2758
|
'volt-900': {
|
|
2827
|
-
cssVariable:
|
|
2759
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-900`,
|
|
2828
2760
|
},
|
|
2829
2761
|
};
|
|
2830
2762
|
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
const getParsedStyle = (style) => {
|
|
2836
|
-
if (style) {
|
|
2837
|
-
const styleKeys = Object.keys(themeTypesKeys);
|
|
2838
|
-
const parsed = styleKeys.map((sk) => {
|
|
2839
|
-
const themeItem = themeTypesKeys[sk];
|
|
2840
|
-
let userValue = style[sk];
|
|
2841
|
-
return {
|
|
2842
|
-
[themeItem.cssVariable]: userValue,
|
|
2843
|
-
};
|
|
2844
|
-
});
|
|
2845
|
-
// adds a variant with 0.05 opacity for each color
|
|
2846
|
-
// will result in variables like this:
|
|
2847
|
-
// var(--squid-theme-grey-100-005) --> grey-100 with 0.05 opacity
|
|
2848
|
-
// styleKeys.forEach((sk) => {
|
|
2849
|
-
// const themeItem = themeTypesKeys[sk]
|
|
2850
|
-
// const valueWith005Opacity = getHexColorFromOpacityPercentage(
|
|
2851
|
-
// style[sk], // i.e "#ffffff"
|
|
2852
|
-
// 0.05,
|
|
2853
|
-
// )
|
|
2854
|
-
// // { "--squid-theme-grey-100-005": "#ffffff80" }
|
|
2855
|
-
// parsed.push({
|
|
2856
|
-
// [`${themeItem.cssVariable}-005`]: valueWith005Opacity,
|
|
2857
|
-
// })
|
|
2858
|
-
// })
|
|
2859
|
-
parsed.push({
|
|
2860
|
-
[`${themeTypesKeys['grey-100'].cssVariable}-005`]: getHexColorFromOpacityPercentage(style['grey-100'], 0.05),
|
|
2861
|
-
});
|
|
2862
|
-
return parsed.reduce((a, v) => {
|
|
2863
|
-
const key = Object.keys(v)[0];
|
|
2864
|
-
return Object.assign(Object.assign({}, a), { [key]: v[key] });
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
};
|
|
2868
|
-
function getDominantColor(_a) {
|
|
2869
|
-
return __awaiter(this, arguments, void 0, function* ({ imageUrl, sampleSize = 1000, }) {
|
|
2870
|
-
return new Promise((resolve, reject) => {
|
|
2871
|
-
const img = document.createElement('img');
|
|
2872
|
-
img.src = imageUrl;
|
|
2873
|
-
img.crossOrigin = 'Anonymous';
|
|
2874
|
-
img.onload = () => {
|
|
2875
|
-
const canvas = document.createElement('canvas');
|
|
2876
|
-
const ctx = canvas.getContext('2d');
|
|
2877
|
-
if (!ctx)
|
|
2878
|
-
return reject(new Error('Could not create canvas context'));
|
|
2879
|
-
const width = img.width;
|
|
2880
|
-
const height = img.height;
|
|
2881
|
-
const aspectRatio = width / height;
|
|
2882
|
-
const newWidth = Math.sqrt(sampleSize * aspectRatio);
|
|
2883
|
-
const newHeight = Math.sqrt(sampleSize / aspectRatio);
|
|
2884
|
-
canvas.width = newWidth;
|
|
2885
|
-
canvas.height = newHeight;
|
|
2886
|
-
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
|
2887
|
-
const imageData = ctx.getImageData(0, 0, newWidth, newHeight);
|
|
2888
|
-
const data = imageData.data;
|
|
2889
|
-
const colorCounts = {};
|
|
2890
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
2891
|
-
const r = data[i];
|
|
2892
|
-
const g = data[i + 1];
|
|
2893
|
-
const b = data[i + 2];
|
|
2894
|
-
const color = `${r},${g},${b}`;
|
|
2895
|
-
colorCounts[color] = (colorCounts[color] || 0) + 1;
|
|
2896
|
-
}
|
|
2897
|
-
let dominantColor = '';
|
|
2898
|
-
let maxCount = 0;
|
|
2899
|
-
for (const color in colorCounts) {
|
|
2900
|
-
if (colorCounts[color] > maxCount) {
|
|
2901
|
-
dominantColor = color;
|
|
2902
|
-
maxCount = colorCounts[color];
|
|
2903
|
-
}
|
|
2904
|
-
}
|
|
2905
|
-
resolve(dominantColor.split(',').map(Number));
|
|
2906
|
-
};
|
|
2907
|
-
img.onerror = reject;
|
|
2908
|
-
});
|
|
2909
|
-
});
|
|
2910
|
-
}
|
|
2911
|
-
function getContrastColor({ r, g, b, }) {
|
|
2912
|
-
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
2913
|
-
return brightness >= 128 ? '#000' : '#fff';
|
|
2914
|
-
}
|
|
2915
|
-
/**
|
|
2916
|
-
* Returns a hexadecimal color with opacity based on the given color and opacity percentage.
|
|
2917
|
-
*
|
|
2918
|
-
* @example getHexColorFromOpacityPercentage('#FF0000', 0.5) // '#FF000080'
|
|
2919
|
-
*
|
|
2920
|
-
* @param {string} color - The base color in hexadecimal format.
|
|
2921
|
-
* @param {number} opacity - The opacity percentage (0-1).
|
|
2922
|
-
* @returns {string} The hexadecimal color with opacity.
|
|
2923
|
-
*/
|
|
2924
|
-
function getHexColorFromOpacityPercentage(color, opacity) {
|
|
2925
|
-
return (color +
|
|
2926
|
-
Math.round(opacity * 255)
|
|
2927
|
-
.toString(16)
|
|
2928
|
-
.padStart(2, '0')).toUpperCase();
|
|
2929
|
-
}
|
|
2930
|
-
|
|
2931
|
-
function PlusIcon() {
|
|
2932
|
-
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" }) }));
|
|
2933
|
-
}
|
|
2934
|
-
|
|
2935
|
-
const DEFAULT_RGB = [158, 121, 210];
|
|
2936
|
-
const imageClass = 'tw-w-10 tw-aspect-square tw-ml-2 tw-mr-2 -tw-translate-x-2 tw-flex tw-items-center tw-justify-center';
|
|
2937
|
-
function Dropdown({ chainImageUrl, tokenImageUrl, tokenSymbol, }) {
|
|
2938
|
-
const [tokenImageRgb, setTokenImageRgb] = react.useState(DEFAULT_RGB);
|
|
2939
|
-
const [chainImageRgb, setChainImageRgb] = react.useState(DEFAULT_RGB);
|
|
2940
|
-
react.useEffect(() => {
|
|
2941
|
-
if (tokenImageUrl) {
|
|
2942
|
-
// get dominant color when image is loaded
|
|
2943
|
-
getDominantColor({ imageUrl: tokenImageUrl })
|
|
2944
|
-
.then((color) => {
|
|
2945
|
-
setTokenImageRgb(color);
|
|
2946
|
-
})
|
|
2947
|
-
.catch((error) => {
|
|
2948
|
-
setTokenImageRgb(DEFAULT_RGB);
|
|
2949
|
-
console.error('Error getting dominant color for token:', error);
|
|
2950
|
-
});
|
|
2951
|
-
}
|
|
2952
|
-
if (chainImageUrl) {
|
|
2953
|
-
getDominantColor({ imageUrl: chainImageUrl })
|
|
2954
|
-
.then((color) => {
|
|
2955
|
-
setChainImageRgb(color);
|
|
2956
|
-
})
|
|
2957
|
-
.catch((error) => {
|
|
2958
|
-
setChainImageRgb(DEFAULT_RGB);
|
|
2959
|
-
console.error('Error getting dominant color for chain:', error);
|
|
2960
|
-
});
|
|
2961
|
-
}
|
|
2962
|
-
}, []);
|
|
2963
|
-
const dropdownGradient = react.useMemo(() => {
|
|
2964
|
-
const defaultRgb = DEFAULT_RGB.join(',');
|
|
2965
|
-
// if no chain icon, gradient is as follows:
|
|
2966
|
-
// 0%-100% default color
|
|
2763
|
+
const imageClass = 'tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center';
|
|
2764
|
+
const defaultBgColor = `var(${themeTypesKeys['royal-500'].cssVariable})`;
|
|
2765
|
+
function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor = defaultBgColor, tokenBgColor = defaultBgColor, tokenTextColor, }) {
|
|
2766
|
+
const bgGradient = react.useMemo(() => {
|
|
2967
2767
|
if (!chainImageUrl) {
|
|
2968
|
-
return `linear-gradient(to right,
|
|
2768
|
+
return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
|
|
2969
2769
|
}
|
|
2970
|
-
const tokenRgb = tokenImageRgb.join(',');
|
|
2971
|
-
const chainRgb = chainImageRgb.join(',');
|
|
2972
|
-
// if chain icon present but no token icon, gradient is as follows:
|
|
2973
|
-
// 0%-25% chain color, 25%-100% default color
|
|
2974
2770
|
if (!tokenImageUrl) {
|
|
2975
|
-
return `linear-gradient(
|
|
2771
|
+
return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
|
|
2976
2772
|
}
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2773
|
+
return `linear-gradient(to right, ${chainBgColor} 47.5%, ${tokenBgColor} 52.5%)`;
|
|
2774
|
+
}, [chainBgColor, tokenBgColor]);
|
|
2775
|
+
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-min-w-[209px] tw-items-center tw-text-grey-100", children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-items-center tw-justify-between', tokenImageUrl ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
|
|
2776
|
+
backgroundImage: bgGradient,
|
|
2777
|
+
}, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chainImageUrl ? (jsxRuntime.jsx("img", { src: chainImageUrl, alt: "" })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(PlusIcon, {}) })) }) }), tokenImageUrl && chainImageUrl ? (jsxRuntime.jsx("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-rounded-bl-full tw-rounded-tl-full tw-border-b tw-border-t tw-border-material-light-thin'), style: {
|
|
2778
|
+
backgroundColor: tokenBgColor,
|
|
2779
|
+
}, children: jsxRuntime.jsx("img", { src: tokenImageUrl, alt: "", className: "tw-h-full -tw-translate-x-[2px]" }) })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', tokenImageUrl && 'tw-pl-[7px]'), style: {
|
|
2780
|
+
backgroundColor: tokenBgColor,
|
|
2781
|
+
color: tokenTextColor,
|
|
2782
|
+
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, {})] })] }));
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
const animationDuration = '500ms';
|
|
2786
|
+
function BoostButton({ boostMode, onToggleBoostMode, }) {
|
|
2787
|
+
const boostIndicatorRef = react.useRef(null);
|
|
2788
|
+
function handleToggleBoostMode() {
|
|
2789
|
+
if (!boostIndicatorRef.current)
|
|
2790
|
+
return;
|
|
2791
|
+
// we don't want to trigger the animation when the component is mounted
|
|
2792
|
+
// so we set the animation duration only when user clicks the button
|
|
2793
|
+
boostIndicatorRef.current.style.setProperty('--boost-animation-duration', animationDuration);
|
|
2794
|
+
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
2795
|
+
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
2796
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
2797
|
+
}
|
|
2798
|
+
else {
|
|
2799
|
+
boostIndicatorRef.current.dataset.boostMode = 'normal';
|
|
2800
|
+
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
return (jsxRuntime.jsxs("div", { onClick: handleToggleBoostMode, className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-bg-grey-900 tw-pb-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent" }), jsxRuntime.jsx("span", { className: "tw-via-grey-900/70 tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent" }), jsxRuntime.jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-items-center tw-justify-between tw-transition-transform data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsxRuntime.jsx("div", { className: "tw-w-1/2 tw-text-center", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-1/2 tw-text-center", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
|
|
2804
|
+
boxShadow: generateMarkerLines(40),
|
|
2805
|
+
} })] }), jsxRuntime.jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
2806
|
+
transitionDuration: animationDuration,
|
|
2807
|
+
} })] }));
|
|
2808
|
+
}
|
|
2809
|
+
function generateMarkerLines(count) {
|
|
2810
|
+
const halfCount = Math.ceil(count / 2);
|
|
2811
|
+
const rightShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2812
|
+
return `-${(index + 1) * 6}px 0 currentColor`;
|
|
2813
|
+
});
|
|
2814
|
+
const leftShadows = Array.from({ length: halfCount }, (_, index) => {
|
|
2815
|
+
return `${(index + 1) * 6}px 0 currentColor`;
|
|
2816
|
+
});
|
|
2817
|
+
const allShadows = [...rightShadows, ...leftShadows];
|
|
2818
|
+
return allShadows.join(', ');
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
const buttonSizeClassMap = {
|
|
2822
|
+
md: 'tw-px-squid-xs tw-py-squid-xxs tw-rounded-squid-m tw-border tw-flex tw-items-center tw-gap-squid-xxs tw-min-w-[60px] tw-h-squid-xl tw-justify-center',
|
|
2823
|
+
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
2993
2824
|
};
|
|
2994
|
-
const
|
|
2995
|
-
|
|
2825
|
+
const buttonVariantClassMap = {
|
|
2826
|
+
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
2827
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
2828
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
2996
2829
|
};
|
|
2830
|
+
// right now all variants have the same disabled styles
|
|
2831
|
+
// in the future, we can add more disabled styles for different variants
|
|
2832
|
+
const buttonDisabledClass = 'disabled:tw-bg-grey-800 disabled:tw-text-grey-600';
|
|
2833
|
+
function Button(_a) {
|
|
2834
|
+
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
2835
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { disabled: disabled, className: clsx(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2836
|
+
// disabled styles
|
|
2837
|
+
buttonDisabledClass,
|
|
2838
|
+
// custom classes from props
|
|
2839
|
+
props.className), children: size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
2840
|
+
// label only
|
|
2841
|
+
jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
2842
|
+
// icon only
|
|
2843
|
+
icon) : (
|
|
2844
|
+
// icon and label
|
|
2845
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })));
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
function Chip(_a) {
|
|
2849
|
+
var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
|
|
2850
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
2851
|
+
}
|
|
2997
2852
|
|
|
2998
2853
|
function EthereumIcon() {
|
|
2999
2854
|
return (jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
|
|
3000
2855
|
}
|
|
3001
2856
|
|
|
3002
2857
|
function FeeButton() {
|
|
3003
|
-
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-px-squid-xs", children: [jsxRuntime.jsx(Chip, { label: "Fee" }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2858
|
+
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(Chip, { label: "Fee" }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(EthereumIcon, {}) }), jsxRuntime.jsx(UsdAmount, { usdAmount: 560 })] })] }));
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
// font size, line height, and letter spacing classes
|
|
2862
|
+
const textClassMap = {
|
|
2863
|
+
small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
|
|
2864
|
+
medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
|
|
2865
|
+
large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
|
|
2866
|
+
};
|
|
2867
|
+
function HeadingText({ children, bold, size }) {
|
|
2868
|
+
const fontWeightClass = bold
|
|
2869
|
+
? 'tw-font-heading-bold'
|
|
2870
|
+
: 'tw-font-heading-regular';
|
|
2871
|
+
return (jsxRuntime.jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
function SettingsButton({ label }) {
|
|
2875
|
+
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 }) }));
|
|
3004
2876
|
}
|
|
3005
2877
|
|
|
3006
2878
|
function SearchIcon() {
|
|
@@ -3015,6 +2887,10 @@ const PasteButton = () => {
|
|
|
3015
2887
|
return (jsxRuntime.jsx("button", { 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" }) }));
|
|
3016
2888
|
};
|
|
3017
2889
|
|
|
2890
|
+
function SettingsSlider({ value, type }) {
|
|
2891
|
+
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" }) })] }));
|
|
2892
|
+
}
|
|
2893
|
+
|
|
3018
2894
|
const switchSizeClassMap = {
|
|
3019
2895
|
small: 'tw-w-[36px] tw-h-squid-m tw-p-0.5',
|
|
3020
2896
|
large: 'tw-w-[54px] tw-h-squid-l tw-p-[3px]',
|
|
@@ -3023,14 +2899,14 @@ const switchCircleSizeClassMap = {
|
|
|
3023
2899
|
small: 'tw-w-4 tw-h-4',
|
|
3024
2900
|
large: 'tw-w-6 tw-h-6',
|
|
3025
2901
|
};
|
|
3026
|
-
function Switch({ checked, onChange, size }) {
|
|
2902
|
+
function Switch({ checked = false, onChange, size }) {
|
|
3027
2903
|
return (
|
|
3028
2904
|
// Switch container
|
|
3029
2905
|
jsxRuntime.jsxs("label", { className: clsx('tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin',
|
|
3030
2906
|
// size styles
|
|
3031
2907
|
switchSizeClassMap[size],
|
|
3032
2908
|
// checked styles
|
|
3033
|
-
checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsxRuntime.jsx("input", { checked: checked, onChange: (e) => onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsxRuntime.jsx("span", { style: {
|
|
2909
|
+
checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800'), children: [jsxRuntime.jsx("input", { checked: checked, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsxRuntime.jsx("span", { style: {
|
|
3034
2910
|
filter: 'drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))',
|
|
3035
2911
|
}, className: clsx('tw-absolute tw-rounded-full tw-border tw-border-material-light-thin',
|
|
3036
2912
|
// size styles
|
|
@@ -3041,12 +2917,13 @@ function Switch({ checked, onChange, size }) {
|
|
|
3041
2917
|
: 'tw-left-0.5 tw-bg-grey-500') })] }));
|
|
3042
2918
|
}
|
|
3043
2919
|
|
|
2920
|
+
const borderRadiusClassMap = {
|
|
2921
|
+
sm: 'tw-rounded-squid-s',
|
|
2922
|
+
lg: 'tw-rounded-squid-m',
|
|
2923
|
+
};
|
|
3044
2924
|
function Menu(_a) {
|
|
3045
|
-
var { children,
|
|
3046
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className:
|
|
3047
|
-
boxShadow: '0px 2px 5px 1px rgba(0, 0, 0, 0.20), 0px 5px 20px -1px rgba(0, 0, 0, 0.33)',
|
|
3048
|
-
backdropFilter: 'blur(calc(20px / 2))',
|
|
3049
|
-
}, className: cn('tw-w-full tw-max-w-[320px] tw-items-center tw-justify-center tw-rounded-squid-m tw-border tw-border-material-light-thin tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick', contentClassName), children: typeof children === 'string' ? (jsxRuntime.jsx(CaptionText, { children: children })) : (children) }) })));
|
|
2925
|
+
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg' } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded"]);
|
|
2926
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), children: jsxRuntime.jsxs("div", { className: cn('tw-backdrop-blur/10 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 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-backdrop-blur/10 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]) })] }) })));
|
|
3050
2927
|
}
|
|
3051
2928
|
|
|
3052
2929
|
const tooltipWidthClassMap = {
|
|
@@ -3062,12 +2939,12 @@ const tooltipThresholdClassMap = {
|
|
|
3062
2939
|
xl: 'tw-pb-squid-xl',
|
|
3063
2940
|
xxl: 'tw-pb-squid-xxl',
|
|
3064
2941
|
};
|
|
3065
|
-
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs',
|
|
3066
|
-
return (jsxRuntime.jsxs("div", { className: cn('tw-relative',
|
|
2942
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, }) {
|
|
2943
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsxRuntime.jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), jsxRuntime.jsx(Menu, { containerClassName: cn('tw-absolute tw-z-40 tw-hidden hover:tw-block peer-hover:tw-block', 'tw-bottom-full tw-left-1/2 -tw-translate-x-1/2', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })] }));
|
|
3067
2944
|
}
|
|
3068
2945
|
|
|
3069
|
-
function Boost() {
|
|
3070
|
-
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs", children: [jsxRuntime.jsx(BoostButton, {}), jsxRuntime.jsx(Chip, { label:
|
|
2946
|
+
function Boost({ boostMode, onToggleBoostMode }) {
|
|
2947
|
+
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-items-center tw-gap-x-squid-xxs tw-bg-grey-900 tw-pr-squid-xxs", children: [jsxRuntime.jsx(BoostButton, { boostMode: boostMode, onToggleBoostMode: onToggleBoostMode }), jsxRuntime.jsx(Chip, { label: boostMode === 'normal' ? '10m' : '20s', className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' ? 'tw-bg-grey-300' : 'tw-bg-status-positive') })] }));
|
|
3071
2948
|
}
|
|
3072
2949
|
|
|
3073
2950
|
var DetailsToolbarState;
|
|
@@ -3090,7 +2967,7 @@ const detailStateClassMap = {
|
|
|
3090
2967
|
};
|
|
3091
2968
|
function DetailsToolbar({ state = DetailsToolbarState.FULL, errorMessage, }) {
|
|
3092
2969
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3093
|
-
return (jsxRuntime.jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsxRuntime.jsx(ErrorMessage, { message: errorMessage })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, {}) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, {}) })] })) }));
|
|
2970
|
+
return (jsxRuntime.jsx("aside", { className: "tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-px-squid-m tw-py-squid-xxs tw-text-grey-500", children: state === DetailsToolbarState.ERROR ? (jsxRuntime.jsx(ErrorMessage, { message: errorMessage })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, {}) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === DetailsToolbarState.LOADING ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { boostMode: "boost" }) })] })) }));
|
|
3094
2971
|
}
|
|
3095
2972
|
const ErrorMessage = ({ message }) => {
|
|
3096
2973
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [jsxRuntime.jsx(EmojiSadIcon, {}), jsxRuntime.jsx(CaptionText, { children: message })] }));
|
|
@@ -3099,30 +2976,19 @@ const ErrorMessage = ({ message }) => {
|
|
|
3099
2976
|
function Modal({ children }) {
|
|
3100
2977
|
return (
|
|
3101
2978
|
// modal container
|
|
3102
|
-
jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m",
|
|
3103
|
-
backdropFilter: 'blur(20px)',
|
|
3104
|
-
}, children: jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-end tw-overflow-hidden", children: children }) }));
|
|
2979
|
+
jsxRuntime.jsx("div", { className: "tw-backdrop-blur/20 tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-thick tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m", children: jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end", children: children }) }));
|
|
3105
2980
|
}
|
|
3106
2981
|
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
};
|
|
3113
|
-
function HeadingText({ children, bold, size }) {
|
|
3114
|
-
const fontWeightClass = bold
|
|
3115
|
-
? 'tw-font-heading-bold'
|
|
3116
|
-
: 'tw-font-heading-regular';
|
|
3117
|
-
return (jsxRuntime.jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3120
|
-
function NavigationBar({ title, displayBackButton = false, logoUrl, }) {
|
|
3121
|
-
return (jsxRuntime.jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-bg-grey-900 tw-text-grey-300'), 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, { variant: "tertiary", size: "md", icon: jsxRuntime.jsx(ArrowLeftIcon, {}) })) : 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(AddressButton, { label: "Connect" }) })] }), 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] }));
|
|
2982
|
+
function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, }) {
|
|
2983
|
+
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
|
|
2984
|
+
? 'group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2'
|
|
2985
|
+
: undefined, variant: "tertiary", size: "md", icon: jsxRuntime.jsx(ArrowLeftIcon, {}) })) : 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(AddressButton, { className: displayButtonShadows
|
|
2986
|
+
? 'group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2'
|
|
2987
|
+
: undefined, label: "Connect" }) })] }), 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] }));
|
|
3122
2988
|
}
|
|
3123
2989
|
|
|
3124
2990
|
function ProductCard({ children }) {
|
|
3125
|
-
return (jsxRuntime.jsx("div", { className: "tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs
|
|
2991
|
+
return (jsxRuntime.jsx("div", { className: "tw-backdrop-blur/10 tw-h-card tw-min-h-card tw-w-card tw-rounded-squid-xl tw-border-[1px] tw-border-solid tw-border-material-light-thick tw-bg-material-light-thick tw-p-squid-xs", children: jsxRuntime.jsx("div", { className: "tw-relative tw-flex tw-h-full tw-max-h-[660px] tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-squid-l tw-bg-grey-900 tw-text-grey-300", children: children }) }));
|
|
3126
2992
|
}
|
|
3127
2993
|
|
|
3128
2994
|
function MaxIcon() {
|
|
@@ -3141,19 +3007,91 @@ function SwapConfiguration({ priceImpactPercentage, amount = 0, swapAmountUsd =
|
|
|
3141
3007
|
const priceImpactClass = (priceImpactPercentage !== null && priceImpactPercentage !== void 0 ? priceImpactPercentage : 0) > 5
|
|
3142
3008
|
? 'tw-text-status-negative'
|
|
3143
3009
|
: 'tw-text-grey-300';
|
|
3144
|
-
return (jsxRuntime.jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-
|
|
3010
|
+
return (jsxRuntime.jsxs("section", { className: "tw-h-[205px] tw-max-h-[205px] tw-bg-grey-900 tw-pb-squid-m", children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxRuntime.jsxs("div", { className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { className: "tw-text-grey-600", size: "small", children: ":" }), jsxRuntime.jsx(WalletAddress, { ens: "so-so.eth" })] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m", children: jsxRuntime.jsx("input", { className: "tw-my-squid-xs tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-royal-400 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-outline-none", placeholder: "0", value: amount }) }), !(token === null || token === void 0 ? void 0 : token.iconUrl) || isFetching ? null : (jsxRuntime.jsxs("footer", { className: "tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(SwapInputsIcon, {}), jsxRuntime.jsx(UsdAmount, { usdAmount: swapAmountUsd }), priceImpactPercentage ? (jsxRuntime.jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, {}), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsx(CaptionText, { children: balance }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
3145
3011
|
}
|
|
3146
3012
|
|
|
3147
|
-
function
|
|
3148
|
-
return (jsxRuntime.
|
|
3013
|
+
function SwapProgressViewHeader({ title, description, }) {
|
|
3014
|
+
return (jsxRuntime.jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsxRuntime.jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsxRuntime.jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
|
|
3149
3015
|
}
|
|
3150
3016
|
|
|
3151
|
-
function
|
|
3152
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "
|
|
3017
|
+
function SwapStepSeparator() {
|
|
3018
|
+
return (jsxRuntime.jsx("span", { className: "tw-flex tw-h-squid-m tw-w-squid-xxl tw-items-center tw-justify-center tw-self-stretch tw-py-0.5", children: jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "21", viewBox: "0 0 4 21", fill: "none", children: jsxRuntime.jsx("path", { d: "M2 2.5V18.5", stroke: "currentColor", "stroke-width": "4", "stroke-linecap": "round" }) }) }));
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
3022
|
+
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-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-pl-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: labelClassName, children: label })] }) }));
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
function useModal(props) {
|
|
3026
|
+
const [isModalOpen, setIsModalOpen] = react.useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
|
|
3027
|
+
const modalRef = react.useRef(null);
|
|
3028
|
+
const openModalButtonRef = react.useRef(null);
|
|
3029
|
+
react.useEffect(() => {
|
|
3030
|
+
const handleClickOutside = (event) => {
|
|
3031
|
+
var _a;
|
|
3032
|
+
// close modal if the user clicked outside of it
|
|
3033
|
+
if (modalRef.current &&
|
|
3034
|
+
!modalRef.current.contains(event.target) &&
|
|
3035
|
+
!((_a = openModalButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
3036
|
+
setIsModalOpen(false);
|
|
3037
|
+
}
|
|
3038
|
+
};
|
|
3039
|
+
document.addEventListener('click', handleClickOutside);
|
|
3040
|
+
return () => {
|
|
3041
|
+
document.removeEventListener('click', handleClickOutside);
|
|
3042
|
+
};
|
|
3043
|
+
}, [modalRef]);
|
|
3044
|
+
const openModal = react.useCallback(() => {
|
|
3045
|
+
setIsModalOpen((prev) => !prev);
|
|
3046
|
+
}, []);
|
|
3047
|
+
const closeModal = react.useCallback(() => {
|
|
3048
|
+
setIsModalOpen(false);
|
|
3049
|
+
}, []);
|
|
3050
|
+
return {
|
|
3051
|
+
isModalOpen,
|
|
3052
|
+
openModal,
|
|
3053
|
+
closeModal,
|
|
3054
|
+
modalRef,
|
|
3055
|
+
openModalButtonRef,
|
|
3056
|
+
};
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
function CompassRound({ size = '20', className, }) {
|
|
3060
|
+
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" })] }));
|
|
3061
|
+
}
|
|
3062
|
+
function CircleX({ size = '20', className, }) {
|
|
3063
|
+
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" }) }));
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
function DotGrid1x3HorizontalIcon({ className, size = '16', }) {
|
|
3067
|
+
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" }) }));
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
function RefreshIcon() {
|
|
3071
|
+
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [jsxRuntime.jsx("path", { d: "M10.8333 17.4999C11.2936 17.4999 11.6667 17.1269 11.6667 16.6666C11.6667 16.2064 11.2936 15.8333 10.8333 15.8333C10.3731 15.8333 10 16.2064 10 16.6666C10 17.1269 10.3731 17.4999 10.8333 17.4999Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M17.5 9.16661C17.5 8.70638 17.1269 8.33328 16.6667 8.33328C16.2064 8.33328 15.8333 8.70638 15.8333 9.16661C15.8333 9.62685 16.2064 9.99995 16.6667 9.99995C17.1269 9.99995 17.5 9.62685 17.5 9.16661Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M16.6079 11.8899C17.0065 12.12 17.143 12.6297 16.9129 13.0283C16.6828 13.4268 16.1731 13.5634 15.7746 13.3333C15.376 13.1032 15.2394 12.5935 15.4695 12.1949C15.6997 11.7964 16.2093 11.6598 16.6079 11.8899Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M14.473 16.0785C14.8716 15.8483 15.0081 15.3387 14.778 14.9401C14.5479 14.5415 14.0382 14.405 13.6397 14.6351C13.2411 14.8652 13.1045 15.3749 13.3347 15.7734C13.5648 16.172 14.0744 16.3086 14.473 16.0785Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M15.7725 6.66661C15.3739 6.89673 14.8642 6.76017 14.6341 6.36159C14.404 5.96301 14.5405 5.45335 14.9391 5.22323C15.3377 4.99312 15.8474 5.12968 16.0775 5.52826C16.3076 5.92683 16.171 6.43649 15.7725 6.66661Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M7.70833 12.2917V16.875H3.125M7.5 16.4063C4.93915 15.4062 3.125 12.915 3.125 10C3.125 6.20304 6.20304 3.125 10 3.125C10.9614 3.125 11.8768 3.32235 12.7077 3.67876", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
3072
|
+
}
|
|
3073
|
+
|
|
3074
|
+
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
3075
|
+
return (jsxRuntime.jsx("div", { ref: dropdownRef, 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: "custom-scrollbar tw-flex tw-w-[144px] tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs", children: items.map((item) => (jsxRuntime.jsx(DropdownMenuItem, Object.assign({}, item)))) }) }) }));
|
|
3153
3076
|
}
|
|
3154
3077
|
|
|
3155
3078
|
function HistoryItem({ firstImageUrl, secondImageUrl, isPending, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, pendingLabel = 'Pending', }) {
|
|
3156
|
-
|
|
3079
|
+
const { isModalOpen, modalRef, openModalButtonRef, openModal } = useModal();
|
|
3080
|
+
return (jsxRuntime.jsx("li", { 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-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 })] }), jsxRuntime.jsx("div", { className: "tw-transition-opacity group-hover/history-item:tw-opacity-0", children: isPending ? (jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: pendingLabel })) : (jsxRuntime.jsx(CaptionText, { children: dateCompleted })) }), jsxRuntime.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: openModal, ref: openModalButtonRef, children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })] }), 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 })] })] }), isModalOpen ? (jsxRuntime.jsx(DropdownMenu, { dropdownRef: modalRef, items: [
|
|
3081
|
+
{
|
|
3082
|
+
label: 'Repeat swap',
|
|
3083
|
+
icon: jsxRuntime.jsx(RefreshIcon, {}),
|
|
3084
|
+
},
|
|
3085
|
+
{
|
|
3086
|
+
label: 'View on xyz',
|
|
3087
|
+
icon: jsxRuntime.jsx(CompassRound, {}),
|
|
3088
|
+
},
|
|
3089
|
+
{
|
|
3090
|
+
label: 'Clear',
|
|
3091
|
+
labelClassName: 'tw-text-status-negative',
|
|
3092
|
+
icon: jsxRuntime.jsx(CircleX, { className: "tw-text-status-negative" }),
|
|
3093
|
+
},
|
|
3094
|
+
] })) : null] }) }));
|
|
3157
3095
|
}
|
|
3158
3096
|
|
|
3159
3097
|
const listItemSizeMap = {
|
|
@@ -3174,15 +3112,134 @@ function SectionTitle({ title, icon, accessory, actionIcon, className, }) {
|
|
|
3174
3112
|
return (jsxRuntime.jsxs("header", { className: cn('tw-flex tw-h-[46px] tw-w-full tw-items-center tw-gap-squid-xxs tw-bg-grey-900 tw-px-squid-m tw-pb-squid-xs tw-pt-squid-m tw-text-royal-400', className), children: [icon, jsxRuntime.jsx(CaptionText, { children: title }), accessory ? (jsxRuntime.jsx(CaptionText, { className: "tw-flex-1 tw-text-right tw-text-grey-500", children: accessory })) : actionIcon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end", children: actionIcon })) : null] }));
|
|
3175
3113
|
}
|
|
3176
3114
|
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3115
|
+
function HelpIcon({ size = '20', className, }) {
|
|
3116
|
+
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" }) }) })] }));
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
function SettingsItem({ icon, label, controls, transparentControls = false, showHelpIcon = true, }) {
|
|
3120
|
+
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-h-[50px] tw-scroll-px-5 tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-grey-900 tw-px-5 tw-py-squid-xs tw-text-grey-300", 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 }), showHelpIcon ? jsxRuntime.jsx(HelpIcon, { className: "tw-text-grey-600" }) : null] }), 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 })] }));
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
function SwapDetailListItem({ label, detail, icon, }) {
|
|
3124
|
+
return (jsxRuntime.jsx("li", { className: "tw-swap-detail-list-item-gradient tw-h-squid-l tw-w-full tw-bg-grey-800 tw-px-squid-xs tw-text-grey-300", children: jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-justify-between tw-gap-squid-xs tw-rounded-squid-xs tw-px-squid-xs", children: [jsxRuntime.jsx("div", { className: "tw-h-6 tw-w-6 tw-text-grey-500", children: icon }), jsxRuntime.jsx(CaptionText, { className: "tw-flex-1 tw-text-grey-500", children: label }), typeof detail === 'string' ? (jsxRuntime.jsx(CaptionText, { children: detail })) : (detail)] }) }));
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, }) {
|
|
3128
|
+
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-bg-grey-800 tw-text-grey-300", children: [showStepSeparator && jsxRuntime.jsx(SwapStepSeparator, {}), jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-center tw-text-royal-400", children: [jsxRuntime.jsx("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: jsxRuntime.jsx(Chip, { className: "tw-w-squid-xl tw-bg-royal-400 tw-text-grey-900", icon: typeof chipContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: chipContent })) : (chipContent) }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map(({ type, value }, index) => {
|
|
3129
|
+
if (type === 'string') {
|
|
3130
|
+
return (
|
|
3131
|
+
// Instead of displaying the string into a single <BodyText />
|
|
3132
|
+
// we split it into multiple <BodyText />
|
|
3133
|
+
// for edge case where the string is too long to fit in one line
|
|
3134
|
+
value
|
|
3135
|
+
.trim()
|
|
3136
|
+
.split(' ')
|
|
3137
|
+
.map((word, i) => (jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[20px]", children: word }, i))));
|
|
3138
|
+
}
|
|
3139
|
+
else if (type === 'image') {
|
|
3140
|
+
return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
|
|
3141
|
+
}
|
|
3142
|
+
return null;
|
|
3143
|
+
}) })] })] }));
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
function SwapStepsCollapsed({ steps, currentStepCount: _currentStepCount, }) {
|
|
3147
|
+
// handles if route component is mounted
|
|
3148
|
+
const [isRouteVisible, setIsRouteVisible] = react.useState(false);
|
|
3149
|
+
const currentStepCount = Math.round(_currentStepCount);
|
|
3150
|
+
// handles if route component is animating to show
|
|
3151
|
+
const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = react.useState(false);
|
|
3152
|
+
const currentStep = steps[currentStepCount - 1];
|
|
3153
|
+
const isLastStep = currentStepCount === steps.length;
|
|
3154
|
+
const isFirstStep = currentStepCount === 1;
|
|
3155
|
+
react.useEffect(() => {
|
|
3156
|
+
// we do not want to unmount the route component if the animation to show route is running
|
|
3157
|
+
if (isShowRouteAnimationRunning)
|
|
3158
|
+
return;
|
|
3159
|
+
// unmount route component when the animation of hiding is done
|
|
3160
|
+
const timeoutId = setTimeout(() => {
|
|
3161
|
+
setIsRouteVisible(false);
|
|
3162
|
+
}, 350);
|
|
3163
|
+
return () => {
|
|
3164
|
+
clearTimeout(timeoutId);
|
|
3165
|
+
};
|
|
3166
|
+
}, [isShowRouteAnimationRunning]);
|
|
3167
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full tw-rounded-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxRuntime.jsxs("button", { onClick: () => {
|
|
3168
|
+
// mount route component and start animation
|
|
3169
|
+
setIsRouteVisible(true);
|
|
3170
|
+
setIsShowRouteAnimationRunning(true);
|
|
3171
|
+
}, className: "tw-relative tw-flex tw-min-h-button tw-w-full tw-items-center tw-overflow-hidden tw-rounded-squid-xxl tw-border tw-border-material-light-thin tw-bg-grey-800 tw-px-squid-xs tw-text-grey-300", children: [!isLastStep && (jsxRuntime.jsxs("span", { className: "tw-absolute -tw-top-1.5", children: [jsxRuntime.jsx("span", { className: "tw-absolute tw-top-1 tw-h-full tw-w-full -tw-translate-x-1/2 tw-bg-gradient-to-b tw-from-grey-800 tw-to-transparent" }), jsxRuntime.jsx(SwapStepSeparator, {})] })), jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: currentStep.descriptionBlocks, chipContent: currentStep.chipContent }), !isFirstStep && (jsxRuntime.jsxs("span", { className: "tw-absolute -tw-bottom-1.5", children: [jsxRuntime.jsx("span", { className: "tw-absolute tw-bottom-1 tw-h-full tw-w-full -tw-translate-x-1/2 tw-bg-gradient-to-b tw-from-transparent tw-to-grey-800" }), jsxRuntime.jsx(SwapStepSeparator, {})] }))] }) }), isRouteVisible && (jsxRuntime.jsxs("div", { className: cn('tw-absolute tw-top-0 tw-z-20 tw-flex tw-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', isShowRouteAnimationRunning
|
|
3172
|
+
? 'tw-animate-slide-to-top'
|
|
3173
|
+
: 'tw-animate-slide-to-bottom'), children: [jsxRuntime.jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsxRuntime.jsx("button", { onClick: () => setIsShowRouteAnimationRunning(false), className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { className: "custom-scrollbar tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1) }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }))] }));
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
function TokenPair({ firstToken, secondToken }) {
|
|
3177
|
+
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxRuntime.jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsxRuntime.jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsxRuntime.jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsxRuntime.jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsxRuntime.jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsxRuntime.jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsxRuntime.jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxRuntime.jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
|
|
3178
|
+
background: `linear-gradient(to right, ${firstToken.bgColor} 43.48%, ${secondToken.bgColor} 56.52%)`,
|
|
3179
|
+
}, children: [jsxRuntime.jsx("img", { className: "tw-ml-[1px] tw-aspect-square tw-w-10", src: firstToken.imageUrl }), jsxRuntime.jsx("img", { className: "tw-mr-[1px] tw-aspect-square tw-w-10", src: secondToken.imageUrl })] })] }));
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
/**
|
|
3183
|
+
* Parsing the user readable config to css variables with HSL values
|
|
3184
|
+
* @param style
|
|
3185
|
+
*/
|
|
3186
|
+
const getParsedStyle = (style) => {
|
|
3187
|
+
if (style) {
|
|
3188
|
+
const styleKeys = Object.keys(themeTypesKeys);
|
|
3189
|
+
const parsed = styleKeys.map((sk) => {
|
|
3190
|
+
const themeItem = themeTypesKeys[sk];
|
|
3191
|
+
let userValue = style[sk];
|
|
3192
|
+
return {
|
|
3193
|
+
[themeItem.cssVariable]: userValue,
|
|
3194
|
+
};
|
|
3195
|
+
});
|
|
3196
|
+
// adds a variant with 0.05 opacity for each color
|
|
3197
|
+
// will result in variables like this:
|
|
3198
|
+
// var(--squid-theme-grey-100-005) --> grey-100 with 0.05 opacity
|
|
3199
|
+
// styleKeys.forEach((sk) => {
|
|
3200
|
+
// const themeItem = themeTypesKeys[sk]
|
|
3201
|
+
// const valueWith005Opacity = getHexColorFromOpacityPercentage(
|
|
3202
|
+
// style[sk], // i.e "#ffffff"
|
|
3203
|
+
// 0.05,
|
|
3204
|
+
// )
|
|
3205
|
+
// // { "--squid-theme-grey-100-005": "#ffffff80" }
|
|
3206
|
+
// parsed.push({
|
|
3207
|
+
// [`${themeItem.cssVariable}-005`]: valueWith005Opacity,
|
|
3208
|
+
// })
|
|
3209
|
+
// })
|
|
3210
|
+
parsed.push({
|
|
3211
|
+
[`${themeTypesKeys['grey-100'].cssVariable}-005`]: getHexColorFromOpacityPercentage(style['grey-100'], 0.05),
|
|
3212
|
+
});
|
|
3213
|
+
return parsed.reduce((a, v) => {
|
|
3214
|
+
const key = Object.keys(v)[0];
|
|
3215
|
+
return Object.assign(Object.assign({}, a), { [key]: v[key] });
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
};
|
|
3219
|
+
/**
|
|
3220
|
+
* Returns a hexadecimal color with opacity based on the given color and opacity percentage.
|
|
3221
|
+
*
|
|
3222
|
+
* @example getHexColorFromOpacityPercentage('#FF0000', 0.5) // '#FF000080'
|
|
3223
|
+
*
|
|
3224
|
+
* @param {string} color - The base color in hexadecimal format.
|
|
3225
|
+
* @param {number} opacity - The opacity percentage (0-1).
|
|
3226
|
+
* @returns {string} The hexadecimal color with opacity.
|
|
3227
|
+
*/
|
|
3228
|
+
function getHexColorFromOpacityPercentage(color, opacity) {
|
|
3229
|
+
return (color +
|
|
3230
|
+
Math.round(opacity * 255)
|
|
3231
|
+
.toString(16)
|
|
3232
|
+
.padStart(2, '0')).toUpperCase();
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3180
3236
|
const parsedStyle = getParsedStyle(theme);
|
|
3181
|
-
return (jsxRuntime.jsx(
|
|
3237
|
+
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: clsx('tw-text-base-content tw-group tw-relative tw-font-geist'), children: children }));
|
|
3182
3238
|
}
|
|
3183
3239
|
|
|
3184
3240
|
exports.AddressButton = AddressButton;
|
|
3185
3241
|
exports.ArrowButton = ArrowButton;
|
|
3242
|
+
exports.AssetsButton = AssetsButton;
|
|
3186
3243
|
exports.BadgeImage = BadgeImage;
|
|
3187
3244
|
exports.BodyText = BodyText;
|
|
3188
3245
|
exports.Boost = Boost;
|
|
@@ -3191,7 +3248,6 @@ exports.Button = Button;
|
|
|
3191
3248
|
exports.CaptionText = CaptionText;
|
|
3192
3249
|
exports.Chip = Chip;
|
|
3193
3250
|
exports.DetailsToolbar = DetailsToolbar;
|
|
3194
|
-
exports.Dropdown = Dropdown;
|
|
3195
3251
|
exports.DropdownMenuItem = DropdownMenuItem;
|
|
3196
3252
|
exports.FeeButton = FeeButton;
|
|
3197
3253
|
exports.HeadingText = HeadingText;
|
|
@@ -3204,9 +3260,18 @@ exports.Modal = Modal;
|
|
|
3204
3260
|
exports.NavigationBar = NavigationBar;
|
|
3205
3261
|
exports.ProductCard = ProductCard;
|
|
3206
3262
|
exports.SectionTitle = SectionTitle;
|
|
3263
|
+
exports.SettingsButton = SettingsButton;
|
|
3264
|
+
exports.SettingsItem = SettingsItem;
|
|
3265
|
+
exports.SettingsSlider = SettingsSlider;
|
|
3207
3266
|
exports.SquidConfigProvider = SquidConfigProvider;
|
|
3208
3267
|
exports.SwapConfiguration = SwapConfiguration;
|
|
3268
|
+
exports.SwapDetailListItem = SwapDetailListItem;
|
|
3269
|
+
exports.SwapProgressViewHeader = SwapProgressViewHeader;
|
|
3270
|
+
exports.SwapStepItem = SwapStepItem;
|
|
3271
|
+
exports.SwapStepsCollapsed = SwapStepsCollapsed;
|
|
3209
3272
|
exports.Switch = Switch;
|
|
3273
|
+
exports.TokenPair = TokenPair;
|
|
3210
3274
|
exports.Tooltip = Tooltip;
|
|
3211
3275
|
exports.UsdAmount = UsdAmount;
|
|
3212
3276
|
exports.WalletAddress = WalletAddress;
|
|
3277
|
+
exports.useModal = useModal;
|