@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.
@@ -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, swapAmountUsd, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
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';
package/dist/index.css CHANGED
@@ -677,6 +677,10 @@ video {
677
677
  left: 2px;
678
678
  }
679
679
 
680
+ .tw-left-\[30px\] {
681
+ left: 30px;
682
+ }
683
+
680
684
  .tw-left-\[54px\] {
681
685
  left: 54px;
682
686
  }
@@ -733,6 +737,10 @@ video {
733
737
  top: 1.75rem;
734
738
  }
735
739
 
740
+ .tw-top-\[11px\] {
741
+ top: 11px;
742
+ }
743
+
736
744
  .tw-top-\[52px\] {
737
745
  top: 52px;
738
746
  }
@@ -872,6 +880,10 @@ video {
872
880
  height: 2rem;
873
881
  }
874
882
 
883
+ .tw-h-\[100vh\] {
884
+ height: 100vh;
885
+ }
886
+
875
887
  .tw-h-\[10px\] {
876
888
  height: 10px;
877
889
  }
@@ -1113,6 +1125,10 @@ video {
1113
1125
  width: 1.5px;
1114
1126
  }
1115
1127
 
1128
+ .tw-w-\[100vw\] {
1129
+ width: 100vw;
1130
+ }
1131
+
1116
1132
  .tw-w-\[1260px\] {
1117
1133
  width: 1260px;
1118
1134
  }
@@ -2152,6 +2168,10 @@ video {
2152
2168
  padding-left: 20px;
2153
2169
  }
2154
2170
 
2171
+ .tw-pl-\[33px\] {
2172
+ padding-left: 33px;
2173
+ }
2174
+
2155
2175
  .tw-pl-\[44px\] {
2156
2176
  padding-left: 44px;
2157
2177
  }
@@ -2343,6 +2363,10 @@ video {
2343
2363
  line-height: 13px;
2344
2364
  }
2345
2365
 
2366
+ .tw-leading-\[43px\] {
2367
+ line-height: 43px;
2368
+ }
2369
+
2346
2370
  .tw-leading-body-large {
2347
2371
  line-height: 39.34px;
2348
2372
  }
package/dist/index.d.ts CHANGED
@@ -74,6 +74,7 @@ declare enum SwapState {
74
74
  }
75
75
  type ThemeType = 'light' | 'dark';
76
76
  type SwapStepItemStatus = 'pending' | 'waiting' | 'ongoing' | 'executed' | 'success' | 'error' | 'warning';
77
+ type InputMode = 'token' | 'price';
77
78
 
78
79
  interface BoostButtonProps {
79
80
  boostMode: BoostMode;
@@ -131,8 +132,9 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
131
132
  maxDecimals?: number;
132
133
  balance?: string;
133
134
  tokenPrice?: number;
135
+ numericInputMode?: InputMode;
134
136
  }
135
- declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, ...props }: Props) => react_jsx_runtime.JSX.Element;
137
+ declare const NumericInput: ({ onParsedValueChanged, initialValue, forcedUpdateValue, maxDecimals, balance, tokenPrice, numericInputMode, ...props }: Props) => react_jsx_runtime.JSX.Element;
136
138
 
137
139
  interface SettingsSliderProps {
138
140
  value: number;
@@ -405,7 +407,6 @@ interface SwapConfigurationProps {
405
407
  priceImpactPercentage?: string;
406
408
  amount?: string;
407
409
  forcedAmount?: string;
408
- swapAmountUsd?: string;
409
410
  tokenPrice?: number;
410
411
  balance?: string;
411
412
  isFetching?: boolean;
@@ -430,9 +431,8 @@ interface SwapConfigurationProps {
430
431
  };
431
432
  criticalPriceImpactPercentage?: number;
432
433
  emptyAddressLabel?: string;
433
- onSwapAmountButtonClick?: () => void;
434
434
  }
435
- declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount, swapAmountUsd, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, onSwapAmountButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
435
+ declare function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount: _forcedAmount, balance, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage, emptyAddressLabel, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
436
436
 
437
437
  interface SwapProgressViewHeaderProps {
438
438
  title: string;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/0xsquid/squid-ui.git"
6
6
  },
7
7
  "description": "Squid's UI components",
8
- "version": "0.14.0",
8
+ "version": "0.15.0",
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "resolutions": {
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@lottiefiles/react-lottie-player": "3.5.0",
31
+ "bignumber.js": "9.1.2",
31
32
  "clsx": "2.1.0",
32
33
  "color": "4.2.3",
33
34
  "tailwind-merge": "2.3.0"