@onekeyfe/react-native-native-list 6.7.0-2 → 6.7.0-20

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 (144) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +245 -9
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +29 -3
  5. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  6. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  7. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +87 -7
  8. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +193 -10
  9. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +147 -33
  10. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +145 -2
  12. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +51 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  14. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  16. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  17. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  18. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1920 -109
  19. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +29 -0
  20. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  21. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  22. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  23. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  24. package/docs/ROW_TEMPLATES.md +60 -9
  25. package/docs/SPEC.md +1004 -17
  26. package/docs/STYLE_SPEC.md +6 -0
  27. package/ios/HybridNativeList.swift +21 -2
  28. package/ios/NativeListAccessoryStack.swift +235 -39
  29. package/ios/NativeListActivityDetailsView.swift +18 -8
  30. package/ios/NativeListActivityRenderer.swift +8 -2
  31. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  32. package/ios/NativeListDataRowRenderer.swift +155 -27
  33. package/ios/NativeListDesignAssets.swift +9 -0
  34. package/ios/NativeListIdentityRenderer.swift +191 -30
  35. package/ios/NativeListLeadingVisual.swift +119 -22
  36. package/ios/NativeListMessageRenderer.swift +34 -1
  37. package/ios/NativeListModels.swift +42 -2
  38. package/ios/NativeListRendererRegistry.swift +1 -0
  39. package/ios/NativeListResolvedText.swift +2 -1
  40. package/ios/NativeListRowHost.swift +14 -0
  41. package/ios/NativeListSectionHeaderRenderer.swift +88 -0
  42. package/ios/RNCNativeListView.swift +1031 -55
  43. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
  44. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
  45. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +1 -0
  46. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +1 -0
  47. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +1 -0
  48. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +1 -0
  49. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
  50. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
  51. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +1 -0
  52. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +1 -0
  53. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
  54. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
  55. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +1 -0
  56. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +1 -0
  57. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +1 -0
  58. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +1 -0
  59. package/ios/tests/NativeListAccessoryStackTests.swift +89 -0
  60. package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
  61. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  62. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  63. package/ios/tests/NativeListLifecycleTests.swift +2720 -3
  64. package/lib/module/NativeList.js +200 -32
  65. package/lib/module/NativeList.web.js +262 -32
  66. package/lib/module/index.js +1 -1
  67. package/lib/module/models.js +1 -0
  68. package/lib/module/selection.js +1 -1
  69. package/lib/module/validation.js +776 -52
  70. package/lib/module/web/NativeListWebEngine.js +919 -79
  71. package/lib/module/web/templates/ActivityRowRenderer.js +487 -7
  72. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  73. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  74. package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
  75. package/lib/module/web/templates/MarketRowRenderer.js +8 -3
  76. package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
  77. package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
  78. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  79. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  80. package/lib/module/web/templates/RowRendererRegistry.js +8 -3
  81. package/lib/module/web/templates/SectionHeaderRowRenderer.js +70 -3
  82. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  83. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  84. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  85. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  86. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  87. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  88. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  89. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  90. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  91. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  92. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  93. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  94. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  95. package/lib/typescript/src/NativeList.d.ts +3 -3
  96. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  97. package/lib/typescript/src/NativeList.types.d.ts +29 -1
  98. package/lib/typescript/src/NativeList.web.d.ts +2 -2
  99. package/lib/typescript/src/index.d.ts +2 -2
  100. package/lib/typescript/src/models.d.ts +176 -10
  101. package/lib/typescript/src/validation.d.ts +15 -0
  102. package/lib/typescript/src/web/NativeListWebEngine.d.ts +58 -1
  103. package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
  104. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  105. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  106. package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
  107. package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
  108. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +10 -4
  109. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
  110. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  111. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  112. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  114. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  115. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  116. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  117. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  118. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  120. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  121. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  122. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  123. package/package.json +3 -3
  124. package/react-native-native-list.podspec +1 -0
  125. package/src/NativeList.nitro.ts +2 -0
  126. package/src/NativeList.tsx +391 -82
  127. package/src/NativeList.types.ts +34 -1
  128. package/src/NativeList.web.tsx +420 -65
  129. package/src/index.ts +2 -0
  130. package/src/models.ts +210 -3
  131. package/src/selection.ts +1 -0
  132. package/src/validation.ts +1635 -76
  133. package/src/web/NativeListWebEngine.ts +1476 -112
  134. package/src/web/templates/ActivityRowRenderer.ts +732 -8
  135. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  136. package/src/web/templates/DataRowRenderer.ts +93 -20
  137. package/src/web/templates/IdentityRowRenderer.ts +150 -5
  138. package/src/web/templates/MarketRowRenderer.ts +19 -3
  139. package/src/web/templates/MarketTableRowRenderer.ts +755 -0
  140. package/src/web/templates/MediaTileRowRenderer.ts +313 -5
  141. package/src/web/templates/MessageRowRenderer.ts +23 -7
  142. package/src/web/templates/RowContainerStyle.ts +2 -0
  143. package/src/web/templates/RowRendererRegistry.ts +21 -6
  144. package/src/web/templates/SectionHeaderRowRenderer.ts +89 -5
@@ -0,0 +1,58 @@
1
+ import type { ButtonGroupRow } from '../../models';
2
+ import { markActionAnchorSource } from './RowElements';
3
+ import type { RowPrimitives } from './RowVisual';
4
+
5
+ function bind(body: HTMLElement, row: ButtonGroupRow) {
6
+ body.replaceChildren();
7
+ body.className = 'ok-native-list-row ok-native-list-button-group';
8
+ body.removeAttribute('data-nl-container-background');
9
+ body.removeAttribute('data-nl-container-border');
10
+ row.buttons.forEach((descriptor, index) => {
11
+ const button = body.ownerDocument.createElement('button');
12
+ button.type = 'button';
13
+ button.className = 'ok-native-list-block-button';
14
+ button.dataset.nativeListAction = descriptor.actionKey;
15
+ button.dataset.nlButtonKey = descriptor.key;
16
+ button.dataset.nlSlot = `button-${index}`;
17
+ if (descriptor.testID) button.dataset.testid = descriptor.testID;
18
+ button.setAttribute(
19
+ 'aria-label',
20
+ descriptor.accessibilityLabel ?? descriptor.label
21
+ );
22
+ button.disabled = Boolean(
23
+ row.disabled || descriptor.disabled || descriptor.loading
24
+ );
25
+ button.setAttribute('aria-busy', descriptor.loading ? 'true' : 'false');
26
+ markActionAnchorSource(button, 'buttonGroup', index);
27
+ const label = body.ownerDocument.createElement('span');
28
+ label.textContent = descriptor.label;
29
+ if (descriptor.loading) {
30
+ const spinner = body.ownerDocument.createElement('span');
31
+ spinner.className = 'ok-native-list-spinner';
32
+ spinner.setAttribute('role', 'progressbar');
33
+ button.appendChild(spinner);
34
+ }
35
+ button.appendChild(label);
36
+ body.appendChild(button);
37
+ });
38
+ }
39
+
40
+ function create(
41
+ document: Document,
42
+ row: ButtonGroupRow,
43
+ _primitives: RowPrimitives
44
+ ) {
45
+ const body = document.createElement('div');
46
+ body.dataset.nlRenderer = 'buttonGroup';
47
+ bind(body, row);
48
+ return body;
49
+ }
50
+
51
+ export const buttonGroupRowRenderer = {
52
+ key: 'buttonGroup' as const,
53
+ create,
54
+ bind,
55
+ recycle: (body: HTMLElement) => body.replaceChildren(),
56
+ measure: (_row: ButtonGroupRow, _width: number) => 64,
57
+ measureRendered: (body: HTMLElement) => body.scrollHeight,
58
+ };
@@ -1,10 +1,17 @@
1
1
  import type { DataRow, TextTone } from '../../models';
2
- import { createElement, tagSlot } from './RowElements';
2
+ import {
3
+ createElement,
4
+ markActionAnchorSource,
5
+ setData,
6
+ tagSlot,
7
+ } from './RowElements';
8
+ import { applyValueSegments, fontWeight } from './RowText';
3
9
  import { RowVisualStyle, type RowPrimitives } from './RowVisual';
4
10
  type ColumnViews = {
5
11
  body: HTMLElement;
6
12
  primaryLine: HTMLElement;
7
13
  primary: HTMLElement;
14
+ titleIcons: HTMLElement;
8
15
  badges: HTMLElement;
9
16
  secondaryLine: HTMLElement;
10
17
  secondary: HTMLElement[];
@@ -13,6 +20,7 @@ type Views = {
13
20
  favorite: HTMLElement;
14
21
  index: HTMLElement;
15
22
  controls: HTMLElement;
23
+ trailing: HTMLElement;
16
24
  columns: ColumnViews[];
17
25
  visual?: HTMLElement;
18
26
  visualStyle?: RowVisualStyle;
@@ -43,6 +51,11 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
43
51
  if (row.checkbox)
44
52
  v.controls.appendChild(primitives.accessory(row.key, row.checkbox, 0));
45
53
  v.controls.style.display = 'contents';
54
+ v.trailing.replaceChildren();
55
+ row.trailing?.forEach((accessory, index) =>
56
+ v.trailing.appendChild(primitives.accessory(row.key, accessory, index))
57
+ );
58
+ v.trailing.hidden = !row.trailing?.length;
46
59
  v.index.style.cssText = '';
47
60
  v.index.hidden = row.index === undefined;
48
61
  v.index.textContent = String(row.index ?? '');
@@ -88,7 +101,41 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
88
101
  cell.primaryLine.style.gap = `${style.titleBadgeGap}px`;
89
102
  cell.primary.style.cssText = '';
90
103
  cell.primary.textContent = column.text;
104
+ applyValueSegments(
105
+ cell.primary,
106
+ column.textSegments,
107
+ style?.columns?.fontSize ?? 14,
108
+ style?.columns?.lineHeight ?? 20,
109
+ fontWeight(style?.columns?.fontWeight, 500)
110
+ );
91
111
  if (style?.columns) primitives.textStyle(cell.primary, style.columns);
112
+ cell.titleIcons.replaceChildren();
113
+ if (column.titleIcon || column.secondaryTitleIcon) {
114
+ cell.primary.style.minWidth = '0';
115
+ cell.primary.style.overflow = 'hidden';
116
+ cell.primary.style.textOverflow = 'ellipsis';
117
+ cell.primary.style.whiteSpace = 'nowrap';
118
+ [column.titleIcon, column.secondaryTitleIcon]
119
+ .filter((icon): icon is NonNullable<typeof icon> => icon !== undefined)
120
+ .forEach((descriptor) => {
121
+ const icon = primitives.iconAction(
122
+ descriptor.name,
123
+ undefined,
124
+ undefined,
125
+ descriptor.tintColor
126
+ );
127
+ icon.className = 'ok-native-list-identity-title-icon';
128
+ if (descriptor.hoverActionKey) {
129
+ setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
130
+ setData(icon, 'nativeListIconHelp', true);
131
+ markActionAnchorSource(icon, 'leadingAction');
132
+ }
133
+ if (descriptor.accessibilityLabel)
134
+ icon.setAttribute('aria-label', descriptor.accessibilityLabel);
135
+ else icon.setAttribute('aria-hidden', 'true');
136
+ cell.titleIcons.appendChild(icon);
137
+ });
138
+ }
92
139
  cell.badges.replaceChildren();
93
140
  cell.badges.style.display = 'contents';
94
141
  if (column.key === 'asset')
@@ -107,25 +154,34 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
107
154
  });
108
155
  // Legacy Web layout: secondary leading text sits inline before the primary
109
156
  // text; secondary text is a direct line below it, toned by secondaryTone.
110
- cell.secondaryLine.style.display = column.secondaryText
111
- ? 'contents'
112
- : 'none';
113
- [column.secondaryLeadingText, column.secondaryText].forEach(
114
- (text, slot) => {
115
- const label = cell.secondary[slot]!;
116
- label.hidden = !text;
117
- if (!text) label.remove();
118
- else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);
119
- else cell.secondaryLine.appendChild(label);
120
- label.style.cssText = '';
121
- label.textContent = text ?? '';
122
- if (slot === 1)
123
- label.style.color = tone(column.secondaryTone, 'secondary');
124
- if (style?.columnSecondary)
125
- primitives.textStyle(label, style.columnSecondary);
157
+ const secondaryText = column.secondaryTextSegments?.length
158
+ ? column.secondaryTextSegments.map((segment) => segment.text).join('')
159
+ : column.secondaryText;
160
+ cell.secondaryLine.style.display = secondaryText ? 'contents' : 'none';
161
+ [column.secondaryLeadingText, secondaryText].forEach((text, slot) => {
162
+ const label = cell.secondary[slot]!;
163
+ label.hidden = !text;
164
+ if (!text) label.remove();
165
+ else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);
166
+ else cell.secondaryLine.appendChild(label);
167
+ label.style.cssText = '';
168
+ label.textContent = text ?? '';
169
+ if (slot === 1) {
170
+ applyValueSegments(
171
+ label,
172
+ column.secondaryTextSegments,
173
+ style?.columnSecondary?.fontSize ?? 12,
174
+ style?.columnSecondary?.lineHeight ?? 16,
175
+ fontWeight(style?.columnSecondary?.fontWeight, 400)
176
+ );
126
177
  }
127
- );
178
+ if (slot === 1)
179
+ label.style.color = tone(column.secondaryTone, 'secondary');
180
+ if (style?.columnSecondary)
181
+ primitives.textStyle(label, style.columnSecondary);
182
+ });
128
183
  });
184
+ body.appendChild(v.trailing);
129
185
  }
130
186
  function create(document: Document, row: DataRow, primitives: RowPrimitives) {
131
187
  const body = createElement(
@@ -140,6 +196,11 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
140
196
  );
141
197
  const favorite = createElement(document, 'span', 'ok-native-list-favorite');
142
198
  const controls = createElement(document, 'span');
199
+ const trailing = createElement(
200
+ document,
201
+ 'span',
202
+ 'ok-native-list-accessories'
203
+ );
143
204
  body.append(controls, index, favorite);
144
205
  const columns = Array.from({ length: 4 }, () => {
145
206
  const cell = createElement(document, 'span', 'ok-native-list-data-cell');
@@ -149,8 +210,10 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
149
210
  'ok-native-list-data-primary'
150
211
  );
151
212
  const primary = tagSlot(createElement(document, 'span'), 'columns');
213
+ const titleIcons = createElement(document, 'span');
214
+ titleIcons.style.display = 'contents';
152
215
  const badges = createElement(document, 'span');
153
- primaryLine.append(primary, badges);
216
+ primaryLine.append(primary, titleIcons, badges);
154
217
  const secondaryLine = createElement(
155
218
  document,
156
219
  'span',
@@ -169,15 +232,18 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
169
232
  body: cell,
170
233
  primaryLine,
171
234
  primary,
235
+ titleIcons,
172
236
  badges,
173
237
  secondaryLine,
174
238
  secondary,
175
239
  };
176
240
  });
241
+ body.appendChild(trailing);
177
242
  views.set(body, {
178
243
  favorite,
179
244
  index,
180
245
  controls,
246
+ trailing,
181
247
  columns,
182
248
  visualKey: '',
183
249
  primitives,
@@ -196,6 +262,7 @@ function recycle(body: HTMLElement) {
196
262
  v.visualStyle = undefined;
197
263
  v.visualKey = '';
198
264
  v.controls.replaceChildren();
265
+ v.trailing.replaceChildren();
199
266
  }
200
267
  export const dataRowRenderer = {
201
268
  key: 'dataRow' as const,
@@ -204,7 +271,13 @@ export const dataRowRenderer = {
204
271
  recycle,
205
272
  // Legacy presets: table rows without secondary text are 8 units shorter.
206
273
  measure: (row: DataRow, _width: number, layout?: string) => {
207
- const secondary = row.columns.some((column) => column.secondaryText);
274
+ const secondary = row.columns.some((column) =>
275
+ column.secondaryTextSegments?.length
276
+ ? column.secondaryTextSegments.some(
277
+ (segment) => segment.text.length > 0
278
+ )
279
+ : !!column.secondaryText
280
+ );
208
281
  return (secondary ? 60 : 56) + (layout === 'table' && !secondary ? -8 : 0);
209
282
  },
210
283
  measureRendered: (_body: HTMLElement, _row: DataRow): number | undefined =>
@@ -226,6 +226,117 @@ function createIdentityRow(
226
226
  });
227
227
  column.insertBefore(segments, titleElement.nextSibling);
228
228
  }
229
+ if (row.titleIcon || row.secondaryTitleIcon) {
230
+ const badgeLine = titleElement.querySelector<HTMLElement>(
231
+ ':scope > .ok-native-list-badges'
232
+ );
233
+ const titleText = createElement(
234
+ document,
235
+ 'span',
236
+ 'ok-native-list-identity-title-text'
237
+ );
238
+ while (titleElement.firstChild && titleElement.firstChild !== badgeLine)
239
+ titleText.appendChild(titleElement.firstChild);
240
+ titleElement.prepend(titleText);
241
+ const icons = [row.titleIcon, row.secondaryTitleIcon]
242
+ .filter((icon): icon is NonNullable<typeof icon> => icon !== undefined)
243
+ .map((descriptor) => {
244
+ const icon = primitives.iconAction(
245
+ descriptor.name,
246
+ undefined,
247
+ undefined,
248
+ descriptor.tintColor
249
+ );
250
+ icon.className = 'ok-native-list-identity-title-icon';
251
+ if (descriptor.hoverActionKey) {
252
+ setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
253
+ setData(icon, 'nativeListIconHelp', true);
254
+ markActionAnchorSource(icon, 'leadingAction');
255
+ }
256
+ if (descriptor.accessibilityLabel)
257
+ icon.setAttribute('aria-label', descriptor.accessibilityLabel);
258
+ else icon.setAttribute('aria-hidden', 'true');
259
+ return icon;
260
+ });
261
+ titleText.after(...icons);
262
+ titleElement.style.display = 'flex';
263
+ titleElement.style.alignItems = 'center';
264
+ titleElement.style.gap = '4px';
265
+ }
266
+ if (row.titleSuffixes?.length) {
267
+ const badges = titleElement.querySelector(
268
+ ':scope > .ok-native-list-badges'
269
+ );
270
+ let titleText = titleElement.querySelector<HTMLElement>(
271
+ ':scope > .ok-native-list-identity-title-text, :scope > [data-nl-slot="title"]'
272
+ );
273
+ if (!titleText) {
274
+ titleText = tagSlot(
275
+ createElement(document, 'span', 'ok-native-list-identity-title-text'),
276
+ 'title'
277
+ );
278
+ while (titleElement.firstChild && titleElement.firstChild !== badges)
279
+ titleText.appendChild(titleElement.firstChild);
280
+ titleElement.prepend(titleText);
281
+ titleElement.removeAttribute('data-nl-slot');
282
+ } else if (titleElement.hasAttribute('data-nl-slot')) {
283
+ titleElement.removeAttribute('data-nl-slot');
284
+ tagSlot(titleText, 'title');
285
+ }
286
+ titleElement.style.display = 'flex';
287
+ titleElement.style.alignItems = 'center';
288
+ titleText.style.flex = '0 1 auto';
289
+ titleText.style.minWidth = 'min(80px, 100%)';
290
+ titleText.style.overflow = 'hidden';
291
+ titleText.style.textOverflow = 'ellipsis';
292
+ titleText.style.whiteSpace = 'nowrap';
293
+ row.titleSuffixes.forEach((suffix) => {
294
+ const label = createElement(
295
+ document,
296
+ 'span',
297
+ 'ok-native-list-identity-title-suffix',
298
+ suffix.text
299
+ );
300
+ label.style.flex = '0 1 auto';
301
+ label.style.minWidth = '0';
302
+ label.style.marginInlineStart =
303
+ row.titleIcon || row.secondaryTitleIcon ? '4px' : '8px';
304
+ label.style.maxWidth =
305
+ suffix.maxWidth === undefined ? '' : `${suffix.maxWidth}px`;
306
+ label.style.overflow = 'hidden';
307
+ label.style.textOverflow = 'ellipsis';
308
+ label.style.whiteSpace = 'nowrap';
309
+ label.style.fontSize = '12px';
310
+ label.style.lineHeight = '16px';
311
+ label.style.fontWeight = '400';
312
+ label.style.fontFamily = 'var(--nl-font-regular)';
313
+ label.style.color =
314
+ suffix.tone === 'disabled'
315
+ ? 'var(--nl-disabled)'
316
+ : 'var(--nl-secondary)';
317
+ titleElement.insertBefore(label, badges);
318
+ });
319
+ }
320
+ if (row.badges?.length && !row.titleIcon && !row.secondaryTitleIcon) {
321
+ const titleText = titleElement.querySelector<HTMLElement>(
322
+ ':scope > [data-nl-slot="title"]'
323
+ );
324
+ const badges = titleElement.querySelector<HTMLElement>(
325
+ ':scope > .ok-native-list-badges'
326
+ );
327
+ titleElement.style.display = 'flex';
328
+ titleElement.style.alignItems = 'center';
329
+ if (titleText) {
330
+ titleText.style.flex = '0 1 auto';
331
+ titleText.style.minWidth = row.titleSuffixes?.length
332
+ ? 'min(80px, 100%)'
333
+ : '0';
334
+ }
335
+ if (badges) {
336
+ badges.style.flex = '0 1 auto';
337
+ badges.style.minWidth = '0';
338
+ }
339
+ }
229
340
  if (presentation === 'walletSidebar' && row.badges?.length) {
230
341
  const badges = createElement(
231
342
  document,
@@ -242,7 +353,13 @@ function createIdentityRow(
242
353
  if (lines !== undefined)
243
354
  column
244
355
  .querySelectorAll<HTMLElement>(`[data-nl-slot="${key}"]`)
245
- .forEach((text) => applyTextLayout(text, { lines }));
356
+ .forEach((text) =>
357
+ applyTextLayout(
358
+ text,
359
+ lines === 0 ? {} : { lines },
360
+ lines === 0 ? 0 : undefined
361
+ )
362
+ );
246
363
  }
247
364
  }
248
365
  body.appendChild(column);
@@ -272,6 +389,29 @@ function applyIdentityStyle(body: HTMLElement, row: IdentityRow) {
272
389
  const leading = body.querySelector<HTMLElement>(
273
390
  ':scope > .ok-native-list-visual, :scope > .ok-native-list-stacked'
274
391
  );
392
+ if (row.style?.leadingContentMaxWidthRatio !== undefined && !vertical) {
393
+ const column = body.querySelector<HTMLElement>(
394
+ ':scope > .ok-native-list-flex'
395
+ );
396
+ const trailing = body.querySelector<HTMLElement>(
397
+ ':scope > .ok-native-list-accessories'
398
+ );
399
+ const visualWidth = leading
400
+ ? row.style.image?.width ??
401
+ (row.presentation === 'accountSelector' ||
402
+ row.presentation === 'networkSelector'
403
+ ? 32
404
+ : 40)
405
+ : 0;
406
+ const gap = leading ? row.style.leadingGap ?? 12 : 0;
407
+ if (column) {
408
+ column.style.flex = '0 1 auto';
409
+ column.style.maxWidth = `calc(${
410
+ row.style.leadingContentMaxWidthRatio * 100
411
+ }% - ${visualWidth + gap}px)`;
412
+ }
413
+ if (trailing) trailing.style.marginInlineStart = 'auto';
414
+ }
275
415
  const defaultGap =
276
416
  body.style.gap ||
277
417
  (row.type === 'identity' && row.presentation === 'walletSidebar'
@@ -343,7 +483,7 @@ function applyIdentityStyle(body: HTMLElement, row: IdentityRow) {
343
483
  const images = leading.matches('img')
344
484
  ? [leading]
345
485
  : leading.querySelectorAll<HTMLElement>(
346
- ':scope > img, :scope > .ok-native-list-visual-fallback'
486
+ ':scope > img:not(.ok-native-list-visual-corner), :scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)'
347
487
  );
348
488
  images.forEach((bitmap) => {
349
489
  if (bitmap !== leading) {
@@ -522,7 +662,12 @@ export const identityRowRenderer = {
522
662
  ? 60
523
663
  : 56,
524
664
  measureRendered: (
525
- _body: HTMLElement,
526
- _row: IdentityRow
527
- ): number | undefined => undefined,
665
+ body: HTMLElement,
666
+ row: IdentityRow
667
+ ): number | undefined => {
668
+ if (row.contentHeight !== 'auto' || hasExplicitRowHeight(row))
669
+ return undefined;
670
+ const height = body.getBoundingClientRect().height;
671
+ return height > 0 ? height : undefined;
672
+ },
528
673
  };
@@ -198,8 +198,18 @@ function createMarketRow(
198
198
  ? 'none'
199
199
  : style?.image?.contentFit ?? image.style.objectFit;
200
200
  } else {
201
- image.style.width = '20px';
202
- image.style.height = '20px';
201
+ image.style.width =
202
+ String(
203
+ row.leading.kind === 'token'
204
+ ? row.leading.networkImage?.width ?? 16
205
+ : 16
206
+ ) + 'px';
207
+ image.style.height =
208
+ String(
209
+ row.leading.kind === 'token'
210
+ ? row.leading.networkImage?.height ?? 16
211
+ : 16
212
+ ) + 'px';
203
213
  if (borderColor) {
204
214
  image.style.right = '-5px';
205
215
  image.style.bottom = '-5px';
@@ -314,8 +324,14 @@ function createMarketRow(
314
324
  weight: 400,
315
325
  alignment: 'start',
316
326
  });
327
+ if (row.subtitlePrefix.hoverActionKey) {
328
+ prefix.dataset.nativeListHoverAction =
329
+ row.subtitlePrefix.hoverActionKey;
330
+ prefix.dataset.nativeListAnchorSource = 'row';
331
+ prefix.tabIndex = 0;
332
+ }
317
333
  prefix.style.display = 'block';
318
- prefix.style.flex = '1 1 auto';
334
+ prefix.style.flex = '0 1 auto';
319
335
  prefix.style.minWidth = '0';
320
336
  prefix.style.overflow = 'hidden';
321
337
  prefix.style.textOverflow = 'ellipsis';