@0xsquid/ui 0.13.11 → 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 {};
@@ -1,5 +1,6 @@
1
- export declare function EmojiSadIcon({ className }: {
1
+ export declare function EmojiSadIcon({ className, size, }: {
2
2
  className?: string;
3
+ size?: string;
3
4
  }): import("react/jsx-runtime").JSX.Element;
4
5
  export declare function EmojiMeh({ className, size, }: {
5
6
  className?: string;
@@ -1,6 +1,7 @@
1
1
  interface LoaderProps {
2
2
  size?: string;
3
3
  strokeWidth?: string;
4
+ invertColors?: boolean;
4
5
  }
5
- export declare function Loader({ size, strokeWidth }: LoaderProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Loader({ size, strokeWidth, invertColors, }: LoaderProps): import("react/jsx-runtime").JSX.Element;
6
7
  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 {};
@@ -1,11 +1,9 @@
1
- /// <reference types="react" />
2
1
  import { SwapStepDescriptionBlock, SwapStepItemStatus } from '../../types/components';
3
2
  interface SwapStepItemProps {
4
3
  descriptionBlocks: SwapStepDescriptionBlock[];
5
- chipContent: React.ReactNode;
6
4
  showStepSeparator?: boolean;
7
5
  link?: string;
8
6
  status?: SwapStepItemStatus;
9
7
  }
10
- export declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, link, status, }: SwapStepItemProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function SwapStepItem({ descriptionBlocks, showStepSeparator, link, status, }: SwapStepItemProps): import("react/jsx-runtime").JSX.Element;
11
9
  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;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Loader } from '../../components/icons/Loader';
3
+ declare const meta: Meta<typeof Loader>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Normal: Story;
7
+ export declare const StrokeThin: Story;
8
+ export declare const StrokeThick: Story;
9
+ export declare const InvertColors: Story;
@@ -8,3 +8,5 @@ export declare const MiddleStep: Story;
8
8
  export declare const LastStep: Story;
9
9
  export declare const ShortRoute: Story;
10
10
  export declare const LongRoute: Story;
11
+ export declare const Error: Story;
12
+ export declare const Warning: Story;
@@ -4,10 +4,21 @@ declare const meta: Meta<typeof SwapStepItem>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Executed: Story;
7
+ export declare const ExecutedWithSeparator: Story;
8
+ export declare const Success: Story;
9
+ export declare const SuccessWithSeparator: Story;
7
10
  export declare const Pending: Story;
8
- export declare const Progress: Story;
11
+ export declare const PendingWithSeparator: Story;
12
+ export declare const Ongoing: Story;
13
+ export declare const OngoingWithSeparator: Story;
14
+ export declare const Waiting: Story;
15
+ export declare const WaitingWithSeparator: Story;
16
+ export declare const Error: Story;
17
+ export declare const ErrorWithSeparator: Story;
18
+ export declare const Warning: Story;
19
+ export declare const WarningWithSeparator: Story;
9
20
  export declare const CustomDescription: Story;
10
- export declare const ShowSeparator: Story;
21
+ export declare const CustomDescriptionWithSeparator: Story;
11
22
  export declare const Link: Story;
12
23
  export declare const LongDescription: Story;
13
24
  export declare const LongDescriptionWithSeparator: Story;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type TextSize = 'small' | 'medium' | 'large';
3
2
  export type SwitchSize = 'small' | 'large';
4
3
  export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
@@ -11,9 +10,8 @@ export type SwapStepDescriptionBlock = {
11
10
  };
12
11
  export type SwapStep = {
13
12
  descriptionBlocks: SwapStepDescriptionBlock[];
14
- chipContent: React.ReactNode;
15
13
  link?: string;
16
- status: SwapState;
14
+ status: SwapStepItemStatus;
17
15
  };
18
16
  export declare enum SwapState {
19
17
  CONFIRM = 0,
@@ -27,4 +25,5 @@ export declare enum SwapState {
27
25
  }
28
26
  export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
29
27
  export type ThemeType = 'light' | 'dark';
30
- export type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
28
+ export type SwapStepItemStatus = 'pending' | 'waiting' | 'ongoing' | 'executed' | 'success' | 'error' | 'warning';
29
+ export type InputMode = 'token' | 'price';