@gearbox-protocol/ui-kit 4.0.0-next.43 → 4.0.0-next.45

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 (68) hide show
  1. package/dist/cjs/components/base/borrow-rate-block/borrow-rate-block.cjs +1 -1
  2. package/dist/cjs/components/base/index.cjs +1 -1
  3. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  4. package/dist/cjs/components/base/liquidation-price-block/liquidation-price-block.cjs +1 -1
  5. package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
  6. package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -1
  7. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  8. package/dist/cjs/components/base/time-to-liquidation-block/time-to-liquidation-block.cjs +1 -1
  9. package/dist/cjs/components/base/token-amount/token-amount.cjs +1 -1
  10. package/dist/cjs/components/base/values/constants.cjs +1 -1
  11. package/dist/cjs/components/base/values/index.cjs +1 -1
  12. package/dist/cjs/components/base/values/no-value.cjs +1 -0
  13. package/dist/cjs/components/base/values/pnl-value.cjs +1 -1
  14. package/dist/cjs/components/base/values/price-impact-value.cjs +1 -1
  15. package/dist/cjs/components/base/values/scalars.cjs +1 -1
  16. package/dist/cjs/components/base-table/base-table-line.cjs +1 -1
  17. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  18. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  19. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  20. package/dist/cjs/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.cjs +1 -1
  21. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  22. package/dist/cjs/components/help-tip/help-tip.cjs +1 -1
  23. package/dist/cjs/components/index.cjs +1 -1
  24. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  25. package/dist/cjs/index.cjs +1 -1
  26. package/dist/cjs/locale/en.json.cjs +1 -1
  27. package/dist/cjs/utils/format.cjs +1 -1
  28. package/dist/cjs/utils/index.cjs +1 -1
  29. package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
  30. package/dist/esm/components/base/index.js +63 -61
  31. package/dist/esm/components/base/info-list/info-list.js +8 -7
  32. package/dist/esm/components/base/liquidation-price-block/liquidation-price-block.js +46 -38
  33. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +74 -61
  34. package/dist/esm/components/base/position-assets/position-assets.js +45 -41
  35. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +86 -74
  36. package/dist/esm/components/base/time-to-liquidation-block/time-to-liquidation-block.js +40 -32
  37. package/dist/esm/components/base/token-amount/token-amount.js +32 -16
  38. package/dist/esm/components/base/values/constants.js +1 -0
  39. package/dist/esm/components/base/values/index.js +21 -19
  40. package/dist/esm/components/base/values/no-value.js +34 -0
  41. package/dist/esm/components/base/values/pnl-value.js +10 -9
  42. package/dist/esm/components/base/values/price-impact-value.js +6 -5
  43. package/dist/esm/components/base/values/scalars.js +23 -26
  44. package/dist/esm/components/base-table/base-table-line.js +44 -36
  45. package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
  46. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
  47. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +47 -46
  48. package/dist/esm/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js +26 -25
  49. package/dist/esm/components/compound-apy/compound-apy.js +48 -40
  50. package/dist/esm/components/help-tip/help-tip.js +64 -59
  51. package/dist/esm/components/index.js +624 -622
  52. package/dist/esm/components/with-copy/with-copy.js +1 -1
  53. package/dist/esm/index.js +814 -811
  54. package/dist/esm/locale/en.json.js +1 -0
  55. package/dist/esm/utils/format.js +14 -12
  56. package/dist/esm/utils/index.js +76 -75
  57. package/dist/globals.css +1 -1
  58. package/dist/types/components/base/apy-breakdown-body/apy-breakdown-body.d.ts +4 -3
  59. package/dist/types/components/base/liquidation-price-block/liquidation-price-block.d.ts +8 -1
  60. package/dist/types/components/base/position-assets/position-assets.d.ts +7 -1
  61. package/dist/types/components/base/time-to-liquidation-block/time-to-liquidation-block.d.ts +8 -1
  62. package/dist/types/components/base/values/constants.d.ts +1 -0
  63. package/dist/types/components/base/values/index.d.ts +1 -0
  64. package/dist/types/components/base/values/no-value.d.ts +25 -0
  65. package/dist/types/components/base/values/scalars.d.ts +7 -2
  66. package/dist/types/locale/en.json.d.ts +1 -0
  67. package/dist/types/utils/format.d.ts +8 -0
  68. package/package.json +1 -1
@@ -16,8 +16,8 @@ export declare function formatBreakdownRate(value: Bps): string;
16
16
  export interface ApyBreakdownBodyProps {
17
17
  /** Heading to the left of the chip — "Net APY (7d)" and the like. */
18
18
  readonly title: React.ReactNode;
19
- /** The figure the chip prints. */
20
- readonly chip: string;
19
+ /** The figure the chip prints, or {@link NoValue} when there is none. */
20
+ readonly chip: React.ReactNode;
21
21
  /** Green chip when the net is positive; muted otherwise. */
22
22
  readonly chipPositive?: boolean;
23
23
  readonly chipTestId?: string;
@@ -31,7 +31,8 @@ export interface ApyBreakdownBodyProps {
31
31
  export declare function ApyBreakdownBody({ title, chip, chipPositive, chipTestId, children, testId, }: ApyBreakdownBodyProps): React.ReactElement;
32
32
  export interface ApyBreakdownRowProps {
33
33
  readonly label: React.ReactNode;
34
- readonly value: string;
34
+ /** The rate, or {@link NoValue} when the feed has none. */
35
+ readonly value: React.ReactNode;
35
36
  readonly subtext?: React.ReactNode;
36
37
  readonly muted?: boolean;
37
38
  readonly testId?: string;
@@ -16,6 +16,13 @@ export interface LiquidationPriceBlockProps {
16
16
  readonly collateral?: Token | null;
17
17
  /** Underlying token of the quoted pair. */
18
18
  readonly underlying?: Token;
19
+ /**
20
+ * Prefixes the figure with {@link APPROXIMATE_SYMBOL}. For a projection the
21
+ * operation cannot promise exactly — a routed leg the market can move under.
22
+ * Both columns are marked when the row renders `from → to`: the "from" of a
23
+ * projected pair is projected too.
24
+ */
25
+ readonly approximate?: boolean;
19
26
  /** Zone dot next to the price. */
20
27
  readonly zone?: HFZones;
21
28
  readonly isLoading?: boolean;
@@ -29,4 +36,4 @@ export interface LiquidationPriceBlockProps {
29
36
  * "Liquidation price" row of a preview: label + help tip, the formatted price
30
37
  * (with optional from → to and zone dot), and the price pair underneath.
31
38
  */
32
- export declare function LiquidationPriceBlock({ price, priceTo, collateral, underlying, zone, isLoading, title, tip, testId, }: LiquidationPriceBlockProps): React.ReactElement;
39
+ export declare function LiquidationPriceBlock({ price, priceTo, collateral, underlying, approximate, zone, isLoading, title, tip, testId, }: LiquidationPriceBlockProps): React.ReactElement;
@@ -12,6 +12,12 @@ export interface PositionAssetsProps {
12
12
  readonly to?: readonly TokenAmount[];
13
13
  /** Rendered in place of the rows when nothing survives the dust filter. */
14
14
  readonly empty?: React.ReactNode;
15
+ /**
16
+ * Prefixes the projected amount with {@link APPROXIMATE_SYMBOL} — the "after"
17
+ * of a pair, or the only column when the list itself is a projection. The
18
+ * struck "before" is never marked: it is what the account holds now.
19
+ */
20
+ readonly approximate?: boolean;
15
21
  readonly testId?: string;
16
22
  }
17
23
  /**
@@ -34,7 +40,7 @@ export interface PositionAssetsProps {
34
40
  * rounding, and listing them buries the holdings that matter. A token the
35
41
  * oracle cannot price is never dust — an unknown value is not a small one.
36
42
  */
37
- export declare function PositionAssets({ assets, to, empty, testId, }: PositionAssetsProps): React.ReactElement;
43
+ export declare function PositionAssets({ assets, to, empty, approximate, testId, }: PositionAssetsProps): React.ReactElement;
38
44
  /** One token across both sides of a change. */
39
45
  export interface AssetRow {
40
46
  readonly token: TokenAmount["token"];
@@ -11,6 +11,13 @@ export interface TimeToLiquidationBlockProps {
11
11
  readonly data?: bigint | null;
12
12
  /** Time after the operation; renders a from → to transition. */
13
13
  readonly dataTo?: bigint | null;
14
+ /**
15
+ * Prefixes the figure with {@link APPROXIMATE_SYMBOL}. For a projection the
16
+ * operation cannot promise exactly — a routed leg the market can move under.
17
+ * Both columns are marked when the row renders `from → to`: the "from" of a
18
+ * projected pair is projected too.
19
+ */
20
+ readonly approximate?: boolean;
14
21
  /** Pre-computed zone; if not set, derived from the value. */
15
22
  readonly zone?: TTLZones;
16
23
  readonly isLoading?: boolean;
@@ -24,4 +31,4 @@ export interface TimeToLiquidationBlockProps {
24
31
  * "Time to liquidation" row of a preview: label + help tip, the remaining
25
32
  * time as `Nmo` / `Nd` / `<1d` with a zone dot, optionally from → to.
26
33
  */
27
- export declare function TimeToLiquidationBlock({ data, dataTo, zone, isLoading, title, tip, testId, }: TimeToLiquidationBlockProps): React.ReactElement;
34
+ export declare function TimeToLiquidationBlock({ data, dataTo, approximate, zone, isLoading, title, tip, testId, }: TimeToLiquidationBlockProps): React.ReactElement;
@@ -9,6 +9,7 @@ export declare class ValueTest {
9
9
  static tokenBigint: string;
10
10
  static points: string;
11
11
  static placeholder: string;
12
+ static accruing: string;
12
13
  }
13
14
  export declare class PositionShortLabelTest {
14
15
  static root: string;
@@ -1,4 +1,5 @@
1
1
  export { ValueTest } from './constants';
2
+ export { NoValue, type NoValueProps } from './no-value';
2
3
  export { PnlValue } from './pnl-value';
3
4
  export { PointsValue, type PointsValueProps } from './points-value';
4
5
  export { PositionShortLabel, PositionShortLabelTest, } from './position-short-label';
@@ -0,0 +1,25 @@
1
+ import { default as React } from 'react';
2
+ export interface NoValueProps {
3
+ /**
4
+ * Why the figure is absent, when the absence has an explanation worth
5
+ * giving. `"7d"` — the trailing seven-day average has not been computed yet
6
+ * — is the only one so far; anything else, including a spot figure that is
7
+ * simply not there, keeps the dash.
8
+ */
9
+ readonly reason?: "7d";
10
+ }
11
+ /**
12
+ * Whatever stands where a figure would be.
13
+ *
14
+ * One component rather than a dash per call site, so no two surfaces can
15
+ * quietly disagree about what an absent value looks like — and so an absence
16
+ * that has an explanation carries it everywhere at once rather than wherever
17
+ * someone remembered to add it.
18
+ *
19
+ * The explained form is deliberately not a skeleton: a skeleton promises the
20
+ * value in a moment, and this one waits on days of history.
21
+ *
22
+ * The visually-hidden copy is load-bearing — `HelpTipIcon` is `aria-hidden`,
23
+ * so without it the cell would reach a screen reader as nothing at all.
24
+ */
25
+ export declare function NoValue({ reason }: NoValueProps): React.ReactElement;
@@ -10,7 +10,7 @@ import { default as React } from 'react';
10
10
  */
11
11
  export declare function bps(value: Bps): string;
12
12
  export interface ApyValueProps {
13
- /** A breakdown (tooltip-able) or a bare rate; `undefined` renders a dash. */
13
+ /** A breakdown (tooltip-able) or a bare rate; `undefined` renders the empty state. */
14
14
  readonly data: ApyBreakdown | Bps | undefined;
15
15
  /**
16
16
  * Whether a breakdown carries its yield tooltip on hover. Off where the
@@ -22,7 +22,12 @@ export interface ApyValueProps {
22
22
  * @default true
23
23
  */
24
24
  readonly tooltip?: boolean;
25
- /** When `"7d"`, the breakdown tooltip labels carry the averaging-window suffix. */
25
+ /**
26
+ * The averaging window this figure comes from. `"7d"` suffixes the breakdown
27
+ * tooltip labels — and, when the rate is missing, says the average is still
28
+ * accruing rather than printing a dash. A spot figure keeps the dash: history
29
+ * has nothing to do with why it is absent.
30
+ */
26
31
  readonly period?: "7d";
27
32
  }
28
33
  /**
@@ -60,6 +60,7 @@ declare const _default: {
60
60
  "components.filterModal.reset": "Reset",
61
61
  "components.filterModal.apply": "Apply",
62
62
 
63
+ "components.value.accruing": "Averaged data is still being computed and will be available shortly.",
63
64
  "components.APY.tip": "These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.",
64
65
 
65
66
  "components.creditSessionDetailedLiquidation.graph.noData": "No data",
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Marks a figure as an estimate rather than a promise: a routed amount that
3
+ * slippage can move, a projection quoted at prices that will have drifted by
4
+ * the time the transaction lands.
5
+ *
6
+ * Declared once so every screen that hedges a number hedges it the same way.
7
+ **/
8
+ export declare const APPROXIMATE_SYMBOL = "\u2248";
1
9
  export declare function formatBytecodeSize(size: number): string;
2
10
  export declare function formatBytecodeVersion(version: number): string;
3
11
  export declare function formatTimestamp(timestamp: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.43",
3
+ "version": "4.0.0-next.45",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",