@onekeyfe/react-native-native-list 6.7.0-alpha.378 → 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
@@ -1,6 +1,6 @@
1
1
  import { applyTextWeight } from './RowText';
2
2
  import { applyTabularNumbers, hasExplicitRowHeight } from './RowElements';
3
- import type { SectionHeaderRow } from '../../models';
3
+ import type { RowTextHelp, SectionHeaderRow } from '../../models';
4
4
  import {
5
5
  createElement,
6
6
  setData,
@@ -10,6 +10,21 @@ import {
10
10
  } from './RowElements';
11
11
  import { applyValueSegments } from './RowText';
12
12
  import type { RowPrimitives } from './RowVisual';
13
+
14
+ function bindHelp(target: HTMLElement, help: RowTextHelp) {
15
+ markActionAnchorSource(target, 'trailingAccessory', 0);
16
+ if (help.presentation === 'tooltip') {
17
+ setData(target, 'nativeListHoverAction', help.actionKey);
18
+ setData(target, 'nativeListIconHelp', true);
19
+ } else {
20
+ setData(target, 'nativeListAction', help.actionKey);
21
+ target.setAttribute('role', 'button');
22
+ }
23
+ if (help.underline === 'dashed') {
24
+ target.style.textDecoration = 'underline dashed';
25
+ target.style.textUnderlineOffset = '4px';
26
+ }
27
+ }
13
28
  function createSectionHeader(
14
29
  document: Document,
15
30
  primitives: RowPrimitives,
@@ -36,6 +51,16 @@ function createSectionHeader(
36
51
  const column = createTextColumn(document, row.title, row.subtitle);
37
52
  const title = column.firstElementChild as HTMLElement;
38
53
  title.classList.add('ok-native-list-section-title');
54
+ if (row.leadingBadge) {
55
+ const badge = createElement(
56
+ document,
57
+ 'span',
58
+ 'ok-native-list-badge',
59
+ row.leadingBadge.text
60
+ );
61
+ if (row.leadingBadge.tone) setData(badge, 'tone', row.leadingBadge.tone);
62
+ body.appendChild(badge);
63
+ }
39
64
  if (row.titleActionKey) {
40
65
  setData(title, 'nativeListAction', row.titleActionKey);
41
66
  markActionAnchorSource(title, 'leadingAction');
@@ -50,6 +75,12 @@ function createSectionHeader(
50
75
  }
51
76
  if (row.titleActionOnHover) setData(title, 'nativeListHoverAction', true);
52
77
  }
78
+ if (row.style?.titleDecoration === 'none')
79
+ title.style.textDecoration = 'none';
80
+ if (row.style?.titleDecoration === 'dashed') {
81
+ title.style.textDecoration = 'underline dashed';
82
+ title.style.textUnderlineOffset = '4px';
83
+ }
53
84
  if (row.presentation === 'networkSelector' && hasExplicitRowHeight(row)) {
54
85
  body.style.padding =
55
86
  row.variant === 'summary' ? '24px 12px 20px' : '0 12px';
@@ -160,8 +191,10 @@ function createSectionHeader(
160
191
  const value = tagSlot(
161
192
  createElement(
162
193
  document,
163
- row.valueActionKey ? 'button' : 'span',
164
- row.valueActionKey
194
+ row.valueActionKey || row.valueHelp?.presentation === 'popover'
195
+ ? 'button'
196
+ : 'span',
197
+ row.valueActionKey || row.valueHelp?.presentation === 'popover'
165
198
  ? 'ok-native-list-action-button ok-native-list-section-value'
166
199
  : 'ok-native-list-value ok-native-list-section-value',
167
200
  row.value
@@ -186,7 +219,17 @@ function createSectionHeader(
186
219
  setData(value, 'nativeListAction', row.valueActionKey);
187
220
  markActionAnchorSource(value, 'trailingAccessory', 0);
188
221
  }
189
- body.appendChild(value);
222
+ if (row.valueHelp) bindHelp(value, row.valueHelp);
223
+ if (row.style?.valuePlacement === 'afterTitle') {
224
+ value.style.marginLeft = '0';
225
+ value.style.flexShrink = '0';
226
+ value.style.alignSelf = 'center';
227
+ title.insertAdjacentElement('afterend', value);
228
+ column.style.flexDirection = 'row';
229
+ column.style.alignItems = 'center';
230
+ column.style.justifyContent = 'flex-start';
231
+ column.style.gap = '8px';
232
+ } else body.appendChild(value);
190
233
  }
191
234
  if (row.valueIcon) {
192
235
  const valueIcon = primitives.iconAction(