@gearbox-protocol/ui-kit 3.14.0-next.31 → 3.14.0-next.33
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/graph/graph.cjs +1 -1
- package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
- package/dist/cjs/configs/tailwind-preset.cjs +1 -1
- package/dist/esm/components/graph/graph.js +462 -341
- package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +67 -41
- package/dist/esm/configs/tailwind-preset.js +1 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/graph/graph.d.ts +57 -2
- package/dist/types/components/graph/index.d.ts +1 -1
- package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +18 -0
- package/dist/types/configs/tailwind-preset.d.ts +1 -0
- package/package.json +1 -1
- package/src/styles/base.css +2 -0
- package/src/styles/theme.css +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartOptions, DeepPartial, Time } from 'lightweight-charts';
|
|
1
|
+
import { ChartOptions, DeepPartial, LineWidth, Time, LineStyle } from 'lightweight-charts';
|
|
2
2
|
import { Point, YMeasureUnits } from './formatters';
|
|
3
3
|
import { GraphTooltipProps } from './graph-tooltip';
|
|
4
4
|
import * as React from "react";
|
|
@@ -24,6 +24,50 @@ export type VerticalLineOptions = Partial<{
|
|
|
24
24
|
labelTextColor: string;
|
|
25
25
|
showLabel: boolean;
|
|
26
26
|
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Horizontal reference line drawn at a fixed Y (price) value, e.g. a
|
|
29
|
+
* liquidation price level. Rendered as a native lightweight-charts price line
|
|
30
|
+
* attached to a series, so it tracks the series' price scale and does not
|
|
31
|
+
* affect autoscale or tooltips.
|
|
32
|
+
*/
|
|
33
|
+
export interface PriceLineConfig {
|
|
34
|
+
/** Y value (price) where the horizontal line is drawn. */
|
|
35
|
+
price: number;
|
|
36
|
+
/**
|
|
37
|
+
* Label of the series to attach the line to. When omitted, the line is
|
|
38
|
+
* attached to the first series that has data (its price scale is used).
|
|
39
|
+
*/
|
|
40
|
+
seriesLabel?: string;
|
|
41
|
+
/** Line color. Defaults to the destructive theme color. */
|
|
42
|
+
color?: string;
|
|
43
|
+
/** Text shown next to the line on the price axis. */
|
|
44
|
+
title?: string;
|
|
45
|
+
/** Line thickness (1–4). Default 1. */
|
|
46
|
+
lineWidth?: LineWidth;
|
|
47
|
+
/** Line dash style. Default dashed. */
|
|
48
|
+
lineStyle?: LineStyle;
|
|
49
|
+
/** Whether to render the value label on the price axis. Default true. */
|
|
50
|
+
axisLabelVisible?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Shaded horizontal band drawn between two Y (price) values across the full
|
|
54
|
+
* width of the chart — e.g. a liquidation "danger zone" below a health-factor
|
|
55
|
+
* threshold. Rendered behind the series as a lightweight-charts primitive, so
|
|
56
|
+
* it tracks the series' price scale and does not affect tooltips.
|
|
57
|
+
*/
|
|
58
|
+
export interface PriceZoneConfig {
|
|
59
|
+
/** Upper price bound. Omit to extend the band to the top of the pane. */
|
|
60
|
+
priceTop?: number;
|
|
61
|
+
/** Lower price bound. Omit to extend the band to the bottom of the pane. */
|
|
62
|
+
priceBottom?: number;
|
|
63
|
+
/** Fill color — use a translucent value. Defaults to a translucent destructive tint. */
|
|
64
|
+
color?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Label of the series whose price scale the band is drawn against. When
|
|
67
|
+
* omitted, the first series with data is used.
|
|
68
|
+
*/
|
|
69
|
+
seriesLabel?: string;
|
|
70
|
+
}
|
|
27
71
|
/**
|
|
28
72
|
* Returns formatted label and value strings for a vertical line tooltip.
|
|
29
73
|
* Used by Graph and by tests.
|
|
@@ -70,6 +114,17 @@ export interface GraphProps {
|
|
|
70
114
|
xCoordinate: Time;
|
|
71
115
|
options?: VerticalLineOptions;
|
|
72
116
|
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Horizontal reference lines drawn at fixed Y (price) values, e.g. a
|
|
119
|
+
* liquidation price level. Each line is attached to a series' price scale.
|
|
120
|
+
*/
|
|
121
|
+
priceLineOptions?: Array<PriceLineConfig>;
|
|
122
|
+
/**
|
|
123
|
+
* Shaded horizontal bands (e.g. a liquidation danger zone) drawn behind the
|
|
124
|
+
* series. Each zone is attached to a series' price scale; finite bounds are
|
|
125
|
+
* included in the Y autoscale so the band stays visible.
|
|
126
|
+
*/
|
|
127
|
+
zoneOptions?: Array<PriceZoneConfig>;
|
|
73
128
|
/**
|
|
74
129
|
* Number of decimal places for current value display.
|
|
75
130
|
* If 0, rounds to whole numbers. Default is 4.
|
|
@@ -121,4 +176,4 @@ export interface GraphProps {
|
|
|
121
176
|
* with support for area series, custom tooltips, and vertical line annotations
|
|
122
177
|
* Supports single or multiple series with different colors and legends
|
|
123
178
|
*/
|
|
124
|
-
export declare function Graph({ series, className, showLegend, onUnselectSeries, xMeasureUnit, yMeasureUnit, optionsOverrides, verticalLineOptions, currentValueDecimals, useSharedPriceScale, showCurrentValue, graphTitle, yScaleMin, yScaleMinMultiple, visibleTimeFrom, disableZoom, }: GraphProps): React.ReactElement;
|
|
179
|
+
export declare function Graph({ series, className, showLegend, onUnselectSeries, xMeasureUnit, yMeasureUnit, optionsOverrides, verticalLineOptions, priceLineOptions, zoneOptions, currentValueDecimals, useSharedPriceScale, showCurrentValue, graphTitle, yScaleMin, yScaleMinMultiple, visibleTimeFrom, disableZoom, }: GraphProps): React.ReactElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './default-config';
|
|
2
2
|
export { getXFormatter, getXFormatters, getYFormatter, type Point as GraphPoint, type XFormatters, type XMeasureUnits, type YMeasureUnits, } from './formatters';
|
|
3
|
-
export { DEFAULT_SERIES_COLORS, Graph, type GraphProps, getSeriesColorPalette, getVerticalLineTooltipContent, type SeriesColorPalette, type SeriesConfig, type VerticalLineOptions, } from './graph';
|
|
3
|
+
export { DEFAULT_SERIES_COLORS, Graph, type GraphProps, getSeriesColorPalette, getVerticalLineTooltipContent, type PriceLineConfig, type PriceZoneConfig, type SeriesColorPalette, type SeriesConfig, type VerticalLineOptions, } from './graph';
|
|
4
4
|
export * from './graph-current-value';
|
|
5
5
|
export * from './graph-tooltip';
|
|
6
6
|
export * from './graph-view';
|
|
@@ -41,6 +41,24 @@ export interface MainAsideLayoutProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
41
41
|
* separately.
|
|
42
42
|
*/
|
|
43
43
|
centeredMain?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the detail-variant aside manages its own sticky / scroll behavior.
|
|
46
|
+
*
|
|
47
|
+
* - `true` (default) — ui-kit owns the aside positioning: built-in sticky
|
|
48
|
+
* (`top-4`) below `2450px`, `fixed` (`top-28`) at `≥2450px`, plus an
|
|
49
|
+
* internal `overflow-y-auto` / `max-h-[100vh]` scroll area.
|
|
50
|
+
* - `false` — the aside stays in normal document flow at all widths (no
|
|
51
|
+
* `fixed`, no internal scroll container), so the page keeps a single
|
|
52
|
+
* scrollbar and the consumer can run its own sticky controller. The detail
|
|
53
|
+
* centring wrapper + `max-width` cap are preserved. At `≥2450px` the row
|
|
54
|
+
* stays a flex row but centres the main column on the viewport
|
|
55
|
+
* (`justify-center`, main `80rem`) while the in-flow aside is pulled into
|
|
56
|
+
* the gutter via a negative margin — so the content reads centred with the
|
|
57
|
+
* form beside it, and the consumer's controller keeps managing stickiness.
|
|
58
|
+
*
|
|
59
|
+
* Only meaningful with `variant="detail"` and without `centeredMain`.
|
|
60
|
+
*/
|
|
61
|
+
stickyAside?: boolean;
|
|
44
62
|
}
|
|
45
63
|
/**
|
|
46
64
|
* MainAsideLayout — main column + optional sidebar in one row.
|
package/package.json
CHANGED
package/src/styles/base.css
CHANGED
|
@@ -72,6 +72,7 @@ html.dark {
|
|
|
72
72
|
--success-hover: 136.58 100% 85.1%;
|
|
73
73
|
--warning: 38 95% 45%;
|
|
74
74
|
--liquidation: 274 67% 48%;
|
|
75
|
+
--liquidation-line: 38 92% 50%;
|
|
75
76
|
--input: 225 10% 88%;
|
|
76
77
|
--ring: 330 100% 50%;
|
|
77
78
|
--radius: 0.75rem;
|
|
@@ -119,6 +120,7 @@ html.dark {
|
|
|
119
120
|
--destructive-foreground: 0 0% 100%;
|
|
120
121
|
--warning: 43.12 100% 68.63%;
|
|
121
122
|
--liquidation: 277.22 74.53% 58.43%;
|
|
123
|
+
--liquidation-line: 38 92% 50%;
|
|
122
124
|
--input: 225 6% 19%;
|
|
123
125
|
--ring: 330 100% 59%;
|
|
124
126
|
--gray-10: 225 5.26% 14.9%;
|
package/src/styles/theme.css
CHANGED
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
--color-success-hover: hsl(var(--success-hover));
|
|
50
50
|
--color-warning: hsl(var(--warning));
|
|
51
51
|
--color-liquidation: hsl(var(--liquidation));
|
|
52
|
+
--color-liquidation-line: hsl(var(--liquidation-line));
|
|
52
53
|
--color-border: hsl(var(--border));
|
|
53
54
|
--color-input: hsl(var(--input));
|
|
54
55
|
--color-ring: hsl(var(--ring));
|