@gearbox-protocol/ui-kit 3.13.1 → 3.14.0-next.10
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/buttons/button/button.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
- package/dist/cjs/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
- package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/buttons/button/button.js +1 -0
- package/dist/esm/components/client-adapters/styled-button/styled-button.js +11 -11
- package/dist/esm/components/composites/strategies-table/components/rewards-tooltip/tooltip-content.js +131 -122
- package/dist/esm/components/graph/formatters.js +127 -132
- package/dist/esm/components/graph/graph.js +339 -293
- package/dist/esm/components/health-factor/health-factor.js +3 -3
- package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +104 -21
- package/dist/esm/components/smart-number-input/smart-number-input.js +253 -104
- package/dist/esm/components/trading-view/trading-view.js +58 -58
- package/dist/esm/locale/en.json.js +2 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/buttons/button/button.d.ts +4 -3
- package/dist/types/components/graph/graph.d.ts +8 -1
- 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 +80 -5
- package/dist/types/components/smart-number-input/smart-number-input.d.ts +52 -0
- package/dist/types/components/tip-card/tip-card.d.ts +1 -1
- package/dist/types/components/trading-view/trading-view.d.ts +7 -0
- package/dist/types/locale/en.json.d.ts +2 -0
- package/package.json +3 -3
- package/src/styles/base.css +4 -2
|
@@ -2,7 +2,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
4
|
variant?: "link" | "text" | "default" | "success" | "destructive" | "ghost" | "outline" | "secondary" | "white" | "neutral" | "pink" | "pink-outline" | "blue" | "blue-outline" | null | undefined;
|
|
5
|
-
size?: "default" | "icon" | "auto" | "xs" | "sm" | "lg" | null | undefined;
|
|
5
|
+
size?: "default" | "icon" | "auto" | "xs" | "sm" | "lg" | "md" | null | undefined;
|
|
6
6
|
width?: "compact" | "wide" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
/**
|
|
@@ -43,8 +43,9 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
43
43
|
* Sizes (size):
|
|
44
44
|
* - `auto` — automatic height without padding.
|
|
45
45
|
* - `xs` — extra small (rounded-full, px-3, text-xs).
|
|
46
|
-
* - `sm` — small (h-
|
|
47
|
-
* - `
|
|
46
|
+
* - `sm` — small (h-7, px-3, text-xs).
|
|
47
|
+
* - `md` — medium (h-8, px-3.5, text-sm).
|
|
48
|
+
* - `default` — standard (h-10, px-4).
|
|
48
49
|
* - `lg` — large (h-10, px-8).
|
|
49
50
|
* - `icon` — square button for icons (h-9 w-9).
|
|
50
51
|
*
|
|
@@ -108,10 +108,17 @@ export interface GraphProps {
|
|
|
108
108
|
* between series with different data coverage.
|
|
109
109
|
*/
|
|
110
110
|
visibleTimeFrom?: number;
|
|
111
|
+
/**
|
|
112
|
+
* When true, all user-initiated zoom and pan interactions are disabled.
|
|
113
|
+
* The visible time range can only be changed programmatically — e.g. via
|
|
114
|
+
* range buttons. Specifically disables: mouse-wheel zoom, pinch zoom,
|
|
115
|
+
* axis drag-to-scale, axis double-click reset, and scroll/drag panning.
|
|
116
|
+
*/
|
|
117
|
+
disableZoom?: boolean;
|
|
111
118
|
}
|
|
112
119
|
/**
|
|
113
120
|
* Graph component that renders a chart using lightweight-charts library
|
|
114
121
|
* with support for area series, custom tooltips, and vertical line annotations
|
|
115
122
|
* Supports single or multiple series with different colors and legends
|
|
116
123
|
*/
|
|
117
|
-
export declare function Graph({ series, className, showLegend, onUnselectSeries, xMeasureUnit, yMeasureUnit, optionsOverrides, verticalLineOptions, currentValueDecimals, useSharedPriceScale, showCurrentValue, graphTitle, yScaleMin, yScaleMinMultiple, visibleTimeFrom, }: GraphProps): React.ReactElement;
|
|
124
|
+
export declare function Graph({ series, className, showLegend, onUnselectSeries, xMeasureUnit, yMeasureUnit, optionsOverrides, verticalLineOptions, currentValueDecimals, useSharedPriceScale, showCurrentValue, graphTitle, yScaleMin, yScaleMinMultiple, visibleTimeFrom, disableZoom, }: GraphProps): React.ReactElement;
|
|
@@ -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" | "foreground" | "gray-
|
|
5
|
-
iconHoverColor?: "muted" | "foreground" | "gray-
|
|
4
|
+
iconColor?: "muted" | "foreground" | "gray-50" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "gray-60" | "gray-70" | "gray-80" | "gray-90" | "gray-100" | "gray-110" | null | undefined;
|
|
5
|
+
iconHoverColor?: "muted" | "foreground" | "gray-50" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "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,14 +4,89 @@ 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>` element. */
|
|
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
|
+
/**
|
|
32
|
+
* Hybrid centring for the main column. Only meaningful with
|
|
33
|
+
* `variant="detail"`.
|
|
34
|
+
*
|
|
35
|
+
* - **`lg` … `1799px`** — behaves like the standard detail row: the aside is
|
|
36
|
+
* in flow and the main column fills the remaining space (LP-style fill).
|
|
37
|
+
* - **`≥1800px`** — the wrapper becomes a viewport-centred, width-capped box
|
|
38
|
+
* (`mx-auto`), the aside is parked out of flow in the gutter next to the
|
|
39
|
+
* main column (`absolute right-full` / `left-full`), and the main column is
|
|
40
|
+
* optically centred on the viewport. It still scales up to `80rem`.
|
|
41
|
+
*
|
|
42
|
+
* This avoids the very narrow centred column on mid-size desktops while still
|
|
43
|
+
* centring the content on wide screens.
|
|
44
|
+
*
|
|
45
|
+
* Assumes the layout is rendered inside the app shell padding
|
|
46
|
+
* (`px-4 sm:px-6 lg:px-8`) — the `≥1800px` gutter reserves `460px` aside +
|
|
47
|
+
* `1.5rem` gap + the `lg:px-8` (`2rem`) shell padding on each side.
|
|
48
|
+
*
|
|
49
|
+
* On screens below `lg` the layout falls back to the normal stacked column,
|
|
50
|
+
* so wrap usage in `hidden lg:block` if the mobile layout is handled
|
|
51
|
+
* separately.
|
|
52
|
+
*/
|
|
53
|
+
centeredMain?: boolean;
|
|
9
54
|
}
|
|
10
55
|
/**
|
|
11
|
-
*
|
|
12
|
-
* main uses the remaining width (`flex-1 min-w-0`), aside keeps a fixed width.
|
|
56
|
+
* MainAsideLayout — main column + optional sidebar in one row.
|
|
13
57
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
58
|
+
* Intended for use **inside** the app shell `Container` (or inside `px-4 sm:px-6 lg:px-8` padding):
|
|
59
|
+
* - main column uses the remaining width (`flex-1 min-w-0`)
|
|
60
|
+
* - aside keeps a fixed width supplied via `asideClassName`
|
|
61
|
+
*
|
|
62
|
+
* On small screens the stack uses `column-reverse` so the sidebar appears above the
|
|
63
|
+
* main column when `asidePosition` is `"right"` (standard for detail pages).
|
|
64
|
+
*
|
|
65
|
+
* ### Default variant
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <MainAsideLayout aside={<Panel />} asideClassName="lg:w-[320px]">
|
|
68
|
+
* <Content />
|
|
69
|
+
* </MainAsideLayout>
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* ### Detail variant — sticky → fixed aside for pool / strategy / position pages
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <MainAsideLayout variant="detail" mainRef={graphRootRef} aside={<Panel />}>
|
|
75
|
+
* <Content />
|
|
76
|
+
* </MainAsideLayout>
|
|
77
|
+
* ```
|
|
78
|
+
* This reproduces the `PoolDetailsScreen` two-column layout:
|
|
79
|
+
* sticky aside below 2450 px viewport, fixed aside above it, correct max-widths.
|
|
80
|
+
*
|
|
81
|
+
* ### Detail variant — viewport-centred main (`centeredMain`)
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <div className="hidden lg:block">
|
|
84
|
+
* <MainAsideLayout variant="detail" asidePosition="left" centeredMain aside={<Panel />}>
|
|
85
|
+
* <Content />
|
|
86
|
+
* </MainAsideLayout>
|
|
87
|
+
* </div>
|
|
88
|
+
* ```
|
|
89
|
+
* Centres the main column on the viewport at all desktop widths while the aside
|
|
90
|
+
* sits in the gutter; the main column still scales up to `80rem`.
|
|
16
91
|
*/
|
|
17
92
|
export declare const MainAsideLayout: React.ForwardRefExoticComponent<MainAsideLayoutProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { NetworkType } from '@gearbox-protocol/sdk';
|
|
2
2
|
import { TokenFullData } from '../../types/common';
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
export interface TokenOption {
|
|
5
|
+
/** Display label for this option. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Optional icon to display before the label. */
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Called when this option is selected (single-select) or toggled (multi-select).
|
|
11
|
+
* In multi-select mode the dropdown stays open; the parent manages checked state.
|
|
12
|
+
*/
|
|
13
|
+
onSelect: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* When true, the option is shown with a checkmark.
|
|
16
|
+
* Used only in multi-select mode (`multiSelectMode` prop on SmartNumberInput).
|
|
17
|
+
*/
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
}
|
|
4
20
|
/** A-matching SmartNumberInput size for layout (styles.tsx). */
|
|
5
21
|
export type SmartNumberInputSize = "sm" | "md";
|
|
6
22
|
export interface SmartNumberInputProps {
|
|
@@ -28,6 +44,18 @@ export interface SmartNumberInputProps {
|
|
|
28
44
|
size?: SmartNumberInputSize;
|
|
29
45
|
/** When true, currency dropdown is open (expand icon rotated). */
|
|
30
46
|
active?: boolean;
|
|
47
|
+
/** Override max character length for token symbol display. When omitted, computed from viewport width. */
|
|
48
|
+
symbolMaxLength?: number;
|
|
49
|
+
/** Inline token options for dropdown selection (alternative to onShowSelectDialog). */
|
|
50
|
+
tokenOptions?: TokenOption[];
|
|
51
|
+
/**
|
|
52
|
+
* When true, the tokenOptions dropdown works as a multi-select:
|
|
53
|
+
* - The dropdown stays open after each click (doesn't auto-close).
|
|
54
|
+
* - Options marked `checked: true` show a checkmark.
|
|
55
|
+
* - The dropdown stays open until the user closes it (e.g. click outside).
|
|
56
|
+
* The parent is responsible for maintaining `checked` state on each option.
|
|
57
|
+
*/
|
|
58
|
+
multiSelectMode?: boolean;
|
|
31
59
|
/** Callback when amount changes. Called with (value: bigint, valueView: string). */
|
|
32
60
|
onSetAmount?: (value: bigint, valueView: string) => void;
|
|
33
61
|
/** Callback to show token select dialog. */
|
|
@@ -38,6 +66,30 @@ export interface SmartNumberInputProps {
|
|
|
38
66
|
onFocus?: () => void;
|
|
39
67
|
/** Blur callback. */
|
|
40
68
|
onBlur?: () => void;
|
|
69
|
+
/**
|
|
70
|
+
* USD price per one whole token unit (e.g. 1800.5 for ETH at $1 800.50).
|
|
71
|
+
* When provided, the USD equivalent of the current amount is displayed below the input.
|
|
72
|
+
*/
|
|
73
|
+
usdPrice?: number;
|
|
74
|
+
/**
|
|
75
|
+
* When provided, renders a Health Factor slider in the balance row
|
|
76
|
+
* (replacing the max amount / "Can borrow" indicator).
|
|
77
|
+
* Intended for debt inputs where the user wants to target a specific HF.
|
|
78
|
+
*/
|
|
79
|
+
hfSlider?: HFSliderConfig;
|
|
80
|
+
}
|
|
81
|
+
/** Configuration for the inline Health Factor slider. */
|
|
82
|
+
export interface HFSliderConfig {
|
|
83
|
+
/** Current target HF as a float (e.g. 1.5 for 150%). */
|
|
84
|
+
value: number;
|
|
85
|
+
/** Minimum HF value. @default 1.0 */
|
|
86
|
+
min?: number;
|
|
87
|
+
/** Maximum HF value. @default 3.0 */
|
|
88
|
+
max?: number;
|
|
89
|
+
/** Slider step. @default 0.01 */
|
|
90
|
+
step?: number;
|
|
91
|
+
/** Called when the slider value changes. */
|
|
92
|
+
onChange: (value: number) => void;
|
|
41
93
|
}
|
|
42
94
|
/**
|
|
43
95
|
* SmartNumberInput — token amount input with balance display (matches interface).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const tipCardVariants: (props?: ({
|
|
4
|
-
backgroundColor?: "dark" | "transparent" | "light" | "gray-
|
|
4
|
+
backgroundColor?: "dark" | "transparent" | "light" | "gray-50" | "gray-10" | "gray-20" | "gray-30" | "gray-40" | "gray-60" | "gray-70" | "gray-80" | "gray-90" | "gray-100" | "gray-110" | null | undefined;
|
|
5
5
|
textColor?: "unset" | "dark" | "light" | null | undefined;
|
|
6
6
|
borderColor?: "none" | "dark" | "light" | "gradient" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -94,6 +94,13 @@ export interface TradingViewProps<T extends string = string> extends Omit<GraphV
|
|
|
94
94
|
* so colors stay stable across reloads (same label keeps the same color).
|
|
95
95
|
*/
|
|
96
96
|
seriesColorPersistenceKey?: string;
|
|
97
|
+
/**
|
|
98
|
+
* When true, all user-initiated zoom and pan interactions are disabled.
|
|
99
|
+
* The time range can only be changed via the range buttons.
|
|
100
|
+
* Disables: mouse-wheel zoom, pinch zoom, axis drag, axis double-click reset,
|
|
101
|
+
* and scroll/drag panning.
|
|
102
|
+
*/
|
|
103
|
+
disableZoom?: boolean;
|
|
97
104
|
}
|
|
98
105
|
/**
|
|
99
106
|
* TradingView — comprehensive charting component with graph selection and time range controls.
|
|
@@ -25,8 +25,10 @@ declare const _default: {
|
|
|
25
25
|
"components.loading.wait": "Please wait...",
|
|
26
26
|
|
|
27
27
|
"components.smartNumberInput.balance": "Balance",
|
|
28
|
+
"components.smartNumberInput.amountLabel": "Amount",
|
|
28
29
|
"components.smartNumberInput.inputTitle": "Token Amount",
|
|
29
30
|
"components.smartNumberInput.confirm.input": "Input",
|
|
31
|
+
"components.smartNumberInput.selectToken": "Select token",
|
|
30
32
|
|
|
31
33
|
"components.tipWindow.title": "Tip",
|
|
32
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0-next.10",
|
|
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": "
|
|
75
|
-
"test:watch": "
|
|
74
|
+
"test": "vitest run",
|
|
75
|
+
"test:watch": "vitest",
|
|
76
76
|
"storybook": "storybook dev -p 6006",
|
|
77
77
|
"build-storybook": "storybook build"
|
|
78
78
|
},
|
package/src/styles/base.css
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Base styles for @gearbox-protocol/ui-kit
|
|
3
3
|
*
|
|
4
4
|
* This file contains:
|
|
5
|
-
* - Google Fonts import (Rubik)
|
|
6
5
|
* - CSS variables for light/dark themes (:root, .dark)
|
|
7
6
|
* - Base body styles with fallbacks
|
|
8
7
|
* - Scrollbar styles (custom + navbar)
|
|
@@ -10,6 +9,10 @@
|
|
|
10
9
|
* - React-Slick carousel overrides
|
|
11
10
|
* - Liquidation graph styles
|
|
12
11
|
*
|
|
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
|
+
*
|
|
13
16
|
* Does NOT contain:
|
|
14
17
|
* - @import "tailwindcss" (import separately)
|
|
15
18
|
* - @theme block (use theme.css for Tailwind v4 utilities)
|
|
@@ -19,7 +22,6 @@
|
|
|
19
22
|
* - For full setup: import globals.css (includes everything)
|
|
20
23
|
* - For modular setup: import base.css + theme.css + tailwindcss separately
|
|
21
24
|
*/
|
|
22
|
-
@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap");
|
|
23
25
|
|
|
24
26
|
/*
|
|
25
27
|
* Critical fallback styles for browsers without CSS variable support
|