@gearbox-protocol/ui-kit 3.13.0-next.1 → 3.13.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.
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
- package/dist/cjs/components/rounded-image/rounded-image.cjs +1 -1
- package/dist/cjs/components/token-icon/token-icon.cjs +1 -1
- package/dist/cjs/components/token-symbol/token-symbol.cjs +1 -1
- package/dist/cjs/types/common.cjs +1 -1
- package/dist/esm/components/compound-apy/compound-apy.js +71 -68
- package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +22 -70
- package/dist/esm/components/rounded-image/rounded-image.js +16 -16
- package/dist/esm/components/token-icon/token-icon.js +134 -44
- package/dist/esm/components/token-symbol/token-symbol.js +55 -46
- package/dist/esm/types/common.js +6 -1
- package/dist/globals.css +1 -1
- package/dist/types/components/compound-apy/compound-apy.d.ts +1 -3
- package/dist/types/components/help-tip/help-tip.d.ts +2 -2
- package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +5 -46
- package/dist/types/components/token-icon/index.d.ts +1 -1
- package/dist/types/components/token-icon/token-icon.d.ts +8 -3
- package/dist/types/types/common.d.ts +11 -1
- package/package.json +4 -4
- package/src/styles/base.css +2 -4
|
@@ -5,9 +5,7 @@ import { TokenMetaInfo } from '../../types/common';
|
|
|
5
5
|
* For GEAR token, use the logo symbol instead of the standard token icon.
|
|
6
6
|
* The standard gear.svg has a white background circle that looks bad on dark themes.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getRewardTokenSymbol(token: TokenMetaInfo | undefined, rewardTokenSymbol: string | undefined): (
|
|
9
|
-
icon: string;
|
|
10
|
-
}) | undefined;
|
|
8
|
+
export declare function getRewardTokenSymbol(token: TokenMetaInfo | undefined, rewardTokenSymbol: string | undefined): import('../token-icon').SymbolOrIcon | undefined;
|
|
11
9
|
export interface PoolBaseAPY {
|
|
12
10
|
type: "supplyAPY" | "tokenYield";
|
|
13
11
|
apy: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const iconColorVariants: (props?: ({
|
|
4
|
-
iconColor?: "muted" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "gray-50" | "gray-60" | "gray-70" | "gray-80" | "gray-90" | "gray-100" | "gray-110" |
|
|
5
|
-
iconHoverColor?: "muted" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "gray-50" | "gray-60" | "gray-70" | "gray-80" | "gray-90" | "gray-100" | "gray-110" |
|
|
4
|
+
iconColor?: "muted" | "foreground" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "gray-50" | "gray-60" | "gray-70" | "gray-80" | "gray-90" | "gray-100" | "gray-110" | null | undefined;
|
|
5
|
+
iconHoverColor?: "muted" | "foreground" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "gray-50" | "gray-60" | "gray-70" | "gray-80" | "gray-90" | "gray-100" | "gray-110" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface HelpTipProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "title"> {
|
|
8
8
|
/** Tooltip popup content (what appears when hovering the icon). */
|
|
@@ -4,55 +4,14 @@ export interface MainAsideLayoutProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
4
4
|
/** Sidebar; rendered to the left or right of the main column (`asidePosition`). */
|
|
5
5
|
aside?: React.ReactNode;
|
|
6
6
|
asidePosition?: "left" | "right";
|
|
7
|
-
/** Classes for the outer `<aside>`
|
|
7
|
+
/** Classes for the outer `<aside>` (width, sticky, responsive visibility, etc.). */
|
|
8
8
|
asideClassName?: string;
|
|
9
|
-
/** Classes for the inner main column `<div>`. */
|
|
10
|
-
mainClassName?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Ref forwarded to the main column `<div>`.
|
|
13
|
-
* Use for ResizeObserver-based width tracking (e.g. chart resize key).
|
|
14
|
-
*/
|
|
15
|
-
mainRef?: React.RefObject<HTMLDivElement | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Layout variant.
|
|
18
|
-
*
|
|
19
|
-
* - `"default"` (default) — simple flex row, aside width controlled via `asideClassName`.
|
|
20
|
-
*
|
|
21
|
-
* - `"detail"` — detail page layout (pool / strategy / position detail screens):
|
|
22
|
-
* - aside is `420px` at `lg`, `460px` at `xl`
|
|
23
|
-
* - aside is **sticky** (`top-4`) from `lg` up to `2449px`
|
|
24
|
-
* - aside becomes **fixed** (`top-28 right-32`) at `≥2450px`
|
|
25
|
-
* - outer wrapper caps at `calc(80rem + 420px + 1.5rem)` / `calc(80rem + 460px + 1.5rem)`
|
|
26
|
-
* - at `≥2450px` the wrapper switches to `display:block` and the main column
|
|
27
|
-
* centres itself via `mx-auto` with `max-w-[min(80rem,calc(100vw-460px-8rem))]`
|
|
28
|
-
* - pass `asideClassName` to override or augment aside classes (e.g. z-index)
|
|
29
|
-
*/
|
|
30
|
-
variant?: "default" | "detail";
|
|
31
9
|
}
|
|
32
10
|
/**
|
|
33
|
-
*
|
|
11
|
+
* Main column + optional sidebar in one row. Intended for use **inside** the app shell `Container`:
|
|
12
|
+
* main uses the remaining width (`flex-1 min-w-0`), aside keeps a fixed width.
|
|
34
13
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* - aside keeps a fixed width supplied via `asideClassName`
|
|
38
|
-
*
|
|
39
|
-
* On small screens the stack uses `column-reverse` so the sidebar appears above the
|
|
40
|
-
* main column when `asidePosition` is `"right"` (standard for detail pages).
|
|
41
|
-
*
|
|
42
|
-
* ### Default variant
|
|
43
|
-
* ```tsx
|
|
44
|
-
* <MainAsideLayout aside={<Panel />} asideClassName="lg:w-[320px]">
|
|
45
|
-
* <Content />
|
|
46
|
-
* </MainAsideLayout>
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* ### Detail variant — sticky → fixed aside for pool / strategy / position pages
|
|
50
|
-
* ```tsx
|
|
51
|
-
* <MainAsideLayout variant="detail" mainRef={graphRootRef} aside={<Panel />}>
|
|
52
|
-
* <Content />
|
|
53
|
-
* </MainAsideLayout>
|
|
54
|
-
* ```
|
|
55
|
-
* This reproduces the `PoolDetailsScreen` two-column layout:
|
|
56
|
-
* sticky aside below 2450 px viewport, fixed aside above it, correct max-widths.
|
|
14
|
+
* On small screens the stack uses `column-reverse` so the sidebar stays above the main column when
|
|
15
|
+
* `asidePosition` is `"right"` (common for pool pages).
|
|
57
16
|
*/
|
|
58
17
|
export declare const MainAsideLayout: React.ForwardRefExoticComponent<MainAsideLayoutProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { preloadTokenIcons, TokenIcon, type TokenIconProps, } from './token-icon';
|
|
1
|
+
export { preloadTokenIcons, type SymbolOrIcon, TokenIcon, type TokenIconProps, } from './token-icon';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IconComposite } from '@gearbox-protocol/sdk/common-utils';
|
|
1
2
|
import { default as React } from 'react';
|
|
2
3
|
import { RoundedImageProps } from '../rounded-image/rounded-image';
|
|
3
4
|
/**
|
|
@@ -8,7 +9,7 @@ import { RoundedImageProps } from '../rounded-image/rounded-image';
|
|
|
8
9
|
* token symbols, asset icons, currency icons, token representations.
|
|
9
10
|
*
|
|
10
11
|
* Props:
|
|
11
|
-
* - `symbol` — token symbol/ticker (
|
|
12
|
+
* - `symbol` — token symbol/ticker, direct icon URL, or `IconComposite` (see `TokenMetaInfo` in `@/types/common`).
|
|
12
13
|
* - `size` — icon size in pixels (defaults to 48).
|
|
13
14
|
*
|
|
14
15
|
* Note: Fetches icon from Gearbox static CDN based on symbol.
|
|
@@ -16,19 +17,23 @@ import { RoundedImageProps } from '../rounded-image/rounded-image';
|
|
|
16
17
|
* Symbol is normalized (removes "/", spaces, "-f", converts "-" to "_", lowercased).
|
|
17
18
|
* Icon displays in its original shape (not clipped).
|
|
18
19
|
*
|
|
20
|
+
* **Ref behavior:** In the default single-image mode, `ref` is attached to the underlying `<img>`.
|
|
21
|
+
* In composite mode, `ref` is attached to the outer wrapper `div` (see `TokenIconProps` / `forwardRef` generic).
|
|
22
|
+
*
|
|
19
23
|
* Do NOT use TokenIcon:
|
|
20
24
|
* - for address identifiers (use Identicon component).
|
|
21
25
|
* - for custom images or logos (use Image component).
|
|
22
26
|
*/
|
|
23
|
-
type
|
|
27
|
+
type DirectIcon = {
|
|
24
28
|
icon: string;
|
|
25
29
|
};
|
|
30
|
+
export type SymbolOrIcon = string | DirectIcon | IconComposite;
|
|
26
31
|
export interface TokenIconProps extends Omit<RoundedImageProps, "src" | "size"> {
|
|
27
32
|
symbol: SymbolOrIcon | undefined;
|
|
28
33
|
size?: number;
|
|
29
34
|
className?: string;
|
|
30
35
|
}
|
|
31
|
-
declare const TokenIcon: React.ForwardRefExoticComponent<TokenIconProps & React.RefAttributes<HTMLImageElement>>;
|
|
36
|
+
declare const TokenIcon: React.ForwardRefExoticComponent<TokenIconProps & React.RefAttributes<HTMLDivElement | HTMLImageElement>>;
|
|
32
37
|
export { TokenIcon };
|
|
33
38
|
/**
|
|
34
39
|
* Preload token icons into browser cache.
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import { IconComposite } from '@gearbox-protocol/sdk/common-utils';
|
|
1
2
|
import { Address } from 'viem';
|
|
3
|
+
export declare function isIconComposite(value: string | IconComposite | undefined | null): value is IconComposite;
|
|
2
4
|
export type TokenMetaInfo = {
|
|
3
5
|
symbol: string;
|
|
4
6
|
title?: string;
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Token icon:
|
|
9
|
+
* - **String** — direct URL to a single raster/SVG asset. Often the best choice when the image is
|
|
10
|
+
* baked on the server or CDN (single request, no client layering).
|
|
11
|
+
* - **`IconComposite`** — layered icon using named UI-kit presets (`stacked_full`, `centered_foreground`).
|
|
12
|
+
*
|
|
13
|
+
* Do not mix legacy alternate shapes; `icon` is a discriminated field (`string` vs `kind: "composite"`).
|
|
14
|
+
*/
|
|
15
|
+
icon?: string | IconComposite;
|
|
6
16
|
name?: string;
|
|
7
17
|
};
|
|
8
18
|
export type TokenFullData = TokenMetaInfo & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "3.13.0
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"repository": "https://github.com/gearbox-protocol/ui-kit",
|
|
6
6
|
"license": "MIT",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"check": "biome check --write",
|
|
72
72
|
"check:ci": "biome check --diagnostic-level=error",
|
|
73
73
|
"typecheck:ci": "tsc --noEmit",
|
|
74
|
-
"test": "vitest run",
|
|
75
|
-
"test:watch": "vitest",
|
|
74
|
+
"test": "pnpm exec vitest run",
|
|
75
|
+
"test:watch": "pnpm exec vitest",
|
|
76
76
|
"storybook": "storybook dev -p 6006",
|
|
77
77
|
"build-storybook": "storybook build"
|
|
78
78
|
},
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"@commitlint/cli": "^20.1.0",
|
|
154
154
|
"@commitlint/config-conventional": "^20.0.0",
|
|
155
155
|
"@gearbox-protocol/biome-config": "^1.0.2",
|
|
156
|
-
"@gearbox-protocol/sdk": "14.5
|
|
156
|
+
"@gearbox-protocol/sdk": "14.8.5",
|
|
157
157
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
158
158
|
"@storybook/addon-a11y": "^10.0.8",
|
|
159
159
|
"@storybook/addon-docs": "^10.0.8",
|
package/src/styles/base.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Base styles for @gearbox-protocol/ui-kit
|
|
3
3
|
*
|
|
4
4
|
* This file contains:
|
|
5
|
+
* - Google Fonts import (Rubik)
|
|
5
6
|
* - CSS variables for light/dark themes (:root, .dark)
|
|
6
7
|
* - Base body styles with fallbacks
|
|
7
8
|
* - Scrollbar styles (custom + navbar)
|
|
@@ -9,10 +10,6 @@
|
|
|
9
10
|
* - React-Slick carousel overrides
|
|
10
11
|
* - Liquidation graph styles
|
|
11
12
|
*
|
|
12
|
-
* Rubik: load from the host app (e.g. `<link>` to Google Fonts in `index.html`).
|
|
13
|
-
* Do not use `@import url(...fonts...)` here — when this file is bundled after
|
|
14
|
-
* Tailwind layers, that breaks CSS `@import` ordering for minifiers.
|
|
15
|
-
*
|
|
16
13
|
* Does NOT contain:
|
|
17
14
|
* - @import "tailwindcss" (import separately)
|
|
18
15
|
* - @theme block (use theme.css for Tailwind v4 utilities)
|
|
@@ -22,6 +19,7 @@
|
|
|
22
19
|
* - For full setup: import globals.css (includes everything)
|
|
23
20
|
* - For modular setup: import base.css + theme.css + tailwindcss separately
|
|
24
21
|
*/
|
|
22
|
+
@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap");
|
|
25
23
|
|
|
26
24
|
/*
|
|
27
25
|
* Critical fallback styles for browsers without CSS variable support
|