@gearbox-protocol/ui-kit 4.0.0-next.3 → 4.0.0-next.4

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 (79) hide show
  1. package/dist/cjs/components/base/borrow-rate-block/borrow-rate-block.cjs +1 -1
  2. package/dist/cjs/components/base/detailed-page-title/detailed-page-title.cjs +1 -1
  3. package/dist/cjs/components/base/health-factor-block/health-factor-block.cjs +1 -1
  4. package/dist/cjs/components/base/index.cjs +1 -1
  5. package/dist/cjs/components/base/info-list/index.cjs +1 -1
  6. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  7. package/dist/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
  8. package/dist/cjs/components/base/liquidation-price-block/liquidation-price-block.cjs +1 -1
  9. package/dist/cjs/components/base/manage-pane/constants.cjs +1 -1
  10. package/dist/cjs/components/base/manage-pane/manage-pane.cjs +1 -1
  11. package/dist/cjs/components/base/page-title/index.cjs +1 -1
  12. package/dist/cjs/components/base/page-title/page-title.cjs +1 -1
  13. package/dist/cjs/components/base/stat-badge/stat-badge.cjs +1 -1
  14. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  15. package/dist/cjs/components/base/time-to-liquidation-block/time-to-liquidation-block.cjs +1 -1
  16. package/dist/cjs/components/base/token-amount/token-amount.cjs +1 -1
  17. package/dist/cjs/components/base/values/constants.cjs +1 -1
  18. package/dist/cjs/components/base/values/index.cjs +1 -1
  19. package/dist/cjs/components/base/values/points-value.cjs +1 -0
  20. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  21. package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
  22. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  23. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  24. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  25. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +1 -1
  26. package/dist/cjs/components/graph/graph-view.cjs +1 -1
  27. package/dist/cjs/components/index.cjs +1 -1
  28. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  29. package/dist/cjs/index.cjs +1 -1
  30. package/dist/cjs/utils/format-leverage.cjs +1 -0
  31. package/dist/cjs/utils/index.cjs +1 -1
  32. package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
  33. package/dist/esm/components/base/detailed-page-title/detailed-page-title.js +26 -27
  34. package/dist/esm/components/base/health-factor-block/health-factor-block.js +25 -25
  35. package/dist/esm/components/base/index.js +139 -135
  36. package/dist/esm/components/base/info-list/index.js +5 -4
  37. package/dist/esm/components/base/info-list/info-list.js +52 -27
  38. package/dist/esm/components/base/leverage-input/leverage-input.js +17 -19
  39. package/dist/esm/components/base/liquidation-price-block/liquidation-price-block.js +33 -28
  40. package/dist/esm/components/base/manage-pane/constants.js +3 -2
  41. package/dist/esm/components/base/manage-pane/manage-pane.js +154 -113
  42. package/dist/esm/components/base/page-title/index.js +5 -4
  43. package/dist/esm/components/base/page-title/page-title.js +31 -23
  44. package/dist/esm/components/base/stat-badge/stat-badge.js +18 -9
  45. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +3 -2
  46. package/dist/esm/components/base/time-to-liquidation-block/time-to-liquidation-block.js +31 -31
  47. package/dist/esm/components/base/token-amount/token-amount.js +17 -16
  48. package/dist/esm/components/base/values/constants.js +1 -0
  49. package/dist/esm/components/base/values/index.js +16 -14
  50. package/dist/esm/components/base/values/points-value.js +30 -0
  51. package/dist/esm/components/base/values/scalars.js +18 -17
  52. package/dist/esm/components/block-sync-pill/block-sync-pill.js +17 -16
  53. package/dist/esm/components/checkbox/checkbox-labeled.js +15 -14
  54. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +15 -14
  55. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +9 -8
  56. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +24 -23
  57. package/dist/esm/components/graph/graph-view.js +78 -95
  58. package/dist/esm/components/index.js +664 -660
  59. package/dist/esm/components/with-copy/with-copy.js +17 -16
  60. package/dist/esm/index.js +841 -835
  61. package/dist/esm/utils/format-leverage.js +6 -0
  62. package/dist/esm/utils/index.js +80 -78
  63. package/dist/globals.css +1 -1
  64. package/dist/types/components/base/detailed-page-title/detailed-page-title.d.ts +1 -3
  65. package/dist/types/components/base/health-factor-block/health-factor-block.d.ts +6 -6
  66. package/dist/types/components/base/info-list/info-list.d.ts +7 -0
  67. package/dist/types/components/base/liquidation-price-block/liquidation-price-block.d.ts +6 -4
  68. package/dist/types/components/base/manage-pane/constants.d.ts +1 -0
  69. package/dist/types/components/base/manage-pane/manage-pane.d.ts +3 -1
  70. package/dist/types/components/base/page-title/page-title.d.ts +12 -6
  71. package/dist/types/components/base/time-to-liquidation-block/time-to-liquidation-block.d.ts +5 -6
  72. package/dist/types/components/base/token-amount/token-amount.d.ts +8 -2
  73. package/dist/types/components/base/values/constants.d.ts +1 -0
  74. package/dist/types/components/base/values/index.d.ts +1 -0
  75. package/dist/types/components/base/values/points-value.d.ts +11 -0
  76. package/dist/types/components/base/values/position-short-label.d.ts +1 -1
  77. package/dist/types/utils/format-leverage.d.ts +5 -0
  78. package/dist/types/utils/index.d.ts +1 -0
  79. package/package.json +1 -1
@@ -9,8 +9,6 @@ export interface DetailedPageTitleProps {
9
9
  /** Visible heading; a node (e.g. a token-pair title) renders as given. */
10
10
  readonly title: PageTitleText | React.ReactNode;
11
11
  readonly browserTitle?: PageTitleText;
12
- /** Document-head hook forwarded to {@link PageTitle}. */
13
- readonly head?: (browserTitle: string) => React.ReactNode;
14
12
  /**
15
13
  * Token whose icon heads the title. The model `Token` is enough — the icon
16
14
  * is resolved from the symbol inside ui-kit.
@@ -29,4 +27,4 @@ export interface DetailedPageTitleProps {
29
27
  readonly className?: string;
30
28
  }
31
29
  /** Detail screen heading: token icon + title + badges + copy/explorer actions. */
32
- export declare function DetailedPageTitle({ title, browserTitle, head, token, icon, tokenIconSize, disabled, toCopy, explorerLinks, badges, actions, buttonsSlot, meta, actionsPosition, className, }: DetailedPageTitleProps): React.ReactElement;
30
+ export declare function DetailedPageTitle({ title, browserTitle, token, icon, tokenIconSize, disabled, toCopy, explorerLinks, badges, actions, buttonsSlot, meta, actionsPosition, className, }: DetailedPageTitleProps): React.ReactElement;
@@ -1,13 +1,14 @@
1
+ import { Bps } from '@gearbox-protocol/sdk/model';
1
2
  import { default as React } from 'react';
2
3
  import { TitleText } from '../text';
3
4
  import { HFZones } from '../../health-factor';
4
5
  import { HealthFactorBlockTest } from './constants';
5
6
  export { HealthFactorBlockTest };
6
7
  export interface HealthFactorBlockProps {
7
- /** Health factor in basis points (e.g. 15000 = 1.5); omit to render "—". */
8
- readonly hf?: number;
8
+ /** SDK `healthFactor` in basis points (e.g. 15000 = 1.5); omit to render "—". */
9
+ readonly healthFactor?: Bps;
9
10
  /** Target HF after the operation; renders a from → to transition. */
10
- readonly hfTo?: number;
11
+ readonly healthFactorTo?: Bps;
11
12
  /** Debt in base units; a 0n debt renders "N/A". */
12
13
  readonly debt: bigint;
13
14
  /** Debt after the operation (defaults to `debt`). */
@@ -23,7 +24,6 @@ export interface HealthFactorBlockProps {
23
24
  }
24
25
  /**
25
26
  * "Health factor" row of a preview: label + help tip on the left, the zone-
26
- * colored HF (with optional from → to transition) on the right. Design only —
27
- * the reference `HFBlock` markup on bare value props.
27
+ * colored HF (with optional from → to transition) on the right.
28
28
  */
29
- export declare function HealthFactorBlock({ hf, hfTo, debt, debtTo, zone, isLoading, title, tip, testId, }: HealthFactorBlockProps): React.ReactElement;
29
+ export declare function HealthFactorBlock({ healthFactor, healthFactorTo, debt, debtTo, zone, isLoading, title, tip, testId, }: HealthFactorBlockProps): React.ReactElement;
@@ -1,3 +1,4 @@
1
+ import { ApyBreakdown } from '@gearbox-protocol/sdk/model';
1
2
  import { default as React } from 'react';
2
3
  import { TitleText } from '../text';
3
4
  import { InfoListTest } from './constants';
@@ -24,3 +25,9 @@ export interface InfoSectionTitleProps {
24
25
  }
25
26
  /** Uppercase section label inside an `InfoList` (e.g. debt limits). */
26
27
  export declare function InfoSectionTitle({ title, }: InfoSectionTitleProps): React.ReactElement;
28
+ export interface PointsInfoLineProps {
29
+ readonly data: ApyBreakdown | undefined;
30
+ readonly title?: TitleText;
31
+ }
32
+ /** Points row that omits itself when the SDK breakdown has no programs. */
33
+ export declare function PointsInfoLine({ data, title, }: PointsInfoLineProps): React.ReactElement | null;
@@ -1,3 +1,4 @@
1
+ import { Token } from '@gearbox-protocol/sdk/model';
1
2
  import { default as React } from 'react';
2
3
  import { TitleText } from '../text';
3
4
  import { HFZones } from '../../health-factor';
@@ -11,8 +12,10 @@ export interface LiquidationPriceBlockProps {
11
12
  readonly price?: bigint | null;
12
13
  /** Price after the operation; renders a from → to transition. */
13
14
  readonly priceTo?: bigint | null;
14
- /** The pair the price is quoted in, e.g. "WETH / USDC". */
15
- readonly pricePair?: React.ReactNode;
15
+ /** Collateral token of the quoted pair. */
16
+ readonly collateral?: Token | null;
17
+ /** Underlying token of the quoted pair. */
18
+ readonly underlying?: Token;
16
19
  /** Zone dot next to the price. */
17
20
  readonly zone?: HFZones;
18
21
  readonly isLoading?: boolean;
@@ -25,6 +28,5 @@ export interface LiquidationPriceBlockProps {
25
28
  /**
26
29
  * "Liquidation price" row of a preview: label + help tip, the formatted price
27
30
  * (with optional from → to and zone dot), and the price pair underneath.
28
- * Design only — the reference `LiquidationPriceBlock` markup on value props.
29
31
  */
30
- export declare function LiquidationPriceBlock({ price, priceTo, pricePair, zone, isLoading, title, tip, testId, }: LiquidationPriceBlockProps): React.ReactElement;
32
+ export declare function LiquidationPriceBlock({ price, priceTo, collateral, underlying, zone, isLoading, title, tip, testId, }: LiquidationPriceBlockProps): React.ReactElement;
@@ -4,5 +4,6 @@ export declare class ManagePaneTest {
4
4
  static dropdown: string;
5
5
  static body: string;
6
6
  static message: string;
7
+ static actionDialog: string;
7
8
  static tab: (id: string) => string;
8
9
  }
@@ -24,7 +24,9 @@ export interface ManagePaneActionTabProps {
24
24
  readonly id: string;
25
25
  readonly title: TitleText;
26
26
  /** Fires without changing the active tab (e.g. "My positions"). */
27
- readonly onClick: () => void;
27
+ readonly onClick?: () => void;
28
+ /** When set, a click opens this content in a dialog instead of switching tabs. */
29
+ readonly children?: React.ReactNode;
28
30
  }
29
31
  export declare function ManagePaneActionTab(_props: ManagePaneActionTabProps): null;
30
32
  export interface ManagePaneProps {
@@ -3,6 +3,17 @@ import { FormatMessageTypedProps } from '../../typed-intl';
3
3
  import { PageTitleTest } from './constants';
4
4
  export { PageTitleTest };
5
5
  export type PageTitleText = FormatMessageTypedProps | string;
6
+ export interface PageHeadProviderProps {
7
+ readonly children: React.ReactNode;
8
+ /** Renders the document head for a resolved browser title (e.g. a Helmet node). */
9
+ readonly render: (browserTitle: string) => React.ReactNode;
10
+ }
11
+ /**
12
+ * Optional document-head hook for {@link PageTitle}. Without a provider the
13
+ * visible heading still renders and `<head>` is left alone — ui-kit does not
14
+ * import a head library.
15
+ */
16
+ export declare function PageHeadProvider({ children, render, }: PageHeadProviderProps): React.ReactElement;
6
17
  export interface PageTitleProps {
7
18
  /** Visible heading; a node (e.g. a token-pair title) renders as given. */
8
19
  readonly title: PageTitleText | React.ReactNode;
@@ -11,13 +22,8 @@ export interface PageTitleProps {
11
22
  * Required when {@link title} is a node — a node cannot become a string.
12
23
  */
13
24
  readonly browserTitle?: PageTitleText;
14
- /**
15
- * Renders the document head for the resolved browser title (e.g. a Helmet
16
- * element). The app owns the head library; ui-kit only hands over the string.
17
- */
18
- readonly head?: (browserTitle: string) => React.ReactNode;
19
25
  readonly as?: "h1" | "h2" | "h3" | "span";
20
26
  readonly className?: string;
21
27
  }
22
28
  /** The one visible page heading, plus an optional document-head hook. */
23
- export declare function PageTitle({ title, browserTitle, head, as, className, }: PageTitleProps): React.ReactElement;
29
+ export declare function PageTitle({ title, browserTitle, as, className, }: PageTitleProps): React.ReactElement;
@@ -5,12 +5,12 @@ import { TimeToLiquidationBlockTest } from './constants';
5
5
  export { TimeToLiquidationBlockTest };
6
6
  export interface TimeToLiquidationBlockProps {
7
7
  /**
8
- * Time to liquidation in seconds; `null` renders "N/A", omit to render "—"
9
- * (value not available).
8
+ * SDK `timeToLiquidation` in milliseconds; `null` renders "N/A", omit to
9
+ * render "—" (value not available).
10
10
  */
11
- readonly seconds?: number | null;
11
+ readonly data?: bigint | null;
12
12
  /** Time after the operation; renders a from → to transition. */
13
- readonly secondsTo?: number | null;
13
+ readonly dataTo?: bigint | null;
14
14
  /** Pre-computed zone; if not set, derived from the value. */
15
15
  readonly zone?: TTLZones;
16
16
  readonly isLoading?: boolean;
@@ -23,6 +23,5 @@ export interface TimeToLiquidationBlockProps {
23
23
  /**
24
24
  * "Time to liquidation" row of a preview: label + help tip, the remaining
25
25
  * time as `Nmo` / `Nd` / `<1d` with a zone dot, optionally from → to.
26
- * Design only — the reference `TimeToLiquidationBlock` markup on value props.
27
26
  */
28
- export declare function TimeToLiquidationBlock({ seconds, secondsTo, zone, isLoading, title, tip, testId, }: TimeToLiquidationBlockProps): React.ReactElement;
27
+ export declare function TimeToLiquidationBlock({ data, dataTo, zone, isLoading, title, tip, testId, }: TimeToLiquidationBlockProps): React.ReactElement;
@@ -1,7 +1,9 @@
1
1
  import { Amount, Token, TokenAmount as TokenAmountModel } from '@gearbox-protocol/sdk/model';
2
2
  import { default as React } from 'react';
3
+ import { StackAlign } from '../stack';
3
4
  import { TokenAmountTest } from './constants';
4
5
  export { TokenAmountTest };
6
+ export type TokenAmountAlign = Extract<StackAlign, "start" | "end">;
5
7
  /**
6
8
  * An amount of a token, with its USD value underneath.
7
9
  *
@@ -10,7 +12,7 @@ export { TokenAmountTest };
10
12
  * `totalSupply` / `totalBorrow`, implicitly in the market underlying) name their
11
13
  * token alongside.
12
14
  */
13
- export type TokenAmountProps = {
15
+ type TokenAmountDataProps = {
14
16
  /** `null` means unavailable and renders an em-dash. */
15
17
  readonly data: TokenAmountModel | null;
16
18
  readonly token?: undefined;
@@ -18,4 +20,8 @@ export type TokenAmountProps = {
18
20
  readonly data: Amount | null;
19
21
  readonly token: Token;
20
22
  };
21
- export declare function TokenAmount({ data, token, }: TokenAmountProps): React.ReactElement;
23
+ export type TokenAmountProps = TokenAmountDataProps & {
24
+ /** Cross-axis alignment of the token line and the USD caption. */
25
+ readonly align?: TokenAmountAlign;
26
+ };
27
+ export declare function TokenAmount({ data, token, align, }: TokenAmountProps): React.ReactElement;
@@ -6,6 +6,7 @@ export declare class ValueTest {
6
6
  static healthFactor: string;
7
7
  static pnl: string;
8
8
  static tokenBigint: string;
9
+ static points: string;
9
10
  static placeholder: string;
10
11
  }
11
12
  export declare class PositionShortLabelTest {
@@ -1,5 +1,6 @@
1
1
  export { ValueTest } from './constants';
2
2
  export { PnlValue } from './pnl-value';
3
+ export { PointsValue, type PointsValueProps } from './points-value';
3
4
  export { PositionShortLabel, PositionShortLabelTest, } from './position-short-label';
4
5
  export { PositionTypeBadge, type PositionTypeBadgeProps, } from './position-type-badge';
5
6
  export { ApyValue, type ApyValueProps, bps, HealthFactorValue, LeverageValue, TokenBigint, UsdValue, UtilizationValue, } from './scalars';
@@ -0,0 +1,11 @@
1
+ import { ApyBreakdown } from '@gearbox-protocol/sdk/model';
2
+ import { default as React } from 'react';
3
+ export interface PointsValueProps {
4
+ /** SDK APY breakdown; `undefined` or no point programs render nothing. */
5
+ readonly data: ApyBreakdown | undefined;
6
+ }
7
+ /**
8
+ * Point programs attached to an APY breakdown: icon + name for each program.
9
+ * Returns `null` when the SDK has none.
10
+ */
11
+ export declare function PointsValue({ data, }: PointsValueProps): React.ReactElement | null;
@@ -2,7 +2,7 @@ import { StrategyPosition } from '@gearbox-protocol/sdk/model';
2
2
  import { default as React } from 'react';
3
3
  import { PositionShortLabelTest } from './constants';
4
4
  export { PositionShortLabelTest };
5
- /** "wstETH / WETH · 2.5x" — one open position, in a menu row. */
5
+ /** "wstETH / WETH · 2.50x" — one open position, in a menu row. */
6
6
  export declare function PositionShortLabel({ data, }: {
7
7
  readonly data: StrategyPosition;
8
8
  }): React.ReactElement;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Display leverage with two decimal places, e.g. `5.79` for `5.7857…`.
3
+ * The suffix (`x`) / prefix (`×`) stays at the call site.
4
+ */
5
+ export declare function formatLeverage(value: number): string;
@@ -9,6 +9,7 @@ export * from './colors';
9
9
  export * from './copy';
10
10
  export * from './format';
11
11
  export * from './format-asset-amount';
12
+ export * from './format-leverage';
12
13
  export { formatMoney, formatMoneyAmount, formatPercentAmount, percentageTemplate, percentTemplate, } from './format-money';
13
14
  export { FORMAT_CONSTANTS, type FormatNumberOptions, formatNumberWithSuffix, formatPrice, getAdaptiveDecimals, isBelowDisplayThreshold, isEffectivelyZero, toSignificantDigits, } from './format-number';
14
15
  export * from './format-slippage';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.3",
3
+ "version": "4.0.0-next.4",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",