@onekeyfe/react-native-native-list 6.7.0-alpha.375 → 6.7.0-alpha.382

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 (116) 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 +240 -11
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -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 +177 -1
  9. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +43 -14
  10. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +33 -2
  12. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +22 -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 +1912 -107
  19. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +1 -0
  20. package/docs/ROW_TEMPLATES.md +60 -9
  21. package/docs/SPEC.md +450 -5
  22. package/docs/STYLE_SPEC.md +6 -0
  23. package/ios/HybridNativeList.swift +21 -2
  24. package/ios/NativeListAccessoryStack.swift +227 -39
  25. package/ios/NativeListActivityDetailsView.swift +18 -8
  26. package/ios/NativeListActivityRenderer.swift +8 -2
  27. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  28. package/ios/NativeListDataRowRenderer.swift +155 -27
  29. package/ios/NativeListDesignAssets.swift +3 -0
  30. package/ios/NativeListIdentityRenderer.swift +166 -30
  31. package/ios/NativeListLeadingVisual.swift +49 -14
  32. package/ios/NativeListMessageRenderer.swift +34 -1
  33. package/ios/NativeListModels.swift +42 -2
  34. package/ios/NativeListRendererRegistry.swift +1 -0
  35. package/ios/NativeListResolvedText.swift +2 -1
  36. package/ios/NativeListRowHost.swift +14 -0
  37. package/ios/NativeListSectionHeaderRenderer.swift +88 -0
  38. package/ios/RNCNativeListView.swift +1013 -55
  39. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
  40. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
  41. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
  42. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
  43. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
  44. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
  45. package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
  46. package/ios/tests/NativeListLifecycleTests.swift +2720 -3
  47. package/lib/module/NativeList.js +175 -28
  48. package/lib/module/NativeList.web.js +129 -30
  49. package/lib/module/index.js +1 -1
  50. package/lib/module/models.js +1 -0
  51. package/lib/module/selection.js +1 -1
  52. package/lib/module/validation.js +421 -8
  53. package/lib/module/web/NativeListWebEngine.js +507 -19
  54. package/lib/module/web/templates/ActivityRowRenderer.js +8 -7
  55. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  56. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  57. package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
  58. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  59. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  60. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  61. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  62. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  63. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  64. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  65. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  66. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  67. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  68. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  69. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  70. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  71. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  72. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  73. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  74. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  75. package/lib/typescript/src/NativeList.d.ts +1 -1
  76. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  77. package/lib/typescript/src/NativeList.types.d.ts +18 -0
  78. package/lib/typescript/src/index.d.ts +2 -2
  79. package/lib/typescript/src/models.d.ts +105 -9
  80. package/lib/typescript/src/validation.d.ts +12 -0
  81. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -0
  82. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  83. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  84. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  85. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  86. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  87. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  89. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  90. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  91. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  92. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  93. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  94. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  95. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  96. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  97. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  98. package/package.json +3 -3
  99. package/react-native-native-list.podspec +1 -0
  100. package/src/NativeList.nitro.ts +2 -0
  101. package/src/NativeList.tsx +313 -44
  102. package/src/NativeList.types.ts +22 -0
  103. package/src/NativeList.web.tsx +204 -48
  104. package/src/index.ts +2 -0
  105. package/src/models.ts +117 -3
  106. package/src/selection.ts +1 -0
  107. package/src/validation.ts +852 -6
  108. package/src/web/NativeListWebEngine.ts +803 -20
  109. package/src/web/templates/ActivityRowRenderer.ts +14 -6
  110. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  111. package/src/web/templates/DataRowRenderer.ts +93 -20
  112. package/src/web/templates/IdentityRowRenderer.ts +150 -5
  113. package/src/web/templates/MessageRowRenderer.ts +23 -7
  114. package/src/web/templates/RowContainerStyle.ts +2 -0
  115. package/src/web/templates/RowRendererRegistry.ts +11 -1
  116. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
@@ -26,6 +26,7 @@ class NativeListPressPolicyTest {
26
26
  Case(type = "system", variant = "end", expected = false),
27
27
  Case(type = "system", variant = "spacer", expected = false),
28
28
  Case(type = "walletGroup", expected = false),
29
+ Case(type = "buttonGroup", expected = false),
29
30
  )
30
31
 
31
32
  assertEquals(
@@ -1,6 +1,6 @@
1
1
  # NativeList row template catalog
2
2
 
3
- This catalog defines the **12 types in `RowModel`** on the consolidated spec
3
+ This catalog defines the **13 types in `RowModel`** on the consolidated spec
4
4
  branch. Each template owns a fixed internal structure. Its `style` customizes
5
5
  named fields inside that structure; it does not define a new layout or enable a
6
6
  list feature. See [STYLE_SPEC.md](STYLE_SPEC.md) for tokens, numeric bounds,
@@ -34,6 +34,7 @@ template the owner of sections or the indexed bar.
34
34
  | [metricCard](#metriccard) | KPI or portfolio summary | Label/value card or named composite metrics arrangement |
35
35
  | [sectionHeader](#sectionheader) | Structural section heading | Header text + optional summary value/controls |
36
36
  | [action](#action) | A row-level command | Label + optional icon/value/controls |
37
+ | [buttonGroup](#buttongroup) | DeFi position actions | One or more equal-width info-outline buttons |
37
38
  | [system](#system) | Loading, retry, warning, empty/end or spacer | Variant-specific bounded status content |
38
39
 
39
40
  The style roles below form the shared configurable contract on Web, iOS and
@@ -53,7 +54,19 @@ separately from source implementation in STYLE_SPEC §9.
53
54
 
54
55
  - **Use:** an identifiable asset, account, wallet, network or setting.
55
56
  - **Required data:** `leading`, `title`; optional `subtitle`, `tertiary`, `badges`,
56
- `trailing`, `leadingAction`, match ranges and structured subtitle segments.
57
+ `trailing`, `leadingAction`, `titleIcon`, Web-only `secondaryTitleIcon`, match ranges and structured subtitle segments.
58
+ - **Static title icon:** optional 20-point icon immediately after the title with
59
+ a 4-point gap. It has no click action; an optional Web `hoverActionKey`
60
+ emits an icon-anchored tooltip request on hover or touch. A trailing `button` is the fixed small
61
+ secondary text action and uses the normal accessory event slot.
62
+ - **Second Web help icon:** `secondaryTitleIcon` uses the same descriptor after
63
+ `titleIcon`; each glyph has its own hover/touch anchor. Native ignores it.
64
+ - **Decorative refresh:** a trailing `RefreshCcwOutline` without `actionKey`
65
+ occupies a 16-point frame and leaves row press with the row.
66
+ - **Web neutral badge:** generic Identity rows with an explicit `tone: 'neutral'`
67
+ use a 20-pixel pill with 12/16 medium text, 8-pixel horizontal and 2-pixel
68
+ vertical padding, and the strong/subdued theme colors. Omitted tone and
69
+ selector presentations keep their existing badge defaults.
57
70
  - **Variants:** default horizontal row; `accountSelector` and `networkSelector`
58
71
  preserve selector control geometry; `walletSidebar` uses a compact, centered
59
72
  wallet presentation. A variant is explicit model data, never inferred from font size.
@@ -63,11 +76,25 @@ separately from source implementation in STYLE_SPEC §9.
63
76
  and 12 for other templates (Web 0).
64
77
  - **Platform default:** without `subtitleLines` or `style.subtitle.lines`, the
65
78
  subtitle shows one line on iOS and Web but two on Android (STYLE_SPEC §6.2).
79
+ - **Recipient opt-in:** `subtitleLines: 0` allows the whole subtitle to wrap;
80
+ `contentHeight: 'auto'` sizes the identity row to that content. Both are
81
+ explicit so existing selector rows retain their geometry. Optional
82
+ `longPressActionKey` emits a row action and suppresses the tap for that gesture.
66
83
  - **Text style roles:** `title`, `subtitle`, `tertiary`, `badge`, `value`,
67
84
  `valueSecondary`. The last two refer to value accessories in `trailing`; `badge`
68
85
  refers to badge text. `value`/`valueSecondary` select the first/second value
69
86
  accessory, ignoring intervening controls. A `valuePair` is one accessory, so
70
- its style applies to both text runs. They are semantic roles, not extra top-level data fields.
87
+ its style applies to both text runs. Optional `primaryTextSegments` and
88
+ `secondaryTextSegments` use the existing subscript run shape per line; missing
89
+ or empty arrays retain the required fallback string. They are semantic roles,
90
+ not extra top-level data fields.
91
+ - **Primary value weight:** optional `valuePair.primaryFontWeight: 'medium'`
92
+ styles only the first line. The second line remains regular; omission keeps
93
+ each platform's existing value-pair typography.
94
+ - **Primary value help:** optional `primaryHelp` on a `valuePair` targets only
95
+ its first line. `presentation` explicitly selects Web Tooltip or cross-platform
96
+ Popover behavior; native Tooltip has no press target. Optional dashed underline
97
+ is visual only. Missing help retains the original passive value pair.
71
98
  - **Layout boundary:** reserve visual and accessory slots; text compresses within
72
99
  its own column. Styling cannot move a checkbox/menu into the title column,
73
100
  reorder accessories or convert a horizontal row into the sidebar presentation.
@@ -132,7 +159,7 @@ separately from source implementation in STYLE_SPEC §9.
132
159
  ![Activity: leading visual and description, trailing amounts, optional actions within the row](images/row-activity.svg)
133
160
 
134
161
  - **Use:** a transaction/activity record with amounts and optional commands.
135
- - **Required data:** `leading`, `title`; optional `secondaryLeading`,
162
+ - **Required data:** `leading`, `title`; optional `hideLeading`, `secondaryLeading`,
136
163
  `description`, `status`, `primaryAmount`, `secondaryAmount`, `footerActions`.
137
164
  At most three footer actions are accepted, each with a unique key.
138
165
  - **Text style roles:** `title`, `description`, `status`, `primaryAmount`,
@@ -140,6 +167,10 @@ separately from source implementation in STYLE_SPEC §9.
140
167
  - **Layout boundary:** amounts remain in the amount column, description stays
141
168
  in its text region, actions stay in the row's action area. Adding actions is a
142
169
  model/height choice, not a typography trick.
170
+ - **Leading visibility:** `hideLeading: true` removes the main visual, its
171
+ accessibility content and its width plus gap. The title and footer actions
172
+ start at the row content inset. The required `leading` model remains valid;
173
+ omitted or `false` retains the existing visual and spacing.
143
174
  - **Common-capability boundary:** `footerActions` are inside this activity row.
144
175
  The list footer is independently configured through the container.
145
176
 
@@ -149,8 +180,8 @@ separately from source implementation in STYLE_SPEC §9.
149
180
  most four keyed badges. `descriptionActionKey` emits a description action.
150
181
  `presentation: 'table'` allocates equal identity/amount columns and an
151
182
  optional fee column; `stacked` keeps right-aligned amounts beside identity.
152
- `fee.hidden` reserves its column while hiding its content. These native
153
- additions do not change the Web renderer.
183
+ `fee.hidden` reserves its column while hiding its content. The Web rich
184
+ Activity renderer uses these fields and the same `hideLeading` visibility.
154
185
 
155
186
  ```text
156
187
  stacked (phone) table (wide)
@@ -169,11 +200,14 @@ stacked (phone) table (wide)
169
200
 
170
201
  - **Use:** a notification or message preview.
171
202
  - **Required data:** `title`, `body`, `time`; optional `leading`, `thumbnail`,
172
- `unread`. `bodyLines` is the legacy fallback for one, two or three body lines.
203
+ `unread`. `bodyLines` is the legacy fallback for one, two or three body lines;
204
+ zero opts into unlimited body wrapping and natural height.
173
205
  - **Text style roles:** `title`, `body`, `time`. `style.body.lines` accepts one, two or three and takes precedence over `bodyLines`.
174
206
  - **Layout boundary:** time and thumbnail keep their allocated regions; body
175
- text wraps/truncates within the message area. Styling cannot displace the
176
- timestamp, grow over the next row, or turn the preview into unbounded content.
207
+ text wraps/truncates within the message area. Unlimited wrapping is explicit
208
+ and remains bounded by the row's 4096-character text limit. The optional
209
+ `inlineWarning` presentation draws requested top/bottom container borders
210
+ across the row width without side borders or rounded corners.
177
211
  - **Current divergence:** leading-image size and body typography differ across
178
212
  platforms. Larger line boxes need explicit height and visual verification.
179
213
 
@@ -309,6 +343,11 @@ chrome and emits no row action. Omission preserves existing rendering.
309
343
  icons/actions, checkbox, `sticky`, `indexTitle`. Variants: default, `summary`,
310
344
  `gallery`, `history`; `presentation: 'networkSelector'` is also available.
311
345
  - **Text style roles:** `title`, `subtitle`, `value`.
346
+ - **DeFi position fields:** optional `leadingBadge` precedes the title.
347
+ `style.valuePlacement: 'afterTitle'` keeps a short value beside the title;
348
+ `style.titleDecoration` explicitly selects plain or dashed title text.
349
+ `valueHelp` uses the same explicit presentation and underline contract as
350
+ `valuePair.primaryHelp`. Omission keeps the original heading behavior.
312
351
  - **Layout boundary:** preserve heading/value/control regions. `summary` does
313
352
  not accept a checkbox and is not sticky. Pinning and index-entry generation are
314
353
  container behavior, not a text-style property.
@@ -333,6 +372,18 @@ chrome and emits no row action. Omission preserves existing rendering.
333
372
  `rows`, `fixedFooter` or `emptyState`. The container decides placement and
334
373
  visibility; the action template only renders its content.
335
374
 
375
+ ## buttonGroup
376
+
377
+ - **Use:** the full-width DeFi position actions within the list's data stream.
378
+ - **Required data:** a nonempty `buttons` array. Every entry has a unique
379
+ `key`, `label` and `actionKey`; optional `disabled`, `loading`, `testID` and
380
+ `accessibilityLabel` retain one control per entry.
381
+ - **Fixed structure:** equal-width medium info-outline buttons with 10-point
382
+ gaps, 12-point vertical button padding and 12-point radius. Loading retains
383
+ width and disables only its button. Row disable blocks all actions.
384
+ - **Action boundary:** each button emits its own action and anchor slot; the row
385
+ has no independent press action. The SDK never resolves DeFi permissions.
386
+
336
387
  ## system
337
388
 
338
389
  ![System variants: loading indicator, retry message and action, warning, no-match/end text and explicit spacer](images/row-system.svg)