@0xsquid/ui 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +156 -111
- package/dist/cjs/types/components/buttons/BoostButton.d.ts +2 -1
- package/dist/cjs/types/components/buttons/Button.d.ts +2 -1
- package/dist/cjs/types/components/controls/Tooltip.d.ts +2 -1
- package/dist/cjs/types/components/icons/Social.d.ts +4 -0
- package/dist/cjs/types/components/layout/Boost.d.ts +2 -1
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +2 -1
- package/dist/cjs/types/components/lists/ListItem.d.ts +1 -1
- package/dist/cjs/types/core/constants.d.ts +4 -0
- package/dist/cjs/types/core/themes.d.ts +1 -0
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +2 -2
- package/dist/cjs/types/services/internal/colorService.d.ts +16 -1
- package/dist/cjs/types/stories/buttons/BoostButton.stories.d.ts +1 -0
- package/dist/cjs/types/stories/buttons/Button.stories.d.ts +2 -0
- package/dist/cjs/types/stories/layout/Boost.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
- package/dist/cjs/types/stories/lists/ListItem.stories.d.ts +1 -0
- package/dist/cjs/types/types/config.d.ts +23 -16
- package/dist/esm/index.js +156 -111
- package/dist/esm/types/components/buttons/BoostButton.d.ts +2 -1
- package/dist/esm/types/components/buttons/Button.d.ts +2 -1
- package/dist/esm/types/components/controls/Tooltip.d.ts +2 -1
- package/dist/esm/types/components/icons/Social.d.ts +4 -0
- package/dist/esm/types/components/layout/Boost.d.ts +2 -1
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +2 -1
- package/dist/esm/types/components/lists/ListItem.d.ts +1 -1
- package/dist/esm/types/core/constants.d.ts +4 -0
- package/dist/esm/types/core/themes.d.ts +1 -0
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +2 -2
- package/dist/esm/types/services/internal/colorService.d.ts +16 -1
- package/dist/esm/types/stories/buttons/BoostButton.stories.d.ts +1 -0
- package/dist/esm/types/stories/buttons/Button.stories.d.ts +2 -0
- package/dist/esm/types/stories/layout/Boost.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
- package/dist/esm/types/stories/lists/ListItem.stories.d.ts +1 -0
- package/dist/esm/types/types/config.d.ts +23 -16
- package/dist/index.css +84 -40
- package/dist/index.d.ts +31 -40
- package/package.json +1 -1
- package/dist/cjs/types/components/views/ProfileView.d.ts +0 -1
- package/dist/cjs/types/stories/views/ProfileView.stories.d.ts +0 -6
- package/dist/esm/types/components/views/ProfileView.d.ts +0 -1
- package/dist/esm/types/stories/views/ProfileView.stories.d.ts +0 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The color format must be of type #FFFFFF
|
|
3
3
|
*/
|
|
4
4
|
export type ColorType = `#${string}${string}${string}${string}${string}${string}`;
|
|
5
|
-
export interface
|
|
5
|
+
export interface InternalSquidTheme {
|
|
6
6
|
'grey-100': string;
|
|
7
7
|
'grey-200': string;
|
|
8
8
|
'grey-300': string;
|
|
@@ -12,14 +12,8 @@ export interface SquidTheme {
|
|
|
12
12
|
'grey-700': string;
|
|
13
13
|
'grey-800': string;
|
|
14
14
|
'grey-900': string;
|
|
15
|
-
'royal-100': string;
|
|
16
|
-
'royal-200': string;
|
|
17
|
-
'royal-300': string;
|
|
18
15
|
'royal-400': string;
|
|
19
16
|
'royal-500': string;
|
|
20
|
-
'royal-600': string;
|
|
21
|
-
'royal-700': string;
|
|
22
|
-
'royal-800': string;
|
|
23
17
|
'status-positive': string;
|
|
24
18
|
'status-negative': string;
|
|
25
19
|
'material-light-thin': string;
|
|
@@ -28,19 +22,32 @@ export interface SquidTheme {
|
|
|
28
22
|
'material-dark-thin': string;
|
|
29
23
|
'material-dark-average': string;
|
|
30
24
|
'material-dark-thick': string;
|
|
31
|
-
'volt-300': string;
|
|
32
|
-
'volt-400': string;
|
|
33
|
-
'volt-600': string;
|
|
34
|
-
'volt-700': string;
|
|
35
|
-
'volt-800': string;
|
|
36
|
-
'volt-900': string;
|
|
37
|
-
'accent-salmon': string;
|
|
38
|
-
'accent-gold': string;
|
|
39
25
|
}
|
|
26
|
+
export type SquidTheme = {
|
|
27
|
+
'content-100': string;
|
|
28
|
+
'content-200': string;
|
|
29
|
+
'content-300': string;
|
|
30
|
+
'content-400': string;
|
|
31
|
+
'content-500': string;
|
|
32
|
+
'content-600': string;
|
|
33
|
+
'content-700': string;
|
|
34
|
+
'content-800': string;
|
|
35
|
+
'content-900': string;
|
|
36
|
+
'accent-400': string;
|
|
37
|
+
'accent-500': string;
|
|
38
|
+
'status-positive': string;
|
|
39
|
+
'status-negative': string;
|
|
40
|
+
'transparent-light-thin': string;
|
|
41
|
+
'transparent-light-average': string;
|
|
42
|
+
'transparent-light-thick': string;
|
|
43
|
+
'transparent-dark-thin': string;
|
|
44
|
+
'transparent-dark-average': string;
|
|
45
|
+
'transparent-dark-thick': string;
|
|
46
|
+
};
|
|
40
47
|
export declare const SQUID_THEME_CSS_VARIABLE_PREFIX = "--squid-theme-";
|
|
41
48
|
/**
|
|
42
49
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
43
50
|
*/
|
|
44
|
-
export declare const themeTypesKeys: Record<keyof
|
|
51
|
+
export declare const themeTypesKeys: Record<keyof InternalSquidTheme, {
|
|
45
52
|
cssVariable: string;
|
|
46
53
|
}>;
|
package/dist/esm/index.js
CHANGED
|
@@ -2678,12 +2678,6 @@ const SQUID_THEME_CSS_VARIABLE_PREFIX = '--squid-theme-';
|
|
|
2678
2678
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
2679
2679
|
*/
|
|
2680
2680
|
const themeTypesKeys = {
|
|
2681
|
-
'accent-gold': {
|
|
2682
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-gold`,
|
|
2683
|
-
},
|
|
2684
|
-
'accent-salmon': {
|
|
2685
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}accent-salmon`,
|
|
2686
|
-
},
|
|
2687
2681
|
'grey-100': {
|
|
2688
2682
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}grey-100`,
|
|
2689
2683
|
},
|
|
@@ -2729,54 +2723,18 @@ const themeTypesKeys = {
|
|
|
2729
2723
|
'material-light-thin': {
|
|
2730
2724
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}material-light-thin`,
|
|
2731
2725
|
},
|
|
2732
|
-
'royal-100': {
|
|
2733
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-100`,
|
|
2734
|
-
},
|
|
2735
|
-
'royal-200': {
|
|
2736
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-200`,
|
|
2737
|
-
},
|
|
2738
|
-
'royal-300': {
|
|
2739
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-300`,
|
|
2740
|
-
},
|
|
2741
2726
|
'royal-400': {
|
|
2742
2727
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-400`,
|
|
2743
2728
|
},
|
|
2744
2729
|
'royal-500': {
|
|
2745
2730
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-500`,
|
|
2746
2731
|
},
|
|
2747
|
-
'royal-600': {
|
|
2748
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-600`,
|
|
2749
|
-
},
|
|
2750
|
-
'royal-700': {
|
|
2751
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-700`,
|
|
2752
|
-
},
|
|
2753
|
-
'royal-800': {
|
|
2754
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}royal-800`,
|
|
2755
|
-
},
|
|
2756
2732
|
'status-negative': {
|
|
2757
2733
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-negative`,
|
|
2758
2734
|
},
|
|
2759
2735
|
'status-positive': {
|
|
2760
2736
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-positive`,
|
|
2761
2737
|
},
|
|
2762
|
-
'volt-300': {
|
|
2763
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-300`,
|
|
2764
|
-
},
|
|
2765
|
-
'volt-400': {
|
|
2766
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-400`,
|
|
2767
|
-
},
|
|
2768
|
-
'volt-600': {
|
|
2769
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-600`,
|
|
2770
|
-
},
|
|
2771
|
-
'volt-700': {
|
|
2772
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-700`,
|
|
2773
|
-
},
|
|
2774
|
-
'volt-800': {
|
|
2775
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-800`,
|
|
2776
|
-
},
|
|
2777
|
-
'volt-900': {
|
|
2778
|
-
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}volt-900`,
|
|
2779
|
-
},
|
|
2780
2738
|
};
|
|
2781
2739
|
|
|
2782
2740
|
function PlusIcon() {
|
|
@@ -2805,6 +2763,11 @@ function AssetsButton({ chainImageUrl, tokenImageUrl, tokenSymbol, chainBgColor
|
|
|
2805
2763
|
}, children: [jsx(BodyText, { size: "small", className: "tw-leading-[13px]", children: tokenImageUrl ? tokenSymbol : 'Select token' }), jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
|
|
2806
2764
|
}
|
|
2807
2765
|
|
|
2766
|
+
const CSS_VARS = {
|
|
2767
|
+
MOVE_WITH_SPRING_BOUNCE_DURATION: '--squid-animation-move-with-spring-bounce-duration',
|
|
2768
|
+
DISPLAY_DELAYED_DURATION: '--squid-animation-display-delayed-duration',
|
|
2769
|
+
};
|
|
2770
|
+
|
|
2808
2771
|
function SearchIcon() {
|
|
2809
2772
|
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M20 20L16.05 16.05M18 11C18 14.866 14.866 18 11 18C7.13401 18 4 14.866 4 11C4 7.13401 7.13401 4 11 4C14.866 4 18 7.13401 18 11Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
2810
2773
|
}
|
|
@@ -3007,7 +2970,7 @@ const borderRadiusClassMap = {
|
|
|
3007
2970
|
};
|
|
3008
2971
|
function Menu(_a) {
|
|
3009
2972
|
var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
|
|
3010
|
-
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsx("div", { className: "tw-z-20 tw-max-w-full", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
2973
|
+
return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-s tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch", children: children })) : (jsx("div", { className: "tw-z-20 tw-max-w-full tw-text-caption", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
|
|
3011
2974
|
}
|
|
3012
2975
|
|
|
3013
2976
|
const tooltipWidthClassMap = {
|
|
@@ -3023,19 +2986,25 @@ const tooltipThresholdClassMap = {
|
|
|
3023
2986
|
xl: 'tw-pb-squid-xl',
|
|
3024
2987
|
xxl: 'tw-pb-squid-xxl',
|
|
3025
2988
|
};
|
|
3026
|
-
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, }) {
|
|
3027
|
-
return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsx(Menu, {
|
|
2989
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, }) {
|
|
2990
|
+
return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsx(Menu, { style: {
|
|
2991
|
+
[CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms`,
|
|
2992
|
+
}, containerClassName: cn(
|
|
2993
|
+
// general styles
|
|
2994
|
+
'tw-absolute tw-z-40 tw-bottom-full tw-left-1/2 -tw-translate-x-1/2',
|
|
2995
|
+
// visibility styles. Display only on hover
|
|
2996
|
+
'tw-opacity-0 hover:tw-animate-display-delayed peer-hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
|
|
3028
2997
|
}
|
|
3029
2998
|
|
|
3030
2999
|
const animationDuration = '500ms';
|
|
3031
|
-
function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', }) {
|
|
3000
|
+
function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, }) {
|
|
3032
3001
|
const boostIndicatorRef = useRef(null);
|
|
3033
3002
|
function handleToggleBoostMode() {
|
|
3034
3003
|
if (!boostIndicatorRef.current || !canToggleBoostMode)
|
|
3035
3004
|
return;
|
|
3036
3005
|
// we don't want to trigger the animation when the component is mounted
|
|
3037
3006
|
// so we set the animation duration only when user clicks the button
|
|
3038
|
-
boostIndicatorRef.current.style.setProperty(
|
|
3007
|
+
boostIndicatorRef.current.style.setProperty(CSS_VARS.MOVE_WITH_SPRING_BOUNCE_DURATION, animationDuration);
|
|
3039
3008
|
if (boostIndicatorRef.current.dataset.boostMode === 'normal') {
|
|
3040
3009
|
boostIndicatorRef.current.dataset.boostMode = 'boost';
|
|
3041
3010
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'boost' });
|
|
@@ -3045,7 +3014,7 @@ function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode = true,
|
|
|
3045
3014
|
onToggleBoostMode === null || onToggleBoostMode === void 0 ? void 0 : onToggleBoostMode({ boostMode: 'normal' });
|
|
3046
3015
|
}
|
|
3047
3016
|
}
|
|
3048
|
-
return (jsx(Tooltip, { tooltipWidth: "max", tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: "tw-group 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: [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" }), 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" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled:tw-grayscale 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: [jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), 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: {
|
|
3017
|
+
return (jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("button", { onClick: handleToggleBoostMode, disabled: !canToggleBoostMode, className: "tw-group 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: [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" }), 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" }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled:tw-grayscale 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: [jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), 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: {
|
|
3049
3018
|
boxShadow: generateMarkerLines(40),
|
|
3050
3019
|
} })] }), 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 group-disabled:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
|
|
3051
3020
|
transitionDuration: animationDuration,
|
|
@@ -3064,30 +3033,35 @@ function generateMarkerLines(count) {
|
|
|
3064
3033
|
}
|
|
3065
3034
|
|
|
3066
3035
|
const buttonSizeClassMap = {
|
|
3067
|
-
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',
|
|
3068
|
-
lg: 'tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full',
|
|
3036
|
+
md: 'tw-flex 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',
|
|
3037
|
+
lg: 'tw-flex tw-border tw-rounded-squid-xxl tw-p-1 tw-h-button tw-w-full tw-flex tw-items-center',
|
|
3069
3038
|
};
|
|
3070
3039
|
const buttonVariantClassMap = {
|
|
3071
|
-
primary: 'tw-bg-royal-500 tw-text-grey-100 tw-border-material-light-thin',
|
|
3040
|
+
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100 tw-border-material-light-thin',
|
|
3072
3041
|
secondary: 'tw-bg-grey-100 tw-text-grey-800 tw-border-material-light-thin',
|
|
3073
3042
|
tertiary: 'tw-bg-grey-800 tw-text-grey-300 tw-border-material-light-thin',
|
|
3074
3043
|
};
|
|
3075
3044
|
// right now all variants have the same disabled styles
|
|
3076
3045
|
// in the future, we can add more disabled styles for different variants
|
|
3077
|
-
const buttonDisabledClass = '
|
|
3046
|
+
const buttonDisabledClass = 'tw-bg-grey-800 tw-text-grey-600 tw-cursor-not-allowed';
|
|
3078
3047
|
function Button(_a) {
|
|
3079
|
-
var { label, disabled, size, variant, icon } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon"]);
|
|
3080
|
-
|
|
3081
|
-
// disabled styles
|
|
3082
|
-
buttonDisabledClass,
|
|
3083
|
-
// custom classes from props
|
|
3084
|
-
props.className), children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
3048
|
+
var { label, disabled, size, variant, icon, link } = _a, props = __rest(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
|
|
3049
|
+
const children = (jsx(Fragment, { children: size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
|
|
3085
3050
|
// label only
|
|
3086
3051
|
jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
|
|
3087
3052
|
// icon only
|
|
3088
3053
|
icon) : (
|
|
3089
3054
|
// icon and label
|
|
3090
|
-
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null }))
|
|
3055
|
+
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null }));
|
|
3056
|
+
const className = cn(buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
3057
|
+
// disabled styles
|
|
3058
|
+
disabled && buttonDisabledClass,
|
|
3059
|
+
// custom classes from props
|
|
3060
|
+
props.className);
|
|
3061
|
+
if (link) {
|
|
3062
|
+
return (jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
|
|
3063
|
+
}
|
|
3064
|
+
return (jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
|
|
3091
3065
|
}
|
|
3092
3066
|
|
|
3093
3067
|
function Chip(_a) {
|
|
@@ -3108,8 +3082,8 @@ function SettingsButton({ label, isSelected = false, }) {
|
|
|
3108
3082
|
return (jsx("button", { className: cn('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 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
3109
3083
|
}
|
|
3110
3084
|
|
|
3111
|
-
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, }) {
|
|
3112
|
-
return (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: [jsx(BoostButton, { boostMode: boostMode, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, onToggleBoostMode: onToggleBoostMode }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
3085
|
+
function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
|
|
3086
|
+
return (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: [jsx(BoostButton, { boostMode: boostMode, boostDisabledMessage: boostDisabledMessage, canToggleBoostMode: canToggleBoostMode, onToggleBoostMode: onToggleBoostMode, tooltipDisplayDelayMs: boostTooltipDisplayDelayMs }), jsx(Chip, { label: estimatedTime, className: cn('tw-text-grey-900 tw-transition-colors', boostMode === 'normal' || !canToggleBoostMode
|
|
3113
3087
|
? 'tw-bg-grey-300'
|
|
3114
3088
|
: 'tw-bg-status-positive') })] }));
|
|
3115
3089
|
}
|
|
@@ -3128,7 +3102,7 @@ const detailStateClassMap = {
|
|
|
3128
3102
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
3129
3103
|
full: '',
|
|
3130
3104
|
};
|
|
3131
|
-
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }) {
|
|
3105
|
+
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs = 0, }) {
|
|
3132
3106
|
const state = useMemo(() => {
|
|
3133
3107
|
if (errorMessage)
|
|
3134
3108
|
return 'error';
|
|
@@ -3139,11 +3113,11 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3139
3113
|
return 'full';
|
|
3140
3114
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3141
3115
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3142
|
-
return (jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage }) })] })) }));
|
|
3116
|
+
return (jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3143
3117
|
}
|
|
3144
3118
|
|
|
3145
3119
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
3146
|
-
return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs",
|
|
3120
|
+
return (jsx("li", { className: "tw-max-h-squid-xl tw-w-full tw-px-squid-xxs", children: jsxs("button", { onClick: onClick, className: "tw-flex tw-h-squid-l tw-w-full tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-squid-xs tw-px-squid-xxs hover:tw-bg-material-light-thin", children: [jsx("div", { className: "tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-between tw-rounded-squid-xs", children: imageUrl ? (jsx("img", { src: imageUrl, className: "tw-h-full tw-w-full tw-rounded-squid-xxs" })) : (icon) }), jsx(CaptionText, { className: cn(labelClassName, 'tw-max-w-full tw-truncate !tw-leading-[18px]'), children: label })] }) }));
|
|
3147
3121
|
}
|
|
3148
3122
|
|
|
3149
3123
|
function useDropdownMenu(props) {
|
|
@@ -3250,16 +3224,18 @@ const listItemSizeMap = {
|
|
|
3250
3224
|
};
|
|
3251
3225
|
function ListItem(_a) {
|
|
3252
3226
|
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading"]);
|
|
3253
|
-
|
|
3227
|
+
// 'small' variant does not have detail
|
|
3228
|
+
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
3229
|
+
return (jsx("li", { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxs("button", Object.assign({}, props, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xs',
|
|
3254
3230
|
// 'large' variant has extra padding
|
|
3255
|
-
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsx(BodyText, { size: "small", className: "tw-max-w-full tw-truncate !tw-leading-[
|
|
3256
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsx(CaptionText, { className: "tw-h-squid-xs !tw-leading-[
|
|
3231
|
+
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsx(BodyText, { size: "small", className: "tw-max-w-full tw-truncate !tw-leading-[14px]", children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
3232
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsx(CaptionText, { className: "tw-h-squid-xs tw-max-w-full tw-truncate !tw-leading-[11px] tw-text-grey-500", children: subtitle })) : null)] }), showDetail && (jsxs("button", { onClick: (event) => {
|
|
3257
3233
|
// prevent click event from bubbling up to parent
|
|
3258
3234
|
event.stopPropagation();
|
|
3259
3235
|
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
3260
|
-
}, className: cn('tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
3261
|
-
? 'tw-
|
|
3262
|
-
: 'tw-flex', detailButtonClassName), children: [
|
|
3236
|
+
}, className: cn('tw-flex tw-w-fit tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
3237
|
+
? 'tw-opacity-0 hover:tw-opacity-100 focus:tw-opacity-100 group-hover/list-item:tw-opacity-100 group-focus/list-item:tw-opacity-100'
|
|
3238
|
+
: 'tw-flex', detailButtonClassName), children: [!!detail && (jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] }))] })) }));
|
|
3263
3239
|
}
|
|
3264
3240
|
|
|
3265
3241
|
function MenuItem({ label, imageUrl, icon }) {
|
|
@@ -3327,8 +3303,9 @@ const separatorClassMap = {
|
|
|
3327
3303
|
progress: 'tw-text-grey-600',
|
|
3328
3304
|
pending: 'tw-text-grey-600',
|
|
3329
3305
|
};
|
|
3306
|
+
const colorsTransitionClass = 'tw-transition-colors tw-duration-300';
|
|
3330
3307
|
function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, link, status = 'pending', }) {
|
|
3331
|
-
return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-
|
|
3308
|
+
return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-text-grey-300", children: [showStepSeparator && (jsx("span", { className: cn(separatorClassMap[status], colorsTransitionClass, 'tw-duration-100'), children: jsx(SwapStepSeparator, {}) })), jsxs("a", { href: link, target: "_blank", className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClassMap[status], colorsTransitionClass), children: [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: jsx(Chip, { className: cn('tw-w-squid-xl', statusBgClassMap[status], colorsTransitionClass), icon: typeof chipContent === 'string' ? (jsx(CaptionText, { children: chipContent })) : (chipContent) }) }), 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) => {
|
|
3332
3309
|
if (type === 'string') {
|
|
3333
3310
|
return (
|
|
3334
3311
|
// Instead of displaying the string into a single <BodyText />
|
|
@@ -3474,12 +3451,11 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
|
3474
3451
|
};
|
|
3475
3452
|
}, [isShowRouteAnimationRunning]);
|
|
3476
3453
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3477
|
-
return (jsxs(Fragment, { children: [
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsx("div", { className: "tw-absolute tw-left-0 tw-top-full tw-w-full tw-animate-translate-to-top", children: jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), 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" }), 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 && (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: [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
|
|
3454
|
+
return (jsxs(Fragment, { children: [jsxs("button", { className: "tw-group/swap-step-item-button tw-relative tw-max-h-button tw-max-w-[400px] tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800 tw-transition-colors tw-duration-[50ms] hover:tw-bg-grey-700", onClick: () => {
|
|
3455
|
+
// mount route component and start animation
|
|
3456
|
+
setIsRouteVisible(true);
|
|
3457
|
+
setIsShowRouteAnimationRunning(true);
|
|
3458
|
+
}, children: [newStepIndex > currentStepIndex && (jsx("div", { className: "tw-absolute -tw-top-full tw-left-0 tw-w-full tw-animate-translate-to-bottom", children: jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsx(CurrentStep, { className: cn(newStepIndex > currentStepIndex && 'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsx("div", { className: "tw-absolute tw-left-0 tw-top-full tw-w-full tw-animate-translate-to-top", children: jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), 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 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" }), 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 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" })] }), isRouteVisible && (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: [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
|
|
3483
3459
|
? 'tw-animate-fade-in'
|
|
3484
3460
|
: 'tw-animate-fade-out'), onClick: collapseRouteSteps }), 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
|
|
3485
3461
|
? 'tw-animate-slide-to-top'
|
|
@@ -3499,42 +3475,111 @@ function TokenPair({ firstToken, secondToken }) {
|
|
|
3499
3475
|
}, children: [jsx("img", { className: "tw-ml-[1px] tw-aspect-square tw-w-10", src: firstToken.imageUrl }), jsx("img", { className: "tw-mr-[1px] tw-aspect-square tw-w-10", src: secondToken.imageUrl })] })] }));
|
|
3500
3476
|
}
|
|
3501
3477
|
|
|
3478
|
+
const lightTheme = {
|
|
3479
|
+
// content
|
|
3480
|
+
'content-100': '#17191C',
|
|
3481
|
+
'content-200': '#292C32',
|
|
3482
|
+
'content-300': '#4C515D',
|
|
3483
|
+
'content-400': '#626784',
|
|
3484
|
+
'content-500': '#8A8FA8',
|
|
3485
|
+
'content-600': '#A7ABBE',
|
|
3486
|
+
'content-700': '#D1D6E0',
|
|
3487
|
+
'content-800': '#EDEEF3',
|
|
3488
|
+
'content-900': '#FBFBFD',
|
|
3489
|
+
// accent
|
|
3490
|
+
'accent-400': '#9E79D2',
|
|
3491
|
+
'accent-500': '#B893EC',
|
|
3492
|
+
// status
|
|
3493
|
+
'status-positive': '#11D421',
|
|
3494
|
+
'status-negative': '#FF5B4D',
|
|
3495
|
+
// transparent
|
|
3496
|
+
'transparent-light-thin': '#17191C1A', // 10% opacity
|
|
3497
|
+
'transparent-light-average': '#17191C54', // 33% opacity
|
|
3498
|
+
'transparent-light-thick': '#17191CA8', // 66% opacity
|
|
3499
|
+
'transparent-dark-thin': '#FBFBFD1A', // 10% opacity
|
|
3500
|
+
'transparent-dark-average': '#FBFCFD54', // 33% opacity
|
|
3501
|
+
'transparent-dark-thick': '#FBFCFDA8', // 66% opacity
|
|
3502
|
+
};
|
|
3503
|
+
|
|
3504
|
+
const themeKeysToReplace = [
|
|
3505
|
+
{
|
|
3506
|
+
userKey: 'content',
|
|
3507
|
+
internalKey: 'grey',
|
|
3508
|
+
},
|
|
3509
|
+
{
|
|
3510
|
+
userKey: 'accent',
|
|
3511
|
+
internalKey: 'royal',
|
|
3512
|
+
},
|
|
3513
|
+
{
|
|
3514
|
+
userKey: 'transparent',
|
|
3515
|
+
internalKey: 'material',
|
|
3516
|
+
},
|
|
3517
|
+
];
|
|
3502
3518
|
/**
|
|
3503
3519
|
* Parsing the user readable config to css variables
|
|
3520
|
+
* Also maps the public theme variables to the internal theme variables
|
|
3521
|
+
* example user theme:
|
|
3522
|
+
* {
|
|
3523
|
+
* 'content-100': '#000',
|
|
3524
|
+
* 'content-200': '#000',
|
|
3525
|
+
* 'accent-400': '#000',
|
|
3526
|
+
* 'transparent-light-thin': '#000'
|
|
3527
|
+
* }
|
|
3528
|
+
* Resulting in:
|
|
3529
|
+
* {
|
|
3530
|
+
* 'grey-100': '#000',
|
|
3531
|
+
* 'grey-200': '#000',
|
|
3532
|
+
* 'royal-400': '#000',
|
|
3533
|
+
* 'material-light-thin': '#000'
|
|
3534
|
+
* }
|
|
3504
3535
|
* @param style
|
|
3505
3536
|
*/
|
|
3506
|
-
const
|
|
3507
|
-
if (
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3537
|
+
const parseSquidTheme = (userTheme) => {
|
|
3538
|
+
if (!userTheme)
|
|
3539
|
+
return undefined;
|
|
3540
|
+
const squidTheme = Object.entries(userTheme).reduce((internalKeys, [userKey, userValue]) => {
|
|
3541
|
+
// content-* -> grey-*
|
|
3542
|
+
// accent-* -> royal-*
|
|
3543
|
+
// transparent-* -> material-*
|
|
3544
|
+
const keyToReplace = themeKeysToReplace.find((k) => userKey.includes(k.userKey));
|
|
3545
|
+
if (keyToReplace) {
|
|
3546
|
+
const newKey = userKey.replace(keyToReplace.userKey, keyToReplace.internalKey);
|
|
3547
|
+
internalKeys[newKey] = userValue;
|
|
3548
|
+
}
|
|
3549
|
+
else {
|
|
3550
|
+
internalKeys[userKey] = userValue;
|
|
3551
|
+
}
|
|
3552
|
+
return internalKeys;
|
|
3553
|
+
}, {});
|
|
3554
|
+
const styleKeys = Object.keys(themeTypesKeys);
|
|
3555
|
+
const parsed = styleKeys.map((sk) => {
|
|
3556
|
+
const themeItem = themeTypesKeys[sk];
|
|
3557
|
+
let userValue = squidTheme[sk];
|
|
3558
|
+
return {
|
|
3559
|
+
[themeItem.cssVariable]: userValue,
|
|
3560
|
+
};
|
|
3561
|
+
});
|
|
3562
|
+
// adds a variant with 0.05 opacity for each color
|
|
3563
|
+
// will result in variables like this:
|
|
3564
|
+
// var(--squid-theme-grey-100-005) --> grey-100 with 0.05 opacity
|
|
3565
|
+
// styleKeys.forEach((sk) => {
|
|
3566
|
+
// const themeItem = themeTypesKeys[sk]
|
|
3567
|
+
// const valueWith005Opacity = getHexColorFromOpacityPercentage(
|
|
3568
|
+
// style[sk], // i.e "#ffffff"
|
|
3569
|
+
// 0.05,
|
|
3570
|
+
// )
|
|
3571
|
+
// // { "--squid-theme-grey-100-005": "#ffffff80" }
|
|
3572
|
+
// parsed.push({
|
|
3573
|
+
// [`${themeItem.cssVariable}-005`]: valueWith005Opacity,
|
|
3574
|
+
// })
|
|
3575
|
+
// })
|
|
3576
|
+
parsed.push({
|
|
3577
|
+
[`${themeTypesKeys['grey-100'].cssVariable}-005`]: getHexColorFromOpacityPercentage(squidTheme['grey-100'], 0.05),
|
|
3578
|
+
});
|
|
3579
|
+
return parsed.reduce((a, v) => {
|
|
3580
|
+
const key = Object.keys(v)[0];
|
|
3581
|
+
return Object.assign(Object.assign({}, a), { [key]: v[key] });
|
|
3582
|
+
});
|
|
3538
3583
|
};
|
|
3539
3584
|
/**
|
|
3540
3585
|
* Returns a hexadecimal color with opacity based on the given color and opacity percentage.
|
|
@@ -3552,8 +3597,8 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3552
3597
|
.padStart(2, '0')).toUpperCase();
|
|
3553
3598
|
}
|
|
3554
3599
|
|
|
3555
|
-
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3556
|
-
const parsedStyle =
|
|
3600
|
+
function SquidConfigProvider({ theme = lightTheme, children, themeType = 'light', }) {
|
|
3601
|
+
const parsedStyle = parseSquidTheme(theme);
|
|
3557
3602
|
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3558
3603
|
}
|
|
3559
3604
|
|
|
@@ -6,6 +6,7 @@ interface BoostButtonProps {
|
|
|
6
6
|
boostMode: BoostMode;
|
|
7
7
|
}) => void;
|
|
8
8
|
boostDisabledMessage?: string;
|
|
9
|
+
tooltipDisplayDelayMs?: number;
|
|
9
10
|
}
|
|
10
|
-
export declare function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function BoostButton({ boostMode, onToggleBoostMode, canToggleBoostMode, boostDisabledMessage, tooltipDisplayDelayMs, }: BoostButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -6,6 +6,7 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
6
6
|
variant: ButtonVariant;
|
|
7
7
|
size: ButtonSize;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
link?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function Button({ label, disabled, size, variant, icon, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Button({ label, disabled, size, variant, icon, link, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -9,5 +9,6 @@ export interface TooltipProps {
|
|
|
9
9
|
containerClassName?: string;
|
|
10
10
|
childrenClassName?: string;
|
|
11
11
|
tooltipClassName?: string;
|
|
12
|
+
displayDelayMs?: number;
|
|
12
13
|
}
|
|
13
|
-
export declare function Tooltip({ children, tooltipContent, tooltipWidth, threshold, containerClassName, childrenClassName, tooltipClassName, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function Tooltip({ children, tooltipContent, tooltipWidth, threshold, containerClassName, childrenClassName, tooltipClassName, displayDelayMs, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,7 @@ interface BoostProps {
|
|
|
7
7
|
estimatedTime: string;
|
|
8
8
|
boostDisabledMessage?: string;
|
|
9
9
|
canToggleBoostMode?: boolean;
|
|
10
|
+
boostTooltipDisplayDelayMs?: number;
|
|
10
11
|
}
|
|
11
|
-
export declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, boostTooltipDisplayDelayMs, }: BoostProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -17,6 +17,7 @@ interface DetailsToolbarProps {
|
|
|
17
17
|
label: string;
|
|
18
18
|
onClick: () => void;
|
|
19
19
|
};
|
|
20
|
+
boostTooltipDisplayDelayMs?: number;
|
|
20
21
|
}
|
|
21
|
-
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, boostTooltipDisplayDelayMs, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
interface ListItemProps extends React.HTMLAttributes<
|
|
2
|
+
interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
3
3
|
itemTitle: string | React.ReactNode;
|
|
4
4
|
mainImageUrl?: string;
|
|
5
5
|
secondaryImageUrl?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SquidTheme } from '../types/config';
|
|
3
2
|
import { ThemeType } from '../types/components';
|
|
3
|
+
import { SquidTheme } from '../types/config';
|
|
4
4
|
export declare function SquidConfigProvider({ theme, children, themeType, }: {
|
|
5
|
-
theme
|
|
5
|
+
theme?: SquidTheme;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
themeType?: ThemeType;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|