@0xsquid/ui 2.6.4 → 2.6.5-animate-number-beta.1
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 +18268 -18037
- package/dist/cjs/types/components/badges/PriceChange.d.ts +3 -1
- package/dist/cjs/types/components/badges/index.d.ts +1 -1
- package/dist/cjs/types/components/buttons/Button.d.ts +2 -1
- package/dist/cjs/types/components/buttons/Chip.d.ts +1 -1
- package/dist/cjs/types/components/controls/LargeNumericInput.d.ts +2 -0
- package/dist/cjs/types/components/controls/NumericInput.d.ts +22 -13
- package/dist/cjs/types/components/controls/index.d.ts +2 -1
- package/dist/cjs/types/components/feedback/AnimateNumber.d.ts +8 -0
- package/dist/cjs/types/components/feedback/LoadingText.d.ts +7 -0
- package/dist/cjs/types/components/feedback/index.d.ts +3 -0
- package/dist/cjs/types/components/icons/Loader.d.ts +1 -1
- package/dist/cjs/types/components/icons/PaymentIcons.d.ts +12 -0
- package/dist/cjs/types/components/icons/SwapInputs.d.ts +4 -1
- package/dist/cjs/types/components/icons/index.d.ts +1 -0
- package/dist/cjs/types/components/index.d.ts +1 -0
- package/dist/cjs/types/components/layout/AnimationWrapper.d.ts +3 -0
- package/dist/cjs/types/components/layout/AppContainer.d.ts +3 -523
- package/dist/cjs/types/components/layout/ModalTitle.d.ts +5 -0
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +17 -1
- package/dist/cjs/types/components/layout/index.d.ts +1 -0
- package/dist/cjs/types/components/lists/HistoryItem.d.ts +2 -1
- package/dist/cjs/types/components/navigation/Tabs.d.ts +5 -2
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +2 -1
- package/dist/cjs/types/core/design-system.d.ts +1 -0
- package/dist/cjs/types/core/index.d.ts +1 -1
- package/dist/cjs/types/core/utils.d.ts +16 -0
- package/dist/cjs/types/hooks/index.d.ts +3 -2
- package/dist/cjs/types/hooks/useMeasure.d.ts +36 -0
- package/dist/cjs/types/hooks/useNumericInput.d.ts +35 -0
- package/dist/cjs/types/services/internal/colorService.d.ts +0 -2
- package/dist/cjs/types/stories/buttons/Button.stories.d.ts +3 -0
- package/dist/cjs/types/stories/buttons/Chip.stories.d.ts +2 -1
- package/dist/cjs/types/stories/controls/Input.stories.d.ts +1 -1
- package/dist/cjs/types/stories/controls/LargeNumericInput.stories.d.ts +6 -0
- package/dist/cjs/types/stories/controls/NumericInput.stories.d.ts +17 -0
- package/dist/cjs/types/stories/feedback/AnimateNumber.stories.d.ts +6 -0
- package/dist/{esm/types/stories/badges → cjs/types/stories/feedback}/Loader.stories.d.ts +1 -1
- package/dist/cjs/types/stories/{badges → feedback}/LoadingSkeleton.stories.d.ts +2 -2
- package/dist/cjs/types/stories/feedback/LoadingText.stories.d.ts +6 -0
- package/dist/cjs/types/stories/layout/SwapConfiguration.stories.d.ts +2 -0
- package/dist/cjs/types/stories/navigation/Tabs.stories.d.ts +1 -0
- package/dist/cjs/types/stories/views/SwapProgressView.stories.d.ts +1 -0
- package/dist/esm/index.js +18236 -18015
- package/dist/esm/types/components/badges/PriceChange.d.ts +3 -1
- package/dist/esm/types/components/badges/index.d.ts +1 -1
- package/dist/esm/types/components/buttons/Button.d.ts +2 -1
- package/dist/esm/types/components/buttons/Chip.d.ts +1 -1
- package/dist/esm/types/components/controls/LargeNumericInput.d.ts +2 -0
- package/dist/esm/types/components/controls/NumericInput.d.ts +22 -13
- package/dist/esm/types/components/controls/index.d.ts +2 -1
- package/dist/esm/types/components/feedback/AnimateNumber.d.ts +8 -0
- package/dist/esm/types/components/feedback/LoadingText.d.ts +7 -0
- package/dist/esm/types/components/feedback/index.d.ts +3 -0
- package/dist/esm/types/components/icons/Loader.d.ts +1 -1
- package/dist/esm/types/components/icons/PaymentIcons.d.ts +12 -0
- package/dist/esm/types/components/icons/SwapInputs.d.ts +4 -1
- package/dist/esm/types/components/icons/index.d.ts +1 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/esm/types/components/layout/AnimationWrapper.d.ts +3 -0
- package/dist/esm/types/components/layout/AppContainer.d.ts +3 -523
- package/dist/esm/types/components/layout/ModalTitle.d.ts +5 -0
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +17 -1
- package/dist/esm/types/components/layout/index.d.ts +1 -0
- package/dist/esm/types/components/lists/HistoryItem.d.ts +2 -1
- package/dist/esm/types/components/navigation/Tabs.d.ts +5 -2
- package/dist/esm/types/components/views/SwapProgressView.d.ts +2 -1
- package/dist/esm/types/core/design-system.d.ts +1 -0
- package/dist/esm/types/core/index.d.ts +1 -1
- package/dist/esm/types/core/utils.d.ts +16 -0
- package/dist/esm/types/hooks/index.d.ts +3 -2
- package/dist/esm/types/hooks/useMeasure.d.ts +36 -0
- package/dist/esm/types/hooks/useNumericInput.d.ts +35 -0
- package/dist/esm/types/services/internal/colorService.d.ts +0 -2
- package/dist/esm/types/stories/buttons/Button.stories.d.ts +3 -0
- package/dist/esm/types/stories/buttons/Chip.stories.d.ts +2 -1
- package/dist/esm/types/stories/controls/Input.stories.d.ts +1 -1
- package/dist/esm/types/stories/controls/LargeNumericInput.stories.d.ts +6 -0
- package/dist/esm/types/stories/controls/NumericInput.stories.d.ts +17 -0
- package/dist/esm/types/stories/feedback/AnimateNumber.stories.d.ts +6 -0
- package/dist/{cjs/types/stories/badges → esm/types/stories/feedback}/Loader.stories.d.ts +1 -1
- package/dist/esm/types/stories/{badges → feedback}/LoadingSkeleton.stories.d.ts +2 -2
- package/dist/esm/types/stories/feedback/LoadingText.stories.d.ts +6 -0
- package/dist/esm/types/stories/layout/SwapConfiguration.stories.d.ts +2 -0
- package/dist/esm/types/stories/navigation/Tabs.stories.d.ts +1 -0
- package/dist/esm/types/stories/views/SwapProgressView.stories.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +154 -568
- package/package.json +2 -1
- /package/dist/cjs/types/components/{badges → feedback}/LoadingSkeleton.d.ts +0 -0
- /package/dist/esm/types/components/{badges → feedback}/LoadingSkeleton.d.ts +0 -0
|
@@ -10,7 +10,7 @@ interface Token {
|
|
|
10
10
|
logoUrl: string;
|
|
11
11
|
bgColor: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, addGasLink, shareSwapDropdownContent, }: {
|
|
13
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, addGasLink, shareSwapDropdownContent, isSendTransaction, }: {
|
|
14
14
|
steps: SwapStep[];
|
|
15
15
|
handleClose?: (swapState: SwapState) => void;
|
|
16
16
|
handleComplete?: () => void;
|
|
@@ -30,5 +30,6 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, handleCom
|
|
|
30
30
|
footerButton?: SwapStepsCollapsedFooterButton;
|
|
31
31
|
refundTokenSymbol?: string;
|
|
32
32
|
addGasLink?: string;
|
|
33
|
+
isSendTransaction?: boolean;
|
|
33
34
|
}): import("react/jsx-runtime").JSX.Element;
|
|
34
35
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { MEDIA_QUERIES, CSS_VARS, ANIMATION_DURATIONS } from "./constants";
|
|
2
2
|
export { darkTheme, lightTheme } from "./themes";
|
|
3
3
|
export { baseTailwindConfig, spacing } from "./design-system";
|
|
4
|
-
export { cn } from "./utils";
|
|
4
|
+
export { cn, pxToRem, remToPx } from "./utils";
|
|
@@ -72,4 +72,20 @@ export declare function mapToCssVariables<T extends Record<string, any>>(obj: T)
|
|
|
72
72
|
* @returns {number} - The index within the array.
|
|
73
73
|
*/
|
|
74
74
|
export declare function hashStringToIndex(str: string, max: number): number;
|
|
75
|
+
/**
|
|
76
|
+
* Formats a value for CSS properties by adding 'px' if no unit is present.
|
|
77
|
+
* @param {string | number} value - The value to format (can be a number or string)
|
|
78
|
+
* @returns {string} - The formatted CSS value with appropriate units
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Returns "20px"
|
|
82
|
+
* formatCSSValue(20)
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* // Returns "5rem"
|
|
86
|
+
* formatCSSValue("5rem")
|
|
87
|
+
*/
|
|
88
|
+
export declare function formatCSSValue(value: string | number): string;
|
|
89
|
+
export declare const remToPx: (rem: string | number, baseFontSize?: number) => number;
|
|
90
|
+
export declare const pxToRem: (px: string | number, baseFontSize?: number) => number;
|
|
75
91
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * from "./useCollapsibleMenu";
|
|
1
2
|
export * from "./useDropdownMenu";
|
|
2
3
|
export * from "./useMediaQuery";
|
|
3
|
-
export * from "./
|
|
4
|
+
export * from "./useNumericInput";
|
|
4
5
|
export * from "./useRect";
|
|
5
|
-
export * from "./useVersion";
|
|
6
6
|
export * from "./useTimer";
|
|
7
7
|
export * from "./useUserTheme";
|
|
8
|
+
export * from "./useVersion";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare type ResizeObserverCallback = (entries: any[], observer: ResizeObserver) => void;
|
|
2
|
+
declare class ResizeObserver {
|
|
3
|
+
constructor(callback: ResizeObserverCallback);
|
|
4
|
+
observe(target: Element, options?: any): void;
|
|
5
|
+
unobserve(target: Element): void;
|
|
6
|
+
disconnect(): void;
|
|
7
|
+
static toString(): string;
|
|
8
|
+
}
|
|
9
|
+
export interface RectReadOnly {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly width: number;
|
|
13
|
+
readonly height: number;
|
|
14
|
+
readonly top: number;
|
|
15
|
+
readonly right: number;
|
|
16
|
+
readonly bottom: number;
|
|
17
|
+
readonly left: number;
|
|
18
|
+
[key: string]: number;
|
|
19
|
+
}
|
|
20
|
+
type HTMLOrSVGElement = HTMLElement | SVGElement;
|
|
21
|
+
type Result = [
|
|
22
|
+
(element: HTMLOrSVGElement | null) => void,
|
|
23
|
+
RectReadOnly,
|
|
24
|
+
() => void
|
|
25
|
+
];
|
|
26
|
+
export interface Options {
|
|
27
|
+
debounce?: number | {
|
|
28
|
+
scroll: number;
|
|
29
|
+
resize: number;
|
|
30
|
+
};
|
|
31
|
+
scroll?: boolean;
|
|
32
|
+
polyfill?: new (cb: ResizeObserverCallback) => ResizeObserver;
|
|
33
|
+
offsetSize?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare function useMeasure({ debounce, scroll, polyfill, offsetSize }?: Options): Result;
|
|
36
|
+
export default useMeasure;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ChangeEvent } from "react";
|
|
2
|
+
import { type Token } from "../components/controls/NumericInput";
|
|
3
|
+
export declare enum UserInputType {
|
|
4
|
+
TOKEN = 0,
|
|
5
|
+
USD = 1
|
|
6
|
+
}
|
|
7
|
+
interface UseNumericInputOptions {
|
|
8
|
+
token: Pick<Token, "decimals" | "price">;
|
|
9
|
+
onAmountChange: (tokenAmount: string) => void;
|
|
10
|
+
forcedAmount?: string;
|
|
11
|
+
formatIfVerySmall: {
|
|
12
|
+
token: string;
|
|
13
|
+
usd: string;
|
|
14
|
+
};
|
|
15
|
+
balance: string;
|
|
16
|
+
inputModeButton?: {
|
|
17
|
+
amountUsd?: string;
|
|
18
|
+
};
|
|
19
|
+
maxUsdDecimals?: number;
|
|
20
|
+
debounceInput?: boolean;
|
|
21
|
+
direction?: "from" | "to";
|
|
22
|
+
initialInputMode?: UserInputType;
|
|
23
|
+
}
|
|
24
|
+
export declare function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, direction, initialInputMode, }: UseNumericInputOptions): {
|
|
25
|
+
userInputType: UserInputType;
|
|
26
|
+
inputValue: string;
|
|
27
|
+
handleInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
28
|
+
handleSwitchInputMode: () => void;
|
|
29
|
+
isTokenAmountVerySmall: boolean;
|
|
30
|
+
isUsdAmountVerySmall: boolean;
|
|
31
|
+
amountFormatted: string;
|
|
32
|
+
onBalanceButtonClick: () => void;
|
|
33
|
+
balanceFormatted: string;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -12,8 +12,6 @@ interface RGB {
|
|
|
12
12
|
* @param style
|
|
13
13
|
*/
|
|
14
14
|
export declare const parseSquidTheme: (userTheme: Theme, themeType: ThemeType) => Record<string, string | undefined> | undefined;
|
|
15
|
-
export declare const remToPx: (rem: string | number, baseFontSize?: number) => number;
|
|
16
|
-
export declare const pxToRem: (px: string | number, baseFontSize?: number) => number;
|
|
17
15
|
export declare function getContrastColor({ r, g, b, }: {
|
|
18
16
|
r: number;
|
|
19
17
|
g: number;
|
|
@@ -44,6 +44,9 @@ export declare const LargeWithLabelLoading: Story;
|
|
|
44
44
|
export declare const SmallWithLongLabelLoading: Story;
|
|
45
45
|
export declare const MediumWithLongLabelLoading: Story;
|
|
46
46
|
export declare const LargeWithLongLabelLoading: Story;
|
|
47
|
+
export declare const SmallWithLongLabelShimmer: Story;
|
|
48
|
+
export declare const MediumWithLongLabelShimmer: Story;
|
|
49
|
+
export declare const LargeWithLongLabelShimmer: Story;
|
|
47
50
|
export declare const SmallWithChip: Story;
|
|
48
51
|
export declare const MediumWithChip: Story;
|
|
49
52
|
export declare const LargeWithChip: Story;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
1
|
+
import { type Meta, type StoryObj } from "@storybook/react";
|
|
2
2
|
import { Chip } from "../../components/buttons/Chip";
|
|
3
3
|
declare const meta: Meta<typeof Chip>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Text: Story;
|
|
7
7
|
export declare const Icon: Story;
|
|
8
|
+
export declare const Interactive: Story;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from "@storybook/react";
|
|
2
|
+
import { LargeNumericInput } from "../../components/controls/LargeNumericInput";
|
|
3
|
+
declare const meta: Meta<typeof LargeNumericInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from "@storybook/react";
|
|
2
|
+
import { NumericInput } from "../../components/controls/NumericInput";
|
|
3
|
+
declare const meta: Meta<typeof NumericInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const FiatOnRampStyle: Story;
|
|
8
|
+
export declare const FiatOnRampStyleLoading: Story;
|
|
9
|
+
export declare const CustomSymbol: Story;
|
|
10
|
+
export declare const MinimalVersion: Story;
|
|
11
|
+
export declare const MinimalVersionWithCustomSymbol: Story;
|
|
12
|
+
export declare const MinimalVersionWithBigSymbol: Story;
|
|
13
|
+
export declare const WithError: Story;
|
|
14
|
+
export declare const WithPriceImpact: Story;
|
|
15
|
+
export declare const WithTooltips: Story;
|
|
16
|
+
export declare const Loading: Story;
|
|
17
|
+
export declare const NonInteractive: Story;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from "@storybook/react";
|
|
2
|
+
import { AnimateNumber } from "../../components/feedback/AnimateNumber";
|
|
3
|
+
declare const meta: Meta<typeof AnimateNumber>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { LoadingSkeleton } from "../../components/
|
|
1
|
+
import { type Meta, type StoryObj } from "@storybook/react";
|
|
2
|
+
import { LoadingSkeleton } from "../../components/feedback/LoadingSkeleton";
|
|
3
3
|
declare const meta: Meta<typeof LoadingSkeleton>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from "@storybook/react";
|
|
2
|
+
import { LoadingText } from "../../components/feedback/LoadingText";
|
|
3
|
+
declare const meta: Meta<typeof LoadingText>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -4,7 +4,9 @@ declare const meta: Meta<typeof SwapConfiguration>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const EmptyVariantPrimary: Story;
|
|
7
|
+
export declare const EmptyVariantPrimaryLoading: Story;
|
|
7
8
|
export declare const EmptyVariantWithoutNumericInputDetails: Story;
|
|
9
|
+
export declare const WithoutNumericInputDetailsLoading: Story;
|
|
8
10
|
export declare const EmptyVariantAccent: Story;
|
|
9
11
|
export declare const Loading: Story;
|
|
10
12
|
export declare const LoadingWithAllProps: Story;
|