@0xsquid/ui 2.0.5 → 2.2.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.
Files changed (41) hide show
  1. package/dist/cjs/index.js +20733 -14089
  2. package/dist/cjs/types/assets/animations/index.d.ts +13970 -11
  3. package/dist/cjs/types/assets/index.d.ts +1 -0
  4. package/dist/cjs/types/components/buttons/StopsButton.d.ts +4 -4
  5. package/dist/cjs/types/components/layout/AnimationWrapper.d.ts +3 -5
  6. package/dist/cjs/types/components/layout/NavigationBar.d.ts +4 -4
  7. package/dist/cjs/types/components/views/SwapProgressView.d.ts +6 -6
  8. package/dist/cjs/types/core/design-system.d.ts +8 -0
  9. package/dist/cjs/types/core/index.d.ts +1 -1
  10. package/dist/cjs/types/core/themes.d.ts +7 -8
  11. package/dist/cjs/types/hooks/useUserTheme.d.ts +1 -1
  12. package/dist/cjs/types/index.d.ts +1 -0
  13. package/dist/cjs/types/providers/ThemeProvider.d.ts +3 -2
  14. package/dist/cjs/types/services/internal/colorService.d.ts +2 -1
  15. package/dist/cjs/types/stores/settings.d.ts +2 -0
  16. package/dist/cjs/types/stories/buttons/StopsButton.stories.d.ts +1 -1
  17. package/dist/cjs/types/types/config.d.ts +29 -6
  18. package/dist/cjs/types/types/index.d.ts +1 -1
  19. package/dist/cjs/types/types/utils.d.ts +3 -0
  20. package/dist/esm/index.js +20727 -14089
  21. package/dist/esm/types/assets/animations/index.d.ts +13970 -11
  22. package/dist/esm/types/assets/index.d.ts +1 -0
  23. package/dist/esm/types/components/buttons/StopsButton.d.ts +4 -4
  24. package/dist/esm/types/components/layout/AnimationWrapper.d.ts +3 -5
  25. package/dist/esm/types/components/layout/NavigationBar.d.ts +4 -4
  26. package/dist/esm/types/components/views/SwapProgressView.d.ts +6 -6
  27. package/dist/esm/types/core/design-system.d.ts +8 -0
  28. package/dist/esm/types/core/index.d.ts +1 -1
  29. package/dist/esm/types/core/themes.d.ts +7 -8
  30. package/dist/esm/types/hooks/useUserTheme.d.ts +1 -1
  31. package/dist/esm/types/index.d.ts +1 -0
  32. package/dist/esm/types/providers/ThemeProvider.d.ts +3 -2
  33. package/dist/esm/types/services/internal/colorService.d.ts +2 -1
  34. package/dist/esm/types/stores/settings.d.ts +2 -0
  35. package/dist/esm/types/stories/buttons/StopsButton.stories.d.ts +1 -1
  36. package/dist/esm/types/types/config.d.ts +29 -6
  37. package/dist/esm/types/types/index.d.ts +1 -1
  38. package/dist/esm/types/types/utils.d.ts +3 -0
  39. package/dist/index.css +1 -1
  40. package/dist/index.d.ts +14031 -37
  41. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ export * from "./animations";
@@ -1,14 +1,14 @@
1
1
  /// <reference types="react" />
2
- import { TooltipProps } from "../controls";
2
+ import { type TooltipProps } from "../controls";
3
3
  export interface StopsProps extends React.ComponentProps<"button"> {
4
4
  stopsCount?: string | number;
5
5
  estimatedTime?: string;
6
6
  tooltip?: Omit<TooltipProps, "children">;
7
7
  providers: Provider[];
8
8
  }
9
- export declare function StopsButton({ stopsCount, estimatedTime, tooltip, providers, ...props }: StopsProps): import("react/jsx-runtime").JSX.Element;
10
- type Provider = {
9
+ export declare function StopsButton({ stopsCount, estimatedTime, tooltip, disabled, providers, ...props }: StopsProps): import("react/jsx-runtime").JSX.Element;
10
+ interface Provider {
11
11
  logoUrl: string;
12
12
  key: string;
13
- };
13
+ }
14
14
  export {};
@@ -1,8 +1,6 @@
1
1
  /// <reference types="react" />
2
- interface Props {
3
- lottieJsonFile: object;
4
- animReplacement?: JSX.Element;
5
- hideAnimations?: boolean;
2
+ import { Player } from "@lottiefiles/react-lottie-player";
3
+ interface Props extends React.ComponentProps<typeof Player> {
6
4
  }
7
- export declare const AnimationWrapper: ({ lottieJsonFile, animReplacement, hideAnimations, }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const AnimationWrapper: (playerProps: Props) => import("react/jsx-runtime").JSX.Element;
8
6
  export {};
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { ChipProps } from "../buttons";
3
- import { TooltipProps } from "../controls";
4
- export type ActionButton = {
2
+ import { type ChipProps } from "../buttons";
3
+ import { type TooltipProps } from "../controls";
4
+ export interface ActionButton {
5
5
  labelOrIcon: string | React.ReactNode;
6
6
  onClick?: () => void;
7
7
  id: React.Key;
8
8
  tooltip?: Omit<TooltipProps, "children">;
9
9
  chip?: ChipProps;
10
- };
10
+ }
11
11
  interface NavigationBarProps extends React.ComponentProps<"nav"> {
12
12
  title?: string;
13
13
  displayBackButton?: boolean;
@@ -1,14 +1,14 @@
1
- import { SwapState, SwapStep } from "../../types/components";
2
- import { SwapStepsCollapsedFooterButton } from "../layout/SwapStepsCollapsed";
3
- type ChainData = {
1
+ import { SwapState, type SwapStep } from "../../types/components";
2
+ import { type SwapStepsCollapsedFooterButton } from "../layout/SwapStepsCollapsed";
3
+ interface ChainData {
4
4
  networkName: string;
5
5
  logoUrl: string;
6
- };
7
- type Token = {
6
+ }
7
+ interface Token {
8
8
  symbol: string;
9
9
  logoUrl: string;
10
10
  bgColor: string;
11
- };
11
+ }
12
12
  export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }: {
13
13
  steps: SwapStep[];
14
14
  handleClose?: (swapState: SwapState) => void;
@@ -8,4 +8,12 @@ export declare const spacing: {
8
8
  "squid-xl": string;
9
9
  "squid-xxl": string;
10
10
  };
11
+ export declare const boxShadow: {
12
+ "elevation-dark-3": string;
13
+ "elevation-light-3": string;
14
+ "elevation-dark-2": string;
15
+ "elevation-light-1": string;
16
+ "elevation-light-2": string;
17
+ "inset-royal": string;
18
+ };
11
19
  export declare const baseTailwindConfig: Config;
@@ -1,4 +1,4 @@
1
1
  export { MEDIA_QUERIES, CSS_VARS } from "./constants";
2
- export { darkTheme, lightTheme, defaultTheme } from "./themes";
2
+ export { darkTheme, lightTheme } from "./themes";
3
3
  export { baseTailwindConfig } from "./design-system";
4
4
  export { cn } from "./utils";
@@ -1,5 +1,5 @@
1
1
  import { type ThemeType } from "../types/components";
2
- import { type Theme } from "../types/config";
2
+ import { type PublicTheme, type Theme } from "../types/config";
3
3
  export interface ThemeConfig {
4
4
  name: string;
5
5
  themeImgPath: string;
@@ -7,11 +7,10 @@ export interface ThemeConfig {
7
7
  theme: Theme;
8
8
  type: ThemeType;
9
9
  }
10
- export declare const defaultFontSize: Theme["fontSize"];
11
- export declare const defaultFontWeight: Theme["fontWeight"];
12
- export declare const defaultFontFamily: Theme["fontFamily"];
13
- export declare const defaultBorderRadius: Theme["borderRadius"];
14
- export declare const lightTheme: Theme;
15
- export declare const darkTheme: Theme;
16
- export declare const defaultTheme: Required<Theme>;
10
+ export declare const defaultFontSize: PublicTheme["fontSize"];
11
+ export declare const defaultFontWeight: PublicTheme["fontWeight"];
12
+ export declare const defaultFontFamily: PublicTheme["fontFamily"];
13
+ export declare const defaultBorderRadius: PublicTheme["borderRadius"];
14
+ export declare const lightTheme: PublicTheme;
15
+ export declare const darkTheme: PublicTheme;
17
16
  export declare const themes: ThemeConfig[];
@@ -7,7 +7,7 @@ export declare enum ThemePreference {
7
7
  export declare function useUserTheme(): {
8
8
  themePreference: ThemePreference;
9
9
  themeType: ThemeType;
10
- theme: import("../types").Theme;
10
+ theme: import("../types").PublicTheme;
11
11
  setThemeManually: (theme: ThemePreference) => void;
12
12
  isDarkMode: boolean;
13
13
  };
@@ -4,3 +4,4 @@ export * from "./hooks";
4
4
  export * from "./types";
5
5
  export * from "./core";
6
6
  export * from "./services";
7
+ export * from "./assets";
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import "../styles/compiled-tailwind.css";
3
- import { type Theme } from "../types";
3
+ import { type Settings, type Theme } from "../types";
4
4
  import { type ThemeType } from "../types/components";
5
5
  interface ThemeProviderProps extends React.ComponentProps<"div"> {
6
6
  theme?: Theme;
7
7
  children?: React.ReactNode;
8
8
  themeType?: ThemeType;
9
+ settings?: Partial<Settings>;
9
10
  }
10
- export declare function ThemeProvider({ theme, children, themeType, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ThemeProvider({ theme, children, themeType, settings, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
11
12
  export {};
@@ -1,10 +1,11 @@
1
1
  import { type Theme } from "../../types/config";
2
+ import { type ThemeType } from "../../types";
2
3
  /**
3
4
  * Parses the user readable config to css variables
4
5
  * and adds the material-* variants
5
6
  * @param style
6
7
  */
7
- export declare const parseSquidTheme: (userTheme?: Theme) => Record<string, string | undefined> | undefined;
8
+ export declare const parseSquidTheme: (userTheme: Theme, themeType: ThemeType) => Record<string, string | undefined> | undefined;
8
9
  export declare const remToPx: (rem: string | number, baseFontSize?: number) => number;
9
10
  export declare const pxToRem: (px: string | number, baseFontSize?: number) => number;
10
11
  export declare function getContrastColor({ r, g, b, }: {
@@ -0,0 +1,2 @@
1
+ import { type Settings } from "../types";
2
+ export declare const useSettingsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<Settings>>;
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { type Meta, type StoryObj } from "@storybook/react";
2
2
  import { StopsButton } from "../../components/buttons/StopsButton";
3
3
  declare const meta: Meta<typeof StopsButton>;
4
4
  export default meta;
@@ -1,26 +1,45 @@
1
- declare const THEME_COLOR_KEYS: readonly ["grey-100", "grey-200", "grey-300", "grey-400", "grey-500", "grey-600", "grey-700", "grey-800", "grey-900", "royal-300", "royal-400", "royal-500", "royal-700", "status-positive", "status-negative", "status-partial", "material-light-thin", "material-light-average", "material-light-thick", "material-dark-thin", "material-dark-average", "material-dark-thick", "highlight-700", "grey-100-005", "material-light-blend-grey-900", "material-light-blend-grey-800"];
2
- declare const THEME_BORDER_RADIUS_KEYS: readonly ["button-large", "button-medium"];
1
+ import { type DeepPartial } from "./utils";
2
+ declare const THEME_COLOR_KEYS: readonly ["grey-100", "grey-200", "grey-300", "grey-400", "grey-500", "grey-600", "grey-700", "grey-800", "grey-900", "royal-300", "royal-400", "royal-500", "royal-700", "highlight-700", "status-positive", "status-negative", "status-partial", "button-lg-primary-bg", "button-lg-primary-text", "button-lg-secondary-bg", "button-lg-secondary-text", "button-lg-tertiary-bg", "button-lg-tertiary-text", "button-md-primary-bg", "button-md-primary-text", "button-md-secondary-bg", "button-md-secondary-text", "button-md-tertiary-bg", "button-md-tertiary-text", "input-placeholder", "input-text", "input-selection", "input-bg", "animation-bg", "animation-text", "modal-backdrop", "material-light-thin", "material-light-average", "material-light-thick", "material-dark-thin", "material-dark-average", "material-dark-thick", "grey-100-005", "material-light-blend-grey-900", "material-light-blend-grey-800"];
3
+ declare const THEME_BORDER_RADIUS_KEYS: readonly ["button-lg-primary", "button-lg-secondary", "button-lg-tertiary", "button-md-primary", "button-md-secondary", "button-md-tertiary", "container", "input", "tooltip-sm", "tooltip-lg", "modal"];
3
4
  declare const THEME_FONT_SIZE_KEYS: readonly ["caption", "body-large", "body-medium", "body-small", "heading-small", "heading-medium", "heading-large"];
4
5
  declare const THEME_FONT_WEIGHT_KEYS: readonly ["caption", "body-small", "body-medium", "body-large", "heading-small", "heading-medium", "heading-large"];
5
6
  declare const THEME_FONT_FAMILY_KEYS: readonly ["squid-main"];
7
+ declare const THEME_BOX_SHADOW_KEYS: readonly ["container"];
6
8
  type ThemeColors = Record<(typeof THEME_COLOR_KEYS)[number], string>;
7
9
  type ThemeFontSize = Record<(typeof THEME_FONT_SIZE_KEYS)[number], string>;
8
10
  type ThemeFontWeight = Record<(typeof THEME_FONT_WEIGHT_KEYS)[number], string>;
9
11
  type ThemeBorderRadius = Record<(typeof THEME_BORDER_RADIUS_KEYS)[number], string>;
10
12
  type ThemeFontFamily = Record<(typeof THEME_FONT_FAMILY_KEYS)[number], string>;
13
+ type ThemeBoxShadow = Record<(typeof THEME_BOX_SHADOW_KEYS)[number], string>;
14
+ /**
15
+ * Full theme, includes internal colors.
16
+ */
11
17
  export interface InternalTheme {
12
18
  color: ThemeColors;
13
19
  fontSize: ThemeFontSize;
14
20
  fontWeight: ThemeFontWeight;
15
21
  borderRadius: ThemeBorderRadius;
16
22
  fontFamily: ThemeFontFamily;
23
+ boxShadow: ThemeBoxShadow;
17
24
  }
18
25
  /**
19
- Public theme, excluding some colors that are generated internally
20
- */
21
- export interface Theme extends Omit<InternalTheme, "color"> {
22
- color: Omit<ThemeColors, "material-light-thin" | "material-light-average" | "material-light-thick" | "material-dark-thin" | "material-dark-average" | "material-dark-thick" | "grey-100-005" | "material-light-blend-grey-900" | "material-light-blend-grey-800">;
26
+ * All the button variant colors are optional
27
+ * and will be generated internally using the base colors if not provided
28
+ */
29
+ type OptionalColorsKeys = "button-lg-primary-bg" | "button-lg-primary-text" | "button-lg-secondary-bg" | "button-lg-secondary-text" | "button-lg-tertiary-bg" | "button-lg-tertiary-text" | "button-md-primary-bg" | "button-md-primary-text" | "button-md-secondary-bg" | "button-md-secondary-text" | "button-md-tertiary-bg" | "button-md-tertiary-text" | "input-placeholder" | "input-text" | "input-selection" | "input-bg" | "animation-bg" | "animation-text" | "modal-backdrop";
30
+ /**
31
+ * These transparent colors are generated internally using the base colors
32
+ */
33
+ type HiddenColorsKeys = "material-light-thin" | "material-light-average" | "material-light-thick" | "material-dark-thin" | "material-dark-average" | "material-dark-thick" | "grey-100-005" | "material-light-blend-grey-900" | "material-light-blend-grey-800";
34
+ /**
35
+ * Public theme, excluding some colors that are generated internally
36
+ * and making some colors optional.
37
+ */
38
+ export interface PublicTheme extends Omit<InternalTheme, "color"> {
39
+ color: // Remove the hidden colors and the optional colors
40
+ Omit<InternalTheme["color"], HiddenColorsKeys | OptionalColorsKeys> & Partial<Pick<InternalTheme["color"], OptionalColorsKeys>>;
23
41
  }
42
+ export type Theme = DeepPartial<PublicTheme>;
24
43
  interface CssVariable {
25
44
  cssVariable: string;
26
45
  }
@@ -32,4 +51,8 @@ type ThemeCssVariables = {
32
51
  */
33
52
  export declare const THEME_CSS_VARIABLE_PREFIX = "--st-";
34
53
  export declare const themeKeysToCssVariables: ThemeCssVariables;
54
+ export interface Settings {
55
+ showProgressAnimation: boolean;
56
+ showModalBackdrop: boolean;
57
+ }
35
58
  export {};
@@ -1,3 +1,3 @@
1
- export type { Theme } from "./config";
1
+ export type { Theme, PublicTheme, Settings } from "./config";
2
2
  export * from "./utils";
3
3
  export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, ButtonVariant, ButtonSize, DescriptionBlock, } from "./components";
@@ -9,3 +9,6 @@
9
9
  export type AllOrNone<T> = T | {
10
10
  [K in keyof T]?: never;
11
11
  };
12
+ export type DeepPartial<T> = {
13
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
14
+ };