@gearbox-protocol/ui-kit 4.0.0-next.29 → 4.0.0-next.30
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/base/leverage-input/leverage-input.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/slider/constants.cjs +1 -0
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/slider-track.cjs +1 -1
- package/dist/cjs/components/slider/slider-utils.cjs +1 -1
- package/dist/cjs/components/slider/slider.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/base/leverage-input/leverage-input.js +10 -12
- package/dist/esm/components/index.js +199 -196
- package/dist/esm/components/slider/constants.js +6 -0
- package/dist/esm/components/slider/index.js +29 -26
- package/dist/esm/components/slider/slider-track.js +19 -17
- package/dist/esm/components/slider/slider-utils.js +37 -20
- package/dist/esm/components/slider/slider.js +53 -51
- package/dist/esm/index.js +450 -447
- package/dist/types/components/base/leverage-input/leverage-input.d.ts +4 -2
- package/dist/types/components/slider/constants.d.ts +3 -0
- package/dist/types/components/slider/index.d.ts +1 -0
- package/dist/types/components/slider/slider-utils.d.ts +27 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -25,8 +25,10 @@ export interface LeverageInputProps {
|
|
|
25
25
|
/** When set, renders a "Reset" button with a tooltip next to the value. */
|
|
26
26
|
readonly reset?: LeverageInputResetProps;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* The reachable leverages, in leverage units (e.g. `{start: 1, end: 3}`),
|
|
29
|
+
* scaled to the slider's integer space internally. Omitted or empty leaves
|
|
30
|
+
* the track unmarked — which is what an unknown range looks like, not a
|
|
31
|
+
* full one.
|
|
30
32
|
*/
|
|
31
33
|
readonly colorIntervals?: ReadonlyArray<ColorInterval>;
|
|
32
34
|
/** Label of the highlighted interval range under the slider. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ColorInterval } from '../../utils/ranges';
|
|
1
2
|
export type { Decimals } from '../../utils/math';
|
|
2
3
|
export { decimalsToStep, findClosestPoint, formatWithDecimals, formatWithoutDecimals, splitInterval, validateMinMax, } from '../../utils/math';
|
|
3
4
|
export interface MarkerPoint {
|
|
@@ -7,3 +8,29 @@ export interface MarkerPoint {
|
|
|
7
8
|
export type MarkerStep = 1 | 10 | 100 | 200;
|
|
8
9
|
export declare function validateMarkerPoints(value: MarkerPoint[], min: number, max: number): MarkerPoint[];
|
|
9
10
|
export declare function makeMarkerPoints(min: number, max: number, decimals: number, precision: number, markerStep: number): MarkerPoint[];
|
|
11
|
+
export interface ResolveSnapProps {
|
|
12
|
+
/** Interval edges the handle should stick to. */
|
|
13
|
+
readonly snapPoints: readonly number[];
|
|
14
|
+
/** The intervals those edges came from. */
|
|
15
|
+
readonly intervals: readonly ColorInterval[] | undefined;
|
|
16
|
+
/** How far from a point the handle still snaps to it. */
|
|
17
|
+
readonly epsilon: number;
|
|
18
|
+
readonly decimals: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Where the handle lands: the value itself, or a point it is close enough to
|
|
22
|
+
* stick to.
|
|
23
|
+
*
|
|
24
|
+
* `findClosestPoint` offers the nearest whole number alongside the interval
|
|
25
|
+
* edges and takes whichever is nearer. On its own that is right — a slider
|
|
26
|
+
* without intervals should stick to round numbers. But an edge is the one
|
|
27
|
+
* place a value stops being valid, and a whole number a hundredth nearer wins
|
|
28
|
+
* the comparison and parks the handle just past it. So an edge **within
|
|
29
|
+
* `epsilon`** takes precedence, unless the whole number sits inside an
|
|
30
|
+
* interval anyway and is therefore somewhere the handle may legitimately rest.
|
|
31
|
+
*
|
|
32
|
+
* Note what this does not promise: a value with a whole number in reach but no
|
|
33
|
+
* edge in reach still snaps to that whole number, wherever it falls. Reaching
|
|
34
|
+
* further would drag the handle across a track it was never dragged near.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveSnap(value: number, { snapPoints, intervals, epsilon, decimals }: ResolveSnapProps): number;
|
|
@@ -20,7 +20,7 @@ export * from './math';
|
|
|
20
20
|
export * from './network-icons';
|
|
21
21
|
export * from './parse-input-to-bn';
|
|
22
22
|
export * from './plural';
|
|
23
|
-
export { getAvailableRanges } from './ranges';
|
|
23
|
+
export { type ColorInterval, getAvailableRanges } from './ranges';
|
|
24
24
|
export * from './react';
|
|
25
25
|
export * from './search';
|
|
26
26
|
export * from './search-in-token';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/ui-kit",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.30",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"@commitlint/cli": "^20.1.0",
|
|
116
116
|
"@commitlint/config-conventional": "^20.0.0",
|
|
117
117
|
"@gearbox-protocol/biome-config": "^1.0.2",
|
|
118
|
-
"@gearbox-protocol/sdk": "16.0.0-next.
|
|
118
|
+
"@gearbox-protocol/sdk": "16.0.0-next.10",
|
|
119
119
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
120
120
|
"@storybook/addon-a11y": "^10.0.8",
|
|
121
121
|
"@storybook/addon-docs": "^10.0.8",
|