@0xsquid/ui 0.7.4 → 0.7.6
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 +13 -4
- package/dist/cjs/types/components/layout/DetailsToolbar.d.ts +4 -3
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +2 -1
- package/dist/cjs/types/core/themes.d.ts +2 -2
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +2 -2
- package/dist/cjs/types/services/internal/colorService.d.ts +2 -2
- package/dist/cjs/types/types/config.d.ts +2 -2
- package/dist/cjs/types/types/index.d.ts +1 -0
- package/dist/esm/index.js +13 -4
- package/dist/esm/types/components/layout/DetailsToolbar.d.ts +4 -3
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +2 -1
- package/dist/esm/types/core/themes.d.ts +2 -2
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +2 -2
- package/dist/esm/types/services/internal/colorService.d.ts +2 -2
- package/dist/esm/types/types/config.d.ts +2 -2
- package/dist/esm/types/types/index.d.ts +1 -0
- package/dist/index.d.ts +8 -7
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3113,7 +3113,16 @@ const detailStateClassMap = {
|
|
|
3113
3113
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
3114
3114
|
full: '',
|
|
3115
3115
|
};
|
|
3116
|
-
function DetailsToolbar({
|
|
3116
|
+
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }) {
|
|
3117
|
+
const state = react.useMemo(() => {
|
|
3118
|
+
if (errorMessage)
|
|
3119
|
+
return 'error';
|
|
3120
|
+
if (isLoading)
|
|
3121
|
+
return 'loading';
|
|
3122
|
+
if (isEmpty)
|
|
3123
|
+
return 'empty';
|
|
3124
|
+
return 'full';
|
|
3125
|
+
}, [errorMessage, isLoading, isEmpty]);
|
|
3117
3126
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3118
3127
|
return (jsxRuntime.jsx("aside", { className: cn('tw-h-squid-[50px] tw-flex tw-w-[480px] tw-items-center tw-justify-around tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage }) })] })) }));
|
|
3119
3128
|
}
|
|
@@ -3291,9 +3300,9 @@ function SwapInputsIcon() {
|
|
|
3291
3300
|
return (jsxRuntime.jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_40_7936)", children: jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_40_7936", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
3292
3301
|
}
|
|
3293
3302
|
|
|
3294
|
-
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, }) {
|
|
3303
|
+
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage = 5, }) {
|
|
3295
3304
|
var _a;
|
|
3296
|
-
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) >
|
|
3305
|
+
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
3297
3306
|
? 'tw-text-status-negative'
|
|
3298
3307
|
: 'tw-text-grey-300';
|
|
3299
3308
|
const isInteractive = direction === 'from';
|
|
@@ -3402,7 +3411,7 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3402
3411
|
|
|
3403
3412
|
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3404
3413
|
const parsedStyle = getParsedStyle(theme);
|
|
3405
|
-
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className:
|
|
3414
|
+
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3406
3415
|
}
|
|
3407
3416
|
|
|
3408
3417
|
exports.AddressButton = AddressButton;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BoostMode
|
|
1
|
+
import { BoostMode } from '../../types/components';
|
|
2
2
|
interface DetailsToolbarProps {
|
|
3
|
-
state?: DetailsToolbarState;
|
|
4
3
|
errorMessage?: string;
|
|
5
4
|
boostMode?: BoostMode;
|
|
6
5
|
onToggleBoostMode?: ({ boostMode }: {
|
|
@@ -12,10 +11,12 @@ interface DetailsToolbarProps {
|
|
|
12
11
|
estimatedTime?: string;
|
|
13
12
|
canToggleBoostMode?: boolean;
|
|
14
13
|
boostDisabledMessage?: string;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
isEmpty?: boolean;
|
|
15
16
|
helpButton?: {
|
|
16
17
|
label: string;
|
|
17
18
|
onClick: () => void;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
export declare function DetailsToolbar({
|
|
21
|
+
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -25,6 +25,7 @@ interface SwapConfigurationProps {
|
|
|
25
25
|
error?: {
|
|
26
26
|
message: string;
|
|
27
27
|
};
|
|
28
|
+
criticalPriceImpactPercentage?: number;
|
|
28
29
|
}
|
|
29
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ThemeType } from '../types/components';
|
|
2
|
-
import {
|
|
2
|
+
import { SquidTheme } from '../types/config';
|
|
3
3
|
export type Theme = {
|
|
4
4
|
name: string;
|
|
5
5
|
themeImgPath: string;
|
|
6
6
|
websiteBackgroundColor: string;
|
|
7
|
-
theme:
|
|
7
|
+
theme: SquidTheme;
|
|
8
8
|
type: ThemeType;
|
|
9
9
|
};
|
|
10
10
|
export declare const themes: Theme[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { SquidTheme } from '../types/config';
|
|
3
3
|
import { ThemeType } from '../types/components';
|
|
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;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SquidTheme } from '../../types/config';
|
|
2
2
|
/**
|
|
3
3
|
* Parsing the user readable config to css variables
|
|
4
4
|
* @param style
|
|
5
5
|
*/
|
|
6
|
-
export declare const getParsedStyle: (style?:
|
|
6
|
+
export declare const getParsedStyle: (style?: SquidTheme) => {
|
|
7
7
|
[key: string]: string | undefined;
|
|
8
8
|
} | undefined;
|
|
9
9
|
export declare function getContrastColor({ r, g, b, }: {
|
|
@@ -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 SquidTheme {
|
|
6
6
|
'grey-100': string;
|
|
7
7
|
'grey-200': string;
|
|
8
8
|
'grey-300': string;
|
|
@@ -41,6 +41,6 @@ export declare const SQUID_THEME_CSS_VARIABLE_PREFIX = "--squid-theme-";
|
|
|
41
41
|
/**
|
|
42
42
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
43
43
|
*/
|
|
44
|
-
export declare const themeTypesKeys: Record<keyof
|
|
44
|
+
export declare const themeTypesKeys: Record<keyof SquidTheme, {
|
|
45
45
|
cssVariable: string;
|
|
46
46
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SquidTheme } from './config';
|
package/dist/esm/index.js
CHANGED
|
@@ -3111,7 +3111,16 @@ const detailStateClassMap = {
|
|
|
3111
3111
|
error: 'tw-opacity-33 tw-pointer-events-none',
|
|
3112
3112
|
full: '',
|
|
3113
3113
|
};
|
|
3114
|
-
function DetailsToolbar({
|
|
3114
|
+
function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }) {
|
|
3115
|
+
const state = useMemo(() => {
|
|
3116
|
+
if (errorMessage)
|
|
3117
|
+
return 'error';
|
|
3118
|
+
if (isLoading)
|
|
3119
|
+
return 'loading';
|
|
3120
|
+
if (isEmpty)
|
|
3121
|
+
return 'empty';
|
|
3122
|
+
return 'full';
|
|
3123
|
+
}, [errorMessage, isLoading, isEmpty]);
|
|
3115
3124
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3116
3125
|
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 }) })] })) }));
|
|
3117
3126
|
}
|
|
@@ -3289,9 +3298,9 @@ function SwapInputsIcon() {
|
|
|
3289
3298
|
return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { "clip-path": "url(#clip0_40_7936)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_40_7936", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
3290
3299
|
}
|
|
3291
3300
|
|
|
3292
|
-
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, }) {
|
|
3301
|
+
function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd = '0', balance = '0', isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage = 5, }) {
|
|
3293
3302
|
var _a;
|
|
3294
|
-
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) >
|
|
3303
|
+
const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
|
|
3295
3304
|
? 'tw-text-status-negative'
|
|
3296
3305
|
: 'tw-text-grey-300';
|
|
3297
3306
|
const isInteractive = direction === 'from';
|
|
@@ -3400,7 +3409,7 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3400
3409
|
|
|
3401
3410
|
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3402
3411
|
const parsedStyle = getParsedStyle(theme);
|
|
3403
|
-
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className:
|
|
3412
|
+
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3404
3413
|
}
|
|
3405
3414
|
|
|
3406
3415
|
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, useModal };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BoostMode
|
|
1
|
+
import { BoostMode } from '../../types/components';
|
|
2
2
|
interface DetailsToolbarProps {
|
|
3
|
-
state?: DetailsToolbarState;
|
|
4
3
|
errorMessage?: string;
|
|
5
4
|
boostMode?: BoostMode;
|
|
6
5
|
onToggleBoostMode?: ({ boostMode }: {
|
|
@@ -12,10 +11,12 @@ interface DetailsToolbarProps {
|
|
|
12
11
|
estimatedTime?: string;
|
|
13
12
|
canToggleBoostMode?: boolean;
|
|
14
13
|
boostDisabledMessage?: string;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
isEmpty?: boolean;
|
|
15
16
|
helpButton?: {
|
|
16
17
|
label: string;
|
|
17
18
|
onClick: () => void;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
export declare function DetailsToolbar({
|
|
21
|
+
export declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }: DetailsToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -25,6 +25,7 @@ interface SwapConfigurationProps {
|
|
|
25
25
|
error?: {
|
|
26
26
|
message: string;
|
|
27
27
|
};
|
|
28
|
+
criticalPriceImpactPercentage?: number;
|
|
28
29
|
}
|
|
29
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ThemeType } from '../types/components';
|
|
2
|
-
import {
|
|
2
|
+
import { SquidTheme } from '../types/config';
|
|
3
3
|
export type Theme = {
|
|
4
4
|
name: string;
|
|
5
5
|
themeImgPath: string;
|
|
6
6
|
websiteBackgroundColor: string;
|
|
7
|
-
theme:
|
|
7
|
+
theme: SquidTheme;
|
|
8
8
|
type: ThemeType;
|
|
9
9
|
};
|
|
10
10
|
export declare const themes: Theme[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { SquidTheme } from '../types/config';
|
|
3
3
|
import { ThemeType } from '../types/components';
|
|
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;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SquidTheme } from '../../types/config';
|
|
2
2
|
/**
|
|
3
3
|
* Parsing the user readable config to css variables
|
|
4
4
|
* @param style
|
|
5
5
|
*/
|
|
6
|
-
export declare const getParsedStyle: (style?:
|
|
6
|
+
export declare const getParsedStyle: (style?: SquidTheme) => {
|
|
7
7
|
[key: string]: string | undefined;
|
|
8
8
|
} | undefined;
|
|
9
9
|
export declare function getContrastColor({ r, g, b, }: {
|
|
@@ -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 SquidTheme {
|
|
6
6
|
'grey-100': string;
|
|
7
7
|
'grey-200': string;
|
|
8
8
|
'grey-300': string;
|
|
@@ -41,6 +41,6 @@ export declare const SQUID_THEME_CSS_VARIABLE_PREFIX = "--squid-theme-";
|
|
|
41
41
|
/**
|
|
42
42
|
* Mapping between readable variables name and css variables used TailwindCSS config
|
|
43
43
|
*/
|
|
44
|
-
export declare const themeTypesKeys: Record<keyof
|
|
44
|
+
export declare const themeTypesKeys: Record<keyof SquidTheme, {
|
|
45
45
|
cssVariable: string;
|
|
46
46
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SquidTheme } from './config';
|
package/dist/index.d.ts
CHANGED
|
@@ -56,7 +56,6 @@ type SwapStep = {
|
|
|
56
56
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
57
57
|
chipContent: React.ReactNode;
|
|
58
58
|
};
|
|
59
|
-
type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
60
59
|
type ThemeType = 'light' | 'dark';
|
|
61
60
|
|
|
62
61
|
interface BoostButtonProps {
|
|
@@ -152,7 +151,6 @@ interface BoostProps {
|
|
|
152
151
|
declare function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode, }: BoostProps): react_jsx_runtime.JSX.Element;
|
|
153
152
|
|
|
154
153
|
interface DetailsToolbarProps {
|
|
155
|
-
state?: DetailsToolbarState;
|
|
156
154
|
errorMessage?: string;
|
|
157
155
|
boostMode?: BoostMode;
|
|
158
156
|
onToggleBoostMode?: ({ boostMode }: {
|
|
@@ -164,12 +162,14 @@ interface DetailsToolbarProps {
|
|
|
164
162
|
estimatedTime?: string;
|
|
165
163
|
canToggleBoostMode?: boolean;
|
|
166
164
|
boostDisabledMessage?: string;
|
|
165
|
+
isLoading?: boolean;
|
|
166
|
+
isEmpty?: boolean;
|
|
167
167
|
helpButton?: {
|
|
168
168
|
label: string;
|
|
169
169
|
onClick: () => void;
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
declare function DetailsToolbar({
|
|
172
|
+
declare function DetailsToolbar({ errorMessage, boostMode, onToggleBoostMode, onInvertSwapButtonClick, onFeeButtonClick, feeInUsd, estimatedTime, canToggleBoostMode, boostDisabledMessage, helpButton, isLoading, isEmpty, }: DetailsToolbarProps): react_jsx_runtime.JSX.Element;
|
|
173
173
|
|
|
174
174
|
interface DropdownMenuItemProps {
|
|
175
175
|
label: string;
|
|
@@ -323,8 +323,9 @@ interface SwapConfigurationProps {
|
|
|
323
323
|
error?: {
|
|
324
324
|
message: string;
|
|
325
325
|
};
|
|
326
|
+
criticalPriceImpactPercentage?: number;
|
|
326
327
|
}
|
|
327
|
-
declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
328
|
+
declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
|
|
328
329
|
|
|
329
330
|
interface SwapProgressViewHeaderProps {
|
|
330
331
|
title: string;
|
|
@@ -368,7 +369,7 @@ interface HeadingTextProps {
|
|
|
368
369
|
}
|
|
369
370
|
declare function HeadingText({ children, bold, size }: HeadingTextProps): react_jsx_runtime.JSX.Element;
|
|
370
371
|
|
|
371
|
-
interface
|
|
372
|
+
interface SquidTheme {
|
|
372
373
|
'grey-100': string;
|
|
373
374
|
'grey-200': string;
|
|
374
375
|
'grey-300': string;
|
|
@@ -405,7 +406,7 @@ interface ConfigTheme {
|
|
|
405
406
|
}
|
|
406
407
|
|
|
407
408
|
declare function SquidConfigProvider({ theme, children, themeType, }: {
|
|
408
|
-
theme:
|
|
409
|
+
theme: SquidTheme;
|
|
409
410
|
children?: React.ReactNode;
|
|
410
411
|
themeType?: ThemeType;
|
|
411
412
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -420,4 +421,4 @@ declare function useModal(props?: {
|
|
|
420
421
|
openModalButtonRef: React.RefObject<HTMLButtonElement>;
|
|
421
422
|
};
|
|
422
423
|
|
|
423
|
-
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, SectionTitle, SettingsButton, type SettingsButtonProps, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, type TooltipThreshold, type TooltipWidth, UsdAmount, useModal };
|
|
424
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, SectionTitle, SettingsButton, type SettingsButtonProps, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, type TooltipThreshold, type TooltipWidth, UsdAmount, useModal };
|