@onekeyfe/react-native-native-list 6.7.0-alpha.359 → 6.7.0-alpha.362

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 (112) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +0 -7
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +7 -240
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -7
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +3 -6
  5. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +0 -12
  6. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +7 -87
  7. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +1 -135
  8. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +14 -43
  9. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +0 -25
  10. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +2 -17
  11. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +0 -22
  12. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +0 -2
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +0 -2
  14. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +2 -3
  15. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +0 -69
  16. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +1 -55
  17. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +21 -585
  18. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +0 -1
  19. package/docs/ROW_TEMPLATES.md +9 -60
  20. package/docs/SPEC.md +5 -317
  21. package/docs/STYLE_SPEC.md +0 -6
  22. package/ios/HybridNativeList.swift +0 -10
  23. package/ios/NativeListAccessoryStack.swift +37 -220
  24. package/ios/NativeListActivityDetailsView.swift +8 -18
  25. package/ios/NativeListActivityRenderer.swift +2 -8
  26. package/ios/NativeListDataRowRenderer.swift +16 -128
  27. package/ios/NativeListDesignAssets.swift +0 -3
  28. package/ios/NativeListIdentityRenderer.swift +5 -123
  29. package/ios/NativeListLeadingVisual.swift +14 -49
  30. package/ios/NativeListMessageRenderer.swift +1 -34
  31. package/ios/NativeListModels.swift +2 -16
  32. package/ios/NativeListRendererRegistry.swift +0 -1
  33. package/ios/NativeListResolvedText.swift +1 -2
  34. package/ios/NativeListRowHost.swift +0 -14
  35. package/ios/NativeListSectionHeaderRenderer.swift +0 -88
  36. package/ios/RNCNativeListView.swift +29 -335
  37. package/ios/tests/NativeListActivityPresentationTests.swift +0 -56
  38. package/ios/tests/NativeListLifecycleTests.swift +3 -1283
  39. package/lib/module/NativeList.js +21 -39
  40. package/lib/module/NativeList.web.js +4 -51
  41. package/lib/module/models.js +0 -1
  42. package/lib/module/selection.js +1 -1
  43. package/lib/module/validation.js +8 -320
  44. package/lib/module/web/NativeListWebEngine.js +18 -373
  45. package/lib/module/web/templates/ActivityRowRenderer.js +7 -8
  46. package/lib/module/web/templates/DataRowRenderer.js +5 -40
  47. package/lib/module/web/templates/IdentityRowRenderer.js +4 -90
  48. package/lib/module/web/templates/MessageRowRenderer.js +2 -18
  49. package/lib/module/web/templates/RowContainerStyle.js +0 -1
  50. package/lib/module/web/templates/RowRendererRegistry.js +0 -3
  51. package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -36
  52. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  53. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  54. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  55. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  56. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  57. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  58. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  59. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  60. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  61. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  62. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  63. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  64. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  65. package/lib/typescript/src/NativeList.nitro.d.ts +0 -1
  66. package/lib/typescript/src/NativeList.types.d.ts +0 -8
  67. package/lib/typescript/src/models.d.ts +9 -101
  68. package/lib/typescript/src/validation.d.ts +0 -10
  69. package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -26
  70. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  71. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +3 -9
  72. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  73. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  74. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  76. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  77. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  78. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  79. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  80. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  81. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  82. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  83. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  84. package/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  85. package/package.json +3 -3
  86. package/react-native-native-list.podspec +0 -1
  87. package/src/NativeList.nitro.ts +0 -1
  88. package/src/NativeList.tsx +24 -72
  89. package/src/NativeList.types.ts +0 -9
  90. package/src/NativeList.web.tsx +8 -72
  91. package/src/models.ts +3 -113
  92. package/src/selection.ts +0 -1
  93. package/src/validation.ts +6 -721
  94. package/src/web/NativeListWebEngine.ts +19 -568
  95. package/src/web/templates/ActivityRowRenderer.ts +6 -14
  96. package/src/web/templates/DataRowRenderer.ts +20 -93
  97. package/src/web/templates/IdentityRowRenderer.ts +5 -150
  98. package/src/web/templates/MessageRowRenderer.ts +7 -23
  99. package/src/web/templates/RowContainerStyle.ts +0 -2
  100. package/src/web/templates/RowRendererRegistry.ts +1 -11
  101. package/src/web/templates/SectionHeaderRowRenderer.ts +4 -47
  102. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +0 -102
  103. package/ios/NativeListButtonGroupRenderer.swift +0 -89
  104. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
  105. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
  106. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
  107. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
  108. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
  109. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
  110. package/lib/module/web/templates/ButtonGroupRowRenderer.js +0 -47
  111. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +0 -14
  112. package/src/web/templates/ButtonGroupRowRenderer.ts +0 -58
@@ -1,102 +0,0 @@
1
- package com.margelo.nitro.nativelist
2
-
3
- import android.content.res.ColorStateList
4
- import android.graphics.Color
5
- import android.graphics.drawable.GradientDrawable
6
- import android.graphics.drawable.StateListDrawable
7
- import android.view.Gravity
8
- import android.view.View
9
- import android.widget.FrameLayout
10
- import android.widget.LinearLayout
11
- import android.widget.ProgressBar
12
- import androidx.core.widget.TextViewCompat
13
- import com.facebook.react.uimanager.ThemedReactContext
14
- import org.json.JSONObject
15
-
16
- internal class NativeListButtonGroupRowView(context: ThemedReactContext, fonts: NativeListFonts) :
17
- NativeListRendererRowView(context, fonts) {
18
- private var generation = 0
19
- private var rowOpacity = 1f
20
-
21
- override fun appearance() {
22
- super.appearance()
23
- alpha = rowOpacity
24
- }
25
- override fun defaultHeight(item: NativeListItem, layout: String) = 64
26
-
27
- override fun bindContent(
28
- item: NativeListItem,
29
- theme: JSONObject?,
30
- layout: String,
31
- checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String,
32
- ) {
33
- recycleContent()
34
- rowOpacity = (item.json.optJSONObject("style")?.optJSONObject("container")?.optDouble("opacity", item.json.optDouble("opacity", 1.0)) ?: item.json.optDouble("opacity", 1.0)).toFloat()
35
- orientation = HORIZONTAL
36
- gravity = Gravity.CENTER_VERTICAL
37
- setPadding(0, dp(8), 0, dp(8))
38
- val info = parseNativeListColor(theme?.optString("info", "#0F69F6") ?: "#0F69F6")
39
- val descriptors = item.json.optJSONArray("buttons") ?: return
40
- val epoch = generation
41
- for (index in 0 until descriptors.length()) {
42
- val descriptor = descriptors.getJSONObject(index)
43
- val enabled = !item.json.optBoolean("disabled") && !descriptor.optBoolean("disabled") && !descriptor.optBoolean("loading")
44
- val button = FrameLayout(context).apply {
45
- isEnabled = enabled
46
- alpha = if (enabled) 1f else 0.4f
47
- contentDescription = descriptor.optString("accessibilityLabel", descriptor.optString("label"))
48
- setTag(com.facebook.react.R.id.react_test_id, descriptor.optString("testID").takeIf { it.isNotEmpty() })
49
- background = StateListDrawable().apply {
50
- fun fill(pressed: Boolean) = GradientDrawable().apply {
51
- setColor(if (pressed) (info and 0x00FFFFFF) or (43 shl 24) else Color.TRANSPARENT)
52
- cornerRadius = dp(12).toFloat()
53
- setStroke(dp(1), (info and 0x00FFFFFF) or (89 shl 24))
54
- }
55
- addState(intArrayOf(android.R.attr.state_pressed), fill(true))
56
- addState(intArrayOf(), fill(false))
57
- }
58
- }
59
- val label = NativeListTextView(context).apply {
60
- text = descriptor.optString("label")
61
- textSize = NativeListScale.font(resources, 14f)
62
- typeface = fonts.medium(context)
63
- setTextColor(info)
64
- gravity = Gravity.CENTER
65
- includeFontPadding = false
66
- maxLines = 1
67
- ellipsize = android.text.TextUtils.TruncateAt.END
68
- TextViewCompat.setLineHeight(this, dp(20))
69
- importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
70
- }
71
- val content = LinearLayout(context).apply {
72
- orientation = HORIZONTAL
73
- gravity = Gravity.CENTER
74
- setPadding(dp(8), dp(12), dp(8), dp(12))
75
- importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
76
- }
77
- button.addView(content, FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
78
- if (descriptor.optBoolean("loading")) {
79
- val spinner = ProgressBar(context, null, android.R.attr.progressBarStyleSmall).apply {
80
- isIndeterminate = true
81
- indeterminateTintList = ColorStateList.valueOf(info)
82
- importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
83
- }
84
- content.addView(spinner, LayoutParams(dp(20), dp(20)).apply { marginEnd = dp(8) })
85
- }
86
- content.addView(label, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT))
87
- button.setOnClickListener {
88
- if (generation == epoch && enabled) emitAction(descriptor.optString("actionKey"), button, "buttonGroup", index)
89
- }
90
- button.isClickable = enabled
91
- addView(button, LayoutParams(0, dp(48), 1f).apply { if (index > 0) marginStart = dp(10) })
92
- }
93
- }
94
-
95
- override fun recycleContent() {
96
- generation += 1
97
- for (index in 0 until childCount) getChildAt(index).setOnClickListener(null)
98
- removeAllViews()
99
- }
100
-
101
- override fun disposeContent() = recycleContent()
102
- }
@@ -1,89 +0,0 @@
1
- import UIKit
2
-
3
- final class NativeListButtonGroupCell: NativeListRendererCell {
4
- override class func measure(
5
- _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
6
- fonts: NativeListFontFamilies
7
- ) -> CGFloat? { 64 }
8
-
9
- private var buttons: [UIButton] = []
10
- private var actionKeys: [String] = []
11
- private var rowOpacity: CGFloat = 1
12
-
13
- override func applyAppearance() {
14
- super.applyAppearance()
15
- contentView.alpha = rowOpacity
16
- }
17
-
18
- override init(frame: CGRect) {
19
- super.init(frame: frame)
20
- root.axis = .horizontal
21
- root.alignment = .fill
22
- root.distribution = .fillEqually
23
- root.spacing = 10
24
- }
25
- required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
26
-
27
- override func bindContent(
28
- _ item: NativeListItem, theme: [String: Any]?, layout: String,
29
- checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
30
- ) {
31
- recycleContent()
32
- rowOpacity = CGFloat(item.data.dictionary("style")?.dictionary("container")?.double("opacity", default: item.data.double("opacity", default: 1)) ?? item.data.double("opacity", default: 1))
33
- contentInsets = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)
34
- let info = nativeListColor(theme, "info", "#0F69F6")
35
- for (index, descriptor) in item.data.dictionaries("buttons").enumerated() {
36
- let button = NativeListAccessoryButton(type: .custom)
37
- button.tag = index
38
- button.setTitle(descriptor.string("label"), for: .normal)
39
- button.titleLabel?.font = nativeListFont(ofSize: 14, weight: .medium, fonts: fonts)
40
- button.titleLabel?.lineBreakMode = .byTruncatingTail
41
- button.setTitleColor(info, for: .normal)
42
- button.contentEdgeInsets = UIEdgeInsets(top: 12, left: 8, bottom: 12, right: 8)
43
- button.layer.cornerRadius = 12
44
- button.layer.borderWidth = 1
45
- button.layer.borderColor = info.withAlphaComponent(0.35).cgColor
46
- button.normalBackgroundColor = .clear
47
- button.pressedBackgroundColor = info.withAlphaComponent(0.17)
48
- button.isEnabled = !item.data.bool("disabled") && !descriptor.bool("disabled") && !descriptor.bool("loading")
49
- button.alpha = button.isEnabled ? 1 : 0.4
50
- button.accessibilityIdentifier = descriptor["testID"] as? String
51
- button.accessibilityLabel = descriptor.string("accessibilityLabel", default: descriptor.string("label"))
52
- button.addTarget(self, action: #selector(pressed(_:)), for: .touchUpInside)
53
- if descriptor.bool("loading"), let titleLabel = button.titleLabel {
54
- let spinner = UIActivityIndicatorView(style: .medium)
55
- spinner.color = info
56
- spinner.isUserInteractionEnabled = false
57
- spinner.translatesAutoresizingMaskIntoConstraints = false
58
- button.addSubview(spinner)
59
- button.contentEdgeInsets = UIEdgeInsets(top: 12, left: 36, bottom: 12, right: 8)
60
- NSLayoutConstraint.activate([
61
- spinner.trailingAnchor.constraint(equalTo: titleLabel.leadingAnchor, constant: -8),
62
- spinner.centerYAnchor.constraint(equalTo: button.centerYAnchor),
63
- spinner.widthAnchor.constraint(equalToConstant: 20),
64
- spinner.heightAnchor.constraint(equalToConstant: 20),
65
- ])
66
- spinner.startAnimating()
67
- }
68
- buttons.append(button)
69
- actionKeys.append(descriptor.string("actionKey"))
70
- root.addArrangedSubview(button)
71
- }
72
- }
73
-
74
- @objc private func pressed(_ button: UIButton) {
75
- guard button.isEnabled, buttons.indices.contains(button.tag), buttons[button.tag] === button else { return }
76
- emitAction(actionKeys[button.tag], from: button, source: "buttonGroup", slot: button.tag)
77
- }
78
-
79
- override func recycleContent() {
80
- for button in buttons {
81
- button.removeTarget(self, action: nil, for: .allEvents)
82
- button.subviews.compactMap { $0 as? UIActivityIndicatorView }.forEach { $0.stopAnimating() }
83
- root.removeArrangedSubview(button)
84
- button.removeFromSuperview()
85
- }
86
- buttons.removeAll()
87
- actionKeys.removeAll()
88
- }
89
- }
@@ -1,15 +0,0 @@
1
- {
2
- "images": [
3
- {
4
- "filename": "icon.svg",
5
- "idiom": "universal"
6
- }
7
- ],
8
- "info": {
9
- "author": "xcode",
10
- "version": 1
11
- },
12
- "properties": {
13
- "preserves-vector-representation": true
14
- }
15
- }
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
- <path d="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"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="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"/>
4
- </svg>
@@ -1,15 +0,0 @@
1
- {
2
- "images": [
3
- {
4
- "filename": "icon.svg",
5
- "idiom": "universal"
6
- }
7
- ],
8
- "info": {
9
- "author": "xcode",
10
- "version": 1
11
- },
12
- "properties": {
13
- "preserves-vector-representation": true
14
- }
15
- }
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z"/>
3
- </svg>
@@ -1,15 +0,0 @@
1
- {
2
- "images": [
3
- {
4
- "filename": "icon.svg",
5
- "idiom": "universal"
6
- }
7
- ],
8
- "info": {
9
- "author": "xcode",
10
- "version": 1
11
- },
12
- "properties": {
13
- "preserves-vector-representation": true
14
- }
15
- }
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
2
- <path d="M5 12a7 7 0 0 0 7 7 7.15 7.15 0 0 0 4.955-2h-2.943v-2h6v6h-2v-2.257A9.148 9.148 0 0 1 12 21a9 9 0 0 1-9-9v-1h2v1Zm1-6.754A9.148 9.148 0 0 1 12 3a9 9 0 0 1 9 9v1h-2v-1a7 7 0 0 0-7-7 7.15 7.15 0 0 0-4.955 2H10v2H4V3h2v2.246Z"/>
3
- </svg>
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- import { markActionAnchorSource } from "./RowElements.js";
4
- function bind(body, row) {
5
- body.replaceChildren();
6
- body.className = 'ok-native-list-row ok-native-list-button-group';
7
- body.removeAttribute('data-nl-container-background');
8
- body.removeAttribute('data-nl-container-border');
9
- row.buttons.forEach((descriptor, index) => {
10
- const button = body.ownerDocument.createElement('button');
11
- button.type = 'button';
12
- button.className = 'ok-native-list-block-button';
13
- button.dataset.nativeListAction = descriptor.actionKey;
14
- button.dataset.nlButtonKey = descriptor.key;
15
- button.dataset.nlSlot = `button-${index}`;
16
- if (descriptor.testID) button.dataset.testid = descriptor.testID;
17
- button.setAttribute('aria-label', descriptor.accessibilityLabel ?? descriptor.label);
18
- button.disabled = Boolean(row.disabled || descriptor.disabled || descriptor.loading);
19
- button.setAttribute('aria-busy', descriptor.loading ? 'true' : 'false');
20
- markActionAnchorSource(button, 'buttonGroup', index);
21
- const label = body.ownerDocument.createElement('span');
22
- label.textContent = descriptor.label;
23
- if (descriptor.loading) {
24
- const spinner = body.ownerDocument.createElement('span');
25
- spinner.className = 'ok-native-list-spinner';
26
- spinner.setAttribute('role', 'progressbar');
27
- button.appendChild(spinner);
28
- }
29
- button.appendChild(label);
30
- body.appendChild(button);
31
- });
32
- }
33
- function create(document, row, _primitives) {
34
- const body = document.createElement('div');
35
- body.dataset.nlRenderer = 'buttonGroup';
36
- bind(body, row);
37
- return body;
38
- }
39
- export const buttonGroupRowRenderer = {
40
- key: 'buttonGroup',
41
- create,
42
- bind,
43
- recycle: body => body.replaceChildren(),
44
- measure: (_row, _width) => 64,
45
- measureRendered: body => body.scrollHeight
46
- };
47
- //# sourceMappingURL=ButtonGroupRowRenderer.js.map
@@ -1,14 +0,0 @@
1
- import type { ButtonGroupRow } from '../../models';
2
- import type { RowPrimitives } from './RowVisual';
3
- declare function bind(body: HTMLElement, row: ButtonGroupRow): void;
4
- declare function create(document: Document, row: ButtonGroupRow, _primitives: RowPrimitives): HTMLDivElement;
5
- export declare const buttonGroupRowRenderer: {
6
- key: "buttonGroup";
7
- create: typeof create;
8
- bind: typeof bind;
9
- recycle: (body: HTMLElement) => void;
10
- measure: (_row: ButtonGroupRow, _width: number) => number;
11
- measureRendered: (body: HTMLElement) => number;
12
- };
13
- export {};
14
- //# sourceMappingURL=ButtonGroupRowRenderer.d.ts.map
@@ -1,58 +0,0 @@
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
- };