@onekeyfe/react-native-native-list 6.7.0-5 → 6.7.0-51

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 (214) hide show
  1. package/README.md +312 -375
  2. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  3. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
  5. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
  6. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  7. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
  10. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
  17. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  18. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
  19. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  21. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
  22. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  24. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1978 -136
  26. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  27. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  28. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  29. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  30. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  31. package/docs/ROW_TEMPLATES.md +74 -13
  32. package/docs/SPEC.md +1232 -16
  33. package/docs/STYLE_SPEC.md +14 -0
  34. package/ios/HybridNativeList.swift +21 -2
  35. package/ios/NativeListAccessoryStack.swift +237 -51
  36. package/ios/NativeListActivityDetailsView.swift +30 -11
  37. package/ios/NativeListActivityRenderer.swift +8 -2
  38. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  39. package/ios/NativeListDataRowRenderer.swift +167 -30
  40. package/ios/NativeListDesignAssets.swift +13 -75
  41. package/ios/NativeListGeneratedIcons.swift +55 -0
  42. package/ios/NativeListIconBinding.swift +171 -0
  43. package/ios/NativeListIdentityRenderer.swift +256 -39
  44. package/ios/NativeListLeadingVisual.swift +127 -28
  45. package/ios/NativeListMarketRenderer.swift +120 -31
  46. package/ios/NativeListMediaPlaceholderView.swift +189 -0
  47. package/ios/NativeListMediaPreviewSlot.swift +122 -61
  48. package/ios/NativeListMediaTileRenderer.swift +15 -11
  49. package/ios/NativeListMessageRenderer.swift +34 -1
  50. package/ios/NativeListMetricCardRenderer.swift +4 -2
  51. package/ios/NativeListModels.swift +42 -2
  52. package/ios/NativeListRendererRegistry.swift +1 -0
  53. package/ios/NativeListResolvedText.swift +2 -1
  54. package/ios/NativeListRowHost.swift +14 -0
  55. package/ios/NativeListSectionHeaderRenderer.swift +100 -4
  56. package/ios/RNCNativeListView.swift +1093 -59
  57. package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
  58. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  59. package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
  60. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  61. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  62. package/ios/tests/NativeListLifecycleTests.swift +2915 -4
  63. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  64. package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
  65. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  66. package/lib/module/NativeList.js +236 -38
  67. package/lib/module/NativeList.web.js +167 -46
  68. package/lib/module/index.js +1 -1
  69. package/lib/module/models.js +3 -0
  70. package/lib/module/selection.js +1 -1
  71. package/lib/module/validation.js +1246 -48
  72. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  73. package/lib/module/web/NativeListWebEngine.js +513 -275
  74. package/lib/module/web/templates/ActivityRowRenderer.js +12 -31
  75. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  76. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  77. package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
  78. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  79. package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
  80. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  81. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  82. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  83. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  84. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  85. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  86. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  87. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  88. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  89. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  90. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  91. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  92. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  93. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  94. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  95. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  96. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  97. package/lib/typescript/src/NativeList.d.ts +3 -3
  98. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  99. package/lib/typescript/src/NativeList.types.d.ts +20 -2
  100. package/lib/typescript/src/index.d.ts +2 -2
  101. package/lib/typescript/src/models.d.ts +126 -17
  102. package/lib/typescript/src/validation.d.ts +20 -0
  103. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  104. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
  105. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  106. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  107. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  108. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  109. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  110. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  112. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  113. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  114. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  115. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  116. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  117. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  118. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  120. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  121. package/package.json +16 -10
  122. package/react-native-native-list.podspec +2 -6
  123. package/scripts/generate-icons.mjs +150 -0
  124. package/scripts/generate-icons.test.mjs +288 -0
  125. package/scripts/native-list-icons.json +260 -0
  126. package/src/NativeList.nitro.ts +2 -0
  127. package/src/NativeList.tsx +439 -91
  128. package/src/NativeList.types.ts +24 -2
  129. package/src/NativeList.web.tsx +295 -89
  130. package/src/index.ts +2 -0
  131. package/src/models.ts +263 -144
  132. package/src/selection.ts +1 -0
  133. package/src/validation.ts +3013 -152
  134. package/src/web/NativeListGeneratedIcons.ts +28 -0
  135. package/src/web/NativeListWebEngine.ts +818 -343
  136. package/src/web/templates/ActivityRowRenderer.ts +29 -59
  137. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  138. package/src/web/templates/DataRowRenderer.ts +93 -20
  139. package/src/web/templates/IdentityRowRenderer.ts +231 -6
  140. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  141. package/src/web/templates/MediaTileRowRenderer.ts +90 -28
  142. package/src/web/templates/MessageRowRenderer.ts +23 -7
  143. package/src/web/templates/RowContainerStyle.ts +2 -0
  144. package/src/web/templates/RowRendererRegistry.ts +11 -1
  145. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
  146. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  147. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  148. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  152. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  153. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  154. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  155. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  156. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  157. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  158. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  159. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  160. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  161. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  162. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  163. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  164. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  165. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  166. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  167. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  168. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  169. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  170. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  171. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  172. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  173. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  174. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  175. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  176. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  177. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  178. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  179. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  180. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  181. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  182. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  183. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  184. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  185. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  186. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  187. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  188. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  189. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  190. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  191. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  192. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  193. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  194. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  195. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  196. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  197. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  198. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  199. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  200. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  201. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  202. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  203. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  204. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  205. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  206. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  207. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  208. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  209. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  210. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  211. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  212. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  213. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  214. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
@@ -1,3 +1,4 @@
1
+ import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
1
2
  import type { ActivityAmount, ActivityRow, LeadingVisual } from '../../models';
2
3
  import { createElement, tagSlot, markActionAnchorSource } from './RowElements';
3
4
  import { RowVisualStyle, type RowPrimitives } from './RowVisual';
@@ -47,6 +48,7 @@ function bindLegacy(
47
48
  }
48
49
  const visualKey = JSON.stringify([
49
50
  row.key,
51
+ row.hideLeading,
50
52
  row.leading,
51
53
  row.secondaryLeading,
52
54
  ]);
@@ -55,7 +57,7 @@ function bindLegacy(
55
57
  primitives.dispose(node);
56
58
  node.remove();
57
59
  });
58
- v.visuals = [row.leading, row.secondaryLeading]
60
+ v.visuals = (row.hideLeading ? [] : [row.leading, row.secondaryLeading])
59
61
  .map((source) => primitives.visual(source))
60
62
  .filter((node): node is HTMLElement => !!node);
61
63
  v.visuals.forEach((node) => body.insertBefore(node, v.column));
@@ -269,41 +271,18 @@ function createHistory(body: HTMLElement, primitives: RowPrimitives) {
269
271
  histories.set(body, v);
270
272
  return v;
271
273
  }
272
- const historyIconPaths: Readonly<Record<string, readonly string[]>> = {
273
- ArrowTopOutline: [
274
- 'M19.414 10 18 11.414l-5-5V21h-2V6.414l-5 5L4.586 10 12 2.586z',
275
- ],
276
- ArrowBottomOutline: [
277
- 'm13 17.586 5-5L19.414 14 12 21.414 4.586 14 6 12.586l5 5V3h2z',
278
- ],
279
- SwitchHorOutline: [
280
- 'm9.414 13-3 3H21v2H6.414l3 3L8 22.414 2.586 17 8 11.586zm12-6L16 12.414 14.586 11l3-3H3V6h14.586l-3-3L16 1.586z',
281
- ],
282
- CoinsOutline: [
283
- 'M9 3a7 7 0 0 1 6.328 4.008 7 7 0 1 1-6.657 9.983A7 7 0 0 1 9 3m5.718 6.008a5 5 0 1 0 .566 9.985 5 5 0 0 0-.566-9.985M9 5a5 5 0 0 0-.941 9.91 7 7 0 0 1 5.11-7.667A4.99 4.99 0 0 0 8.999 5Z',
284
- ],
285
- ShieldCheckDoneOutline: [
286
- 'M15.914 9.75 11 14.664 8.086 11.75 9.5 10.336l1.5 1.5 3.5-3.5z',
287
- 'M12.325 2.055 21 5.036v6.876c0 2.807-1.149 4.83-2.813 6.404-1.615 1.53-3.745 2.66-5.712 3.722l-.475.256-.475-.256c-1.967-1.061-4.097-2.192-5.713-3.722C4.15 16.741 3 14.72 3 11.912V5.036l8.675-2.981.325-.113zM5 6.463v5.45c0 2.165.851 3.686 2.188 4.951 1.275 1.208 2.965 2.154 4.812 3.154 1.847-1 3.537-1.946 4.813-3.154C18.148 15.6 19 14.078 19 11.912v-5.45l-7-2.405z',
288
- ],
289
- UnlockedOutline: [
290
- 'M13 18h-2v-5h2z',
291
- 'M12 2a5 5 0 0 1 5 5h-2a3 3 0 0 0-6 0v2h11v13H4V9h3V7a5 5 0 0 1 5-5M6 20h12v-9H6z',
292
- ],
293
- Document2Outline: [
294
- 'M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z',
295
- 'M20 22H4V2h16zM6 20h12V4H6z',
296
- ],
297
- CryptoCoinOutline: [
298
- 'M11 16.387a4.5 4.5 0 0 1 0-8.775V6h2v1.613a4.5 4.5 0 0 1 2.856 2.067l-1.712 1.032a2.5 2.5 0 1 0 0 2.576l1.712 1.032A4.5 4.5 0 0 1 13 16.386V18h-2z',
299
- 'M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0',
300
- ],
301
- ImageSquareWavesOutline: [
302
- 'M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4',
303
- 'M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z',
304
- ],
305
- DotHorOutline: ['M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z'],
306
- };
274
+ const historyIconNames = new Set([
275
+ 'ArrowTopOutline',
276
+ 'ArrowBottomOutline',
277
+ 'SwitchHorOutline',
278
+ 'CoinsOutline',
279
+ 'ShieldCheckDoneOutline',
280
+ 'UnlockedOutline',
281
+ 'Document2Outline',
282
+ 'CryptoCoinOutline',
283
+ 'ImageSquareWavesOutline',
284
+ 'DotHorOutline',
285
+ ]);
307
286
  function historyIcon(
308
287
  node: HTMLElement,
309
288
  source: LeadingVisual | undefined,
@@ -315,8 +294,7 @@ function historyIcon(
315
294
  : source?.kind === 'token'
316
295
  ? source.fallbackIcon?.name
317
296
  : undefined;
318
- const paths = name && historyIconPaths[name];
319
- if (!paths) return;
297
+ if (!name || !historyIconNames.has(name)) return;
320
298
  const placeholder = node.querySelector<HTMLElement>(
321
299
  '.ok-native-list-visual-fallback'
322
300
  );
@@ -333,24 +311,9 @@ function historyIcon(
333
311
  fallback.style.color = source.tintColor;
334
312
  else if (source && 'fallbackIcon' in source && source.fallbackIcon?.tintColor)
335
313
  fallback.style.color = source.fallbackIcon.tintColor;
336
- const svg = node.ownerDocument.createElementNS(
337
- 'http://www.w3.org/2000/svg',
338
- 'svg'
339
- );
340
- svg.setAttribute('viewBox', '0 0 24 24');
314
+ const svg = createNamedIcon(node.ownerDocument, name);
341
315
  svg.setAttribute('width', String(size));
342
316
  svg.setAttribute('height', String(size));
343
- svg.setAttribute('fill', 'currentColor');
344
- svg.setAttribute('aria-hidden', 'true');
345
- for (const d of paths) {
346
- const path = node.ownerDocument.createElementNS(
347
- 'http://www.w3.org/2000/svg',
348
- 'path'
349
- );
350
- path.setAttribute('d', d);
351
- path.setAttribute('fill-rule', 'evenodd');
352
- svg.append(path);
353
- }
354
317
  fallback.replaceChildren(svg);
355
318
  }
356
319
  function bindHistory(
@@ -389,11 +352,12 @@ function bindHistory(
389
352
  Object.assign(v.identity.style, {
390
353
  display: 'flex',
391
354
  alignItems: 'center',
392
- gap: '12px',
355
+ gap: row.hideLeading ? '0' : '12px',
393
356
  minWidth: '0',
394
357
  flex: '1 1 0',
395
358
  });
396
359
  Object.assign(v.visual.style, {
360
+ display: row.hideLeading ? 'none' : '',
397
361
  position: 'relative',
398
362
  width: '40px',
399
363
  height: '40px',
@@ -401,6 +365,7 @@ function bindHistory(
401
365
  });
402
366
  const visualKey = JSON.stringify([
403
367
  row.key,
368
+ row.hideLeading,
404
369
  row.leading,
405
370
  row.secondaryLeading,
406
371
  ]);
@@ -410,7 +375,9 @@ function bindHistory(
410
375
  );
411
376
  v.visual.replaceChildren();
412
377
  v.visuals = [];
413
- const sources = [row.leading, row.secondaryLeading].filter(Boolean);
378
+ const sources = row.hideLeading
379
+ ? []
380
+ : [row.leading, row.secondaryLeading].filter(Boolean);
414
381
  sources.forEach((source) => {
415
382
  const visual = primitives.visual(source);
416
383
  if (!visual) return;
@@ -439,7 +406,9 @@ function bindHistory(
439
406
  });
440
407
  v.visualKey = visualKey;
441
408
  }
442
- const sources = [row.leading, row.secondaryLeading].filter(Boolean);
409
+ const sources = row.hideLeading
410
+ ? []
411
+ : [row.leading, row.secondaryLeading].filter(Boolean);
443
412
  v.visuals.forEach((retained, index) => {
444
413
  const { node: visual, style, background, loaded } = retained;
445
414
  const source = sources[index];
@@ -773,8 +742,9 @@ function bindHistory(
773
742
  20,
774
743
  400
775
744
  );
776
- v.actions.style.cssText =
777
- 'display:flex;gap:12px;padding-left:52px;padding-bottom:4px;';
745
+ v.actions.style.cssText = `display:flex;gap:12px;padding-left:${
746
+ row.hideLeading ? 0 : 52
747
+ }px;padding-bottom:4px;`;
778
748
  v.actions.style.display = footer ? 'flex' : 'none';
779
749
  const actionKeys = new Set<string>();
780
750
  for (const [index, action] of (row.footerActions ?? []).entries()) {
@@ -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 =>