@0xsquid/ui 0.14.0 → 0.15.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 +3024 -43
- package/dist/cjs/types/components/controls/NumericInput.d.ts +3 -1
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +1 -3
- package/dist/cjs/types/core/numbers.d.ts +22 -0
- package/dist/cjs/types/types/components.d.ts +1 -0
- package/dist/esm/index.js +3024 -43
- package/dist/esm/types/components/controls/NumericInput.d.ts +3 -1
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +1 -3
- package/dist/esm/types/core/numbers.d.ts +22 -0
- package/dist/esm/types/types/components.d.ts +1 -0
- package/dist/index.css +24 -0
- package/dist/index.d.ts +4 -4
- package/package.json +2 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { InputMode } from '../../types/components';
|
|
2
3
|
interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
4
|
onParsedValueChanged: (value: string) => void;
|
|
4
5
|
initialValue?: string;
|
|
@@ -6,6 +7,7 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
6
7
|
maxDecimals?: number;
|
|
7
8
|
balance?: string;
|
|
8
9
|
tokenPrice?: number;
|
|
10
|
+
numericInputMode?: InputMode;
|
|
9
11
|
}
|
|
10
|
-
export declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, numericInputMode, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -4,7 +4,6 @@ interface SwapConfigurationProps {
|
|
|
4
4
|
priceImpactPercentage?: string;
|
|
5
5
|
amount?: string;
|
|
6
6
|
forcedAmount?: string;
|
|
7
|
-
swapAmountUsd?: string;
|
|
8
7
|
tokenPrice?: number;
|
|
9
8
|
balance?: string;
|
|
10
9
|
isFetching?: boolean;
|
|
@@ -29,7 +28,6 @@ interface SwapConfigurationProps {
|
|
|
29
28
|
};
|
|
30
29
|
criticalPriceImpactPercentage?: number;
|
|
31
30
|
emptyAddressLabel?: string;
|
|
32
|
-
onSwapAmountButtonClick?: () => void;
|
|
33
31
|
}
|
|
34
|
-
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount
|
|
32
|
+
export declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount: _forcedAmount, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
35
33
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert token amount to USD
|
|
3
|
+
* @param {string|number} tokenAmount - The amount of tokens
|
|
4
|
+
* @param {string|number} tokenPrice - The price of one token in USD
|
|
5
|
+
* @returns {BigNumber} - The equivalent amount in USD
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertTokenAmountToUSD(tokenAmount: string | number, tokenPrice: string | number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Convert USD to token amount
|
|
10
|
+
* @param {string|number} usdAmount - The amount in USD
|
|
11
|
+
* @param {string|number} tokenPrice - The price of one token in USD
|
|
12
|
+
* @returns {BigNumber} - The equivalent amount of tokens
|
|
13
|
+
*/
|
|
14
|
+
export declare function convertUSDToTokenAmount(usdAmount: string | number, tokenPrice: string | number): string;
|
|
15
|
+
/**
|
|
16
|
+
* Formats a number to USD
|
|
17
|
+
*
|
|
18
|
+
* @param amount - The amount to format
|
|
19
|
+
* @returns The formatted currency string
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatUSD(amount: number | bigint | string): string;
|
|
22
|
+
export declare function trimExtraDecimals(value: string, maxDecimals: number): string;
|
|
@@ -26,3 +26,4 @@ export declare enum SwapState {
|
|
|
26
26
|
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
27
27
|
export type ThemeType = 'light' | 'dark';
|
|
28
28
|
export type SwapStepItemStatus = 'pending' | 'waiting' | 'ongoing' | 'executed' | 'success' | 'error' | 'warning';
|
|
29
|
+
export type InputMode = 'token' | 'price';
|