@gitkraken/gitkraken-components 13.0.0-vnext.34 → 13.0.0-vnext.36

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.
@@ -46,6 +46,7 @@ declare class RowAdornmentLayer extends React.Component<RowAdornmentLayerProps,
46
46
  private applyProvideResults;
47
47
  private evictDistantAdornments;
48
48
  private shouldShowAdornment;
49
+ private stateKey;
49
50
  private getOrResolveContent;
50
51
  render(): React.ReactNode;
51
52
  }
@@ -7,6 +7,15 @@ import type { ReadonlyGraphRow } from '../GraphTypes';
7
7
  * - Array of triggers = visible when ANY of the specified triggers are active
8
8
  */
9
9
  export type AdornmentVisibility = true | readonly ('hover' | 'focus' | 'selected')[];
10
+ /**
11
+ * Live interaction state for a row, passed to resolveAdornment so the adornment
12
+ * content can vary by state (e.g. compact at rest, expanded on hover).
13
+ */
14
+ export interface AdornmentState {
15
+ isHovered: boolean;
16
+ isFocused: boolean;
17
+ isSelected: boolean;
18
+ }
10
19
  /**
11
20
  * Adornment configuration returned from provideAdornments for each row.
12
21
  * @template TContext - Type of context data passed from provide to resolve
@@ -20,11 +29,13 @@ export interface RowAdornment<TContext = unknown> {
20
29
  */
21
30
  context?: TContext;
22
31
  /**
23
- * If true, resolve() is called on every render (content not cached).
24
- * Use for adornments whose content depends on external state.
25
- * Default: false (content is cached until invalidated)
32
+ * Controls when resolve() is re-called:
33
+ * - false (default): content is cached until invalidated
34
+ * - true: resolve() is called on every render (content not cached)
35
+ * - 'interaction': resolve() is re-called when the row's hover/focus/selected state changes
36
+ * (content cached per interaction state). Use for adornments whose UI varies by state.
26
37
  */
27
- dynamic?: boolean;
38
+ dynamic?: boolean | 'interaction';
28
39
  }
29
40
  /**
30
41
  * Invalidation level
@@ -76,9 +87,10 @@ export interface RowAdornmentProvider<TContext = unknown> {
76
87
  *
77
88
  * @param row - The row to render adornment for
78
89
  * @param context - Context data from provideAdornments (if any)
90
+ * @param state - Current interaction state (hover/focus/selected) of the row, when available
79
91
  * @returns Content to render, or null/Promise for no/pending content
80
92
  */
81
- resolveAdornment(row: ReadonlyGraphRow, context?: TContext): ReactNode | null | Promise<ReactNode | null>;
93
+ resolveAdornment(row: ReadonlyGraphRow, context?: TContext, state?: AdornmentState): ReactNode | null | Promise<ReactNode | null>;
82
94
  /**
83
95
  * EventTarget for invalidation.
84
96
  * - Graph subscribes to 'invalidate' events
@@ -91,7 +103,8 @@ export interface RowAdornmentProvider<TContext = unknown> {
91
103
  */
92
104
  export interface CachedAdornment {
93
105
  visibility: AdornmentVisibility;
94
- dynamic: boolean;
106
+ dynamic: boolean | 'interaction';
95
107
  context?: unknown;
96
108
  content?: ReactNode;
109
+ contentStateKey?: string;
97
110
  }