@0xsquid/ui 2.6.8-send-beta.0 → 2.6.8
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 +272 -88
- 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/controls/NumericInput.d.ts +8 -1
- package/dist/cjs/types/components/feedback/LoadingText.d.ts +7 -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/index.d.ts +1 -0
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +17 -1
- 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/useNumericInput.d.ts +2 -1
- 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/controls/NumericInput.stories.d.ts +17 -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/esm/index.js +250 -71
- 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/controls/NumericInput.d.ts +8 -1
- package/dist/esm/types/components/feedback/LoadingText.d.ts +7 -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/index.d.ts +1 -0
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +17 -1
- 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/useNumericInput.d.ts +2 -1
- 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/controls/NumericInput.stories.d.ts +17 -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/index.css +1 -1
- package/dist/index.d.ts +87 -16
- package/package.json +1 -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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface PriceChangeProps {
|
|
2
2
|
variant?: "small" | "large";
|
|
3
3
|
value: string | number;
|
|
4
|
+
highlightText?: boolean;
|
|
5
|
+
triangle?: "none" | "prefix" | "suffix";
|
|
4
6
|
}
|
|
5
|
-
export declare function PriceChange({ value: rawValue, variant, }: PriceChangeProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function PriceChange({ value: rawValue, variant, highlightText, triangle, }: PriceChangeProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -2,7 +2,7 @@ export * from "./BadgeImage";
|
|
|
2
2
|
export * from "./IconLabel";
|
|
3
3
|
export * from "./Image";
|
|
4
4
|
export * from "./ImageGroup";
|
|
5
|
-
export * from "
|
|
5
|
+
export * from "../feedback/LoadingSkeleton";
|
|
6
6
|
export * from "./PriceChange";
|
|
7
7
|
export * from "./TransactionState";
|
|
8
8
|
export * from "./UsdAmount";
|
|
@@ -9,6 +9,7 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
link?: string;
|
|
11
11
|
isLoading?: boolean;
|
|
12
|
+
isShimmering?: boolean;
|
|
12
13
|
showLoader?: boolean;
|
|
13
14
|
loaderSize?: LoaderSize;
|
|
14
15
|
chip?: ChipProps;
|
|
@@ -18,5 +19,5 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
18
19
|
}
|
|
19
20
|
type LoaderSize = "sm" | "md" | "lg";
|
|
20
21
|
export declare const buttonRoundedClassMap: Record<ButtonSize, Record<ButtonVariant, string>>;
|
|
21
|
-
export declare function Button({ label, disabled, size, variant, icon, link, isLoading, showLoader, loaderSize, chip, containerClassName, anchorRef, buttonRef, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function Button({ label, disabled, size, variant, icon, link, isLoading, isShimmering, showLoader, loaderSize, chip, containerClassName, anchorRef, buttonRef, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { UserInputType } from "../../hooks/useNumericInput";
|
|
2
3
|
import { type SwapDirection } from "../../types/components";
|
|
3
4
|
import { type TooltipProps } from "./Tooltip";
|
|
4
5
|
export interface Token {
|
|
@@ -26,6 +27,12 @@ export interface NumericInputProps {
|
|
|
26
27
|
hideMaxChip?: boolean;
|
|
27
28
|
};
|
|
28
29
|
debounceInput?: boolean;
|
|
30
|
+
initialInputMode?: UserInputType;
|
|
31
|
+
customSymbol?: string;
|
|
32
|
+
hideControls?: boolean;
|
|
33
|
+
hideBalance?: boolean;
|
|
34
|
+
containerClassName?: string;
|
|
35
|
+
inputClassName?: string;
|
|
29
36
|
}
|
|
30
37
|
export interface Props extends NumericInputProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
31
38
|
direction?: SwapDirection;
|
|
@@ -38,4 +45,4 @@ export interface Props extends NumericInputProps, React.InputHTMLAttributes<HTML
|
|
|
38
45
|
message: string;
|
|
39
46
|
};
|
|
40
47
|
}
|
|
41
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, debounceInput, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, debounceInput, initialInputMode, customSymbol, hideControls, hideBalance, containerClassName, inputClassName, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ButtonVariant } from "../../types/components";
|
|
3
|
+
interface LoadingTextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
}
|
|
6
|
+
export declare function LoadingText({ children, className, ...props }: LoadingTextProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function GooglePayIcon({ className, size, }: {
|
|
2
|
+
className?: string;
|
|
3
|
+
size?: string;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function ApplePayIcon({ className, size, }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function CreditCardIcon({ className, size, }: {
|
|
10
|
+
className?: string;
|
|
11
|
+
size?: string;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { type AssetsButtonVariant, type SwapDirection } from "../../types/components";
|
|
2
2
|
import { type TooltipProps } from "../controls";
|
|
3
|
+
interface AddressHeaderProps {
|
|
4
|
+
direction: SwapDirection;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
tooltip?: TooltipProps["tooltipContent"];
|
|
8
|
+
label: string;
|
|
9
|
+
walletIconUrl?: string | null;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
displayLabel?: boolean;
|
|
12
|
+
highlightLabel?: boolean;
|
|
13
|
+
showIcon?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const AddressHeader: ({ direction, onClick, isDisabled, tooltip, label, walletIconUrl, isLoading, displayLabel, highlightLabel, showIcon, }: AddressHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
16
|
interface SwapConfigurationProps {
|
|
4
17
|
direction: SwapDirection;
|
|
5
18
|
priceImpactPercentage?: string;
|
|
@@ -46,10 +59,13 @@ interface SwapConfigurationProps {
|
|
|
46
59
|
address?: string;
|
|
47
60
|
emptyAddressLabel?: string;
|
|
48
61
|
disabled?: boolean;
|
|
62
|
+
walletIconUrl?: string | null;
|
|
63
|
+
showIcon?: boolean;
|
|
49
64
|
};
|
|
50
65
|
showNumericInputDetails?: boolean;
|
|
51
66
|
fullHeight?: boolean;
|
|
52
67
|
debounceInput?: boolean;
|
|
68
|
+
showWalletButtonHeader?: boolean;
|
|
53
69
|
}
|
|
54
|
-
export declare function SwapConfiguration({ amount, tokenPrice, isFetching: isFetchingProp, chain, token, direction, onAmountChange, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, maxUsdDecimals, isInputInteractive, isLoading, inputModeButton, balanceButton, assetsButton, walletButton, showNumericInputDetails, fullHeight, debounceInput, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export declare function SwapConfiguration({ amount, tokenPrice, isFetching: isFetchingProp, chain, token, direction, onAmountChange, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, maxUsdDecimals, isInputInteractive, isLoading, inputModeButton, balanceButton, assetsButton, walletButton, showNumericInputDetails, fullHeight, debounceInput, showWalletButtonHeader, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
|
|
55
71
|
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";
|
|
@@ -19,8 +19,9 @@ interface UseNumericInputOptions {
|
|
|
19
19
|
maxUsdDecimals?: number;
|
|
20
20
|
debounceInput?: boolean;
|
|
21
21
|
direction?: "from" | "to";
|
|
22
|
+
initialInputMode?: UserInputType;
|
|
22
23
|
}
|
|
23
|
-
export declare function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, direction, }: UseNumericInputOptions): {
|
|
24
|
+
export declare function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, direction, initialInputMode, }: UseNumericInputOptions): {
|
|
24
25
|
userInputType: UserInputType;
|
|
25
26
|
inputValue: string;
|
|
26
27
|
handleInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|