storybook-nitroui-controls 0.2.2 → 0.3.0

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 (102) hide show
  1. package/README.md +9 -7
  2. package/android/src/main/java/com/margelo/nitro/sbcontrols/HybridNativeCodeEditor.kt +43 -2
  3. package/android/src/main/java/com/margelo/nitro/sbcontrols/HybridNativeSlider.kt +6 -0
  4. package/android/src/main/java/com/margelo/nitro/sbcontrols/HybridNativeSwitch.kt +6 -0
  5. package/demo/ControlsDemo.tsx +5 -5
  6. package/ios/HybridNativeCodeEditor.swift +9 -1
  7. package/ios/HybridNativeSlider.swift +4 -0
  8. package/ios/HybridNativeSwitch.swift +5 -0
  9. package/nitrogen/generated/android/c++/JHybridNativeCodeEditorSpec.cpp +10 -0
  10. package/nitrogen/generated/android/c++/JHybridNativeSliderSpec.cpp +14 -2
  11. package/nitrogen/generated/android/c++/JHybridNativeSwitchSpec.cpp +14 -2
  12. package/nitrogen/generated/android/c++/include/StorybookNitroControls/private/JHybridNativeCodeEditorSpec.hpp +2 -0
  13. package/nitrogen/generated/android/c++/include/StorybookNitroControls/private/JHybridNativeSliderSpec.hpp +6 -2
  14. package/nitrogen/generated/android/c++/include/StorybookNitroControls/private/JHybridNativeSwitchSpec.hpp +6 -2
  15. package/nitrogen/generated/android/kotlin/com/margelo/nitro/sbcontrols/HybridNativeCodeEditorSpec.kt +6 -0
  16. package/nitrogen/generated/android/kotlin/com/margelo/nitro/sbcontrols/HybridNativeSliderSpec.kt +6 -0
  17. package/nitrogen/generated/android/kotlin/com/margelo/nitro/sbcontrols/HybridNativeSwitchSpec.kt +6 -0
  18. package/nitrogen/generated/apple/c++/HybridNativeCodeEditorSpecSwift.cpp +9 -0
  19. package/nitrogen/generated/apple/c++/HybridNativeSliderSpecSwift.cpp +9 -0
  20. package/nitrogen/generated/apple/c++/HybridNativeSwitchSpecSwift.cpp +9 -0
  21. package/nitrogen/generated/apple/c++/include/StorybookNitroControls/private/HybridNativeCodeEditorSpecSwift.hpp +2 -0
  22. package/nitrogen/generated/apple/c++/include/StorybookNitroControls/private/HybridNativeSliderSpecSwift.hpp +2 -0
  23. package/nitrogen/generated/apple/c++/include/StorybookNitroControls/private/HybridNativeSwitchSpecSwift.hpp +2 -0
  24. package/nitrogen/generated/apple/swift/HybridNativeCodeEditorSpec.swift +1 -0
  25. package/nitrogen/generated/apple/swift/HybridNativeCodeEditorSpec_cxx.swift +9 -0
  26. package/nitrogen/generated/apple/swift/HybridNativeSliderSpec.swift +1 -0
  27. package/nitrogen/generated/apple/swift/HybridNativeSliderSpec_cxx.swift +9 -0
  28. package/nitrogen/generated/apple/swift/HybridNativeSwitchSpec.swift +1 -0
  29. package/nitrogen/generated/apple/swift/HybridNativeSwitchSpec_cxx.swift +9 -0
  30. package/package.json +15 -4
  31. package/src/components/CodeEditor.tsx +10 -3
  32. package/src/components/Slider.tsx +6 -1
  33. package/src/components/Switch.tsx +6 -3
  34. package/src/specs/NativeCodeEditor.nitro.ts +2 -0
  35. package/src/specs/NativeSlider.nitro.ts +2 -0
  36. package/src/specs/NativeSwitch.nitro.ts +2 -0
  37. package/types/demo/ControlsDemo.d.ts +3 -0
  38. package/types/demo/ControlsDemo.d.ts.map +1 -0
  39. package/types/src/Option.d.ts +6 -0
  40. package/types/src/Option.d.ts.map +1 -0
  41. package/types/src/components/ChoiceList.d.ts +45 -0
  42. package/types/src/components/ChoiceList.d.ts.map +1 -0
  43. package/types/src/components/CodeEditor.d.ts +37 -0
  44. package/types/src/components/CodeEditor.d.ts.map +1 -0
  45. package/types/src/components/ColorWell.d.ts +39 -0
  46. package/types/src/components/ColorWell.d.ts.map +1 -0
  47. package/types/src/components/DatePicker.d.ts +33 -0
  48. package/types/src/components/DatePicker.d.ts.map +1 -0
  49. package/types/src/components/MultiSelect.d.ts +37 -0
  50. package/types/src/components/MultiSelect.d.ts.map +1 -0
  51. package/types/src/components/SegmentedControl.d.ts +29 -0
  52. package/types/src/components/SegmentedControl.d.ts.map +1 -0
  53. package/types/src/components/SelectMenu.d.ts +32 -0
  54. package/types/src/components/SelectMenu.d.ts.map +1 -0
  55. package/types/src/components/Slider.d.ts +36 -0
  56. package/types/src/components/Slider.d.ts.map +1 -0
  57. package/types/src/components/Stepper.d.ts +34 -0
  58. package/types/src/components/Stepper.d.ts.map +1 -0
  59. package/types/src/components/Switch.d.ts +26 -0
  60. package/types/src/components/Switch.d.ts.map +1 -0
  61. package/types/src/index.d.ts +16 -0
  62. package/types/src/index.d.ts.map +1 -0
  63. package/types/src/pickFile.d.ts +16 -0
  64. package/types/src/pickFile.d.ts.map +1 -0
  65. package/types/src/specs/DatePickerMode.d.ts +2 -0
  66. package/types/src/specs/DatePickerMode.d.ts.map +1 -0
  67. package/types/src/specs/FilePicker.nitro.d.ts +13 -0
  68. package/types/src/specs/FilePicker.nitro.d.ts.map +1 -0
  69. package/types/src/specs/MultiSelectPresentation.d.ts +3 -0
  70. package/types/src/specs/MultiSelectPresentation.d.ts.map +1 -0
  71. package/types/src/specs/NativeChoiceList.nitro.d.ts +18 -0
  72. package/types/src/specs/NativeChoiceList.nitro.d.ts.map +1 -0
  73. package/types/src/specs/NativeCodeEditor.nitro.d.ts +23 -0
  74. package/types/src/specs/NativeCodeEditor.nitro.d.ts.map +1 -0
  75. package/types/src/specs/NativeColorWell.nitro.d.ts +17 -0
  76. package/types/src/specs/NativeColorWell.nitro.d.ts.map +1 -0
  77. package/types/src/specs/NativeDatePicker.nitro.d.ts +16 -0
  78. package/types/src/specs/NativeDatePicker.nitro.d.ts.map +1 -0
  79. package/types/src/specs/NativeMultiSelect.nitro.d.ts +18 -0
  80. package/types/src/specs/NativeMultiSelect.nitro.d.ts.map +1 -0
  81. package/types/src/specs/NativeSegmentedControl.nitro.d.ts +12 -0
  82. package/types/src/specs/NativeSegmentedControl.nitro.d.ts.map +1 -0
  83. package/types/src/specs/NativeSelectMenu.nitro.d.ts +13 -0
  84. package/types/src/specs/NativeSelectMenu.nitro.d.ts.map +1 -0
  85. package/types/src/specs/NativeSlider.nitro.d.ts +19 -0
  86. package/types/src/specs/NativeSlider.nitro.d.ts.map +1 -0
  87. package/types/src/specs/NativeStepper.nitro.d.ts +18 -0
  88. package/types/src/specs/NativeStepper.nitro.d.ts.map +1 -0
  89. package/types/src/specs/NativeSwitch.nitro.d.ts +13 -0
  90. package/types/src/specs/NativeSwitch.nitro.d.ts.map +1 -0
  91. package/types/src/specs/PickFileOptions.d.ts +6 -0
  92. package/types/src/specs/PickFileOptions.d.ts.map +1 -0
  93. package/types/src/specs/PickedFile.d.ts +9 -0
  94. package/types/src/specs/PickedFile.d.ts.map +1 -0
  95. package/types/src/utils/hexColor.d.ts +5 -0
  96. package/types/src/utils/hexColor.d.ts.map +1 -0
  97. package/types/src/utils/optionIndex.d.ts +4 -0
  98. package/types/src/utils/optionIndex.d.ts.map +1 -0
  99. package/types/src/utils/useLabels.d.ts +4 -0
  100. package/types/src/utils/useLabels.d.ts.map +1 -0
  101. package/types/src/utils/useNativeControl.d.ts +30 -0
  102. package/types/src/utils/useNativeControl.d.ts.map +1 -0
package/README.md CHANGED
@@ -26,15 +26,16 @@ user's value while the owner answers, so an owner that updates `value` asynchron
26
26
  update after the story re-renders) does not make it jump back first. If the owner does not accept a change
27
27
  (`value` still differs 1 s after the last user change), the native widget is set back to `value`, like a
28
28
  controlled React DOM input. All values are plain JS values. Every component also accepts the shared NitroUI
29
- view props (`layout`, `style`, `gestureRecognizers`) and `disabled`.
29
+ view props (`layout`, `style`, `gestureRecognizers`) and `disabled`. `Switch` and `Slider` take an
30
+ `accessibilityLabel` for VoiceOver, TalkBack and UI automation, since nothing else names them.
30
31
 
31
32
  ```ts
32
33
  type Option = { label: string; value: string }
33
34
 
34
- <Switch value={boolean} onValueChange={(v: boolean) => void} disabled? />
35
+ <Switch value={boolean} onValueChange={(v: boolean) => void} disabled? accessibilityLabel?={string} />
35
36
 
36
37
  <Slider value={number} min={number} max={number} step?={number}
37
- onValueChange={(v: number) => void} onSlidingComplete?={(v: number) => void} />
38
+ onValueChange={(v: number) => void} onSlidingComplete?={(v: number) => void} accessibilityLabel?={string} />
38
39
 
39
40
  <Stepper value={number} min?={number} max?={number} step?={number} onValueChange={(v: number) => void} />
40
41
 
@@ -57,7 +58,7 @@ type Option = { label: string; value: string }
57
58
  presets?={string[]} onValueChange={(v: string) => void} />
58
59
 
59
60
  <CodeEditor text={string} onTextChange={(v: string) => void} textColor?={number /* 0xRRGGBBAA */}
60
- fontSize?={number} disabled? />
61
+ fontSize?={number} disabled? readOnly? />
61
62
 
62
63
  pickFile(opts?: { types?: string[]; multiple?: boolean }):
63
64
  Promise<{ uri: string; name: string; mimeType?: string; size?: number }[]>
@@ -72,8 +73,8 @@ function Example() {
72
73
  const [volume, setVolume] = useState(40)
73
74
  return (
74
75
  <>
75
- <Switch value={on} onValueChange={setOn} />
76
- <Slider value={volume} min={0} max={100} step={5} onValueChange={setVolume} />
76
+ <Switch value={on} onValueChange={setOn} accessibilityLabel="Notifications" />
77
+ <Slider value={volume} min={0} max={100} step={5} onValueChange={setVolume} accessibilityLabel="Volume" />
77
78
  </>
78
79
  )
79
80
  }
@@ -98,7 +99,8 @@ Details:
98
99
  `supportsAlpha`, picked colors are made opaque. Preset swatches select a color on tap.
99
100
  - `CodeEditor`: a multiline editor for JSON and code, with autocorrection, suggestions and smart
100
101
  punctuation off. It has no background or border, so draw the frame around it. `text` is applied while
101
- the editor is not focused; `onTextChange` reports user edits only.
102
+ the editor is not focused; `onTextChange` reports user edits only. `readOnly` shows text to read,
103
+ select and copy, at full opacity and without a keyboard (Cut and Paste are left out of the menu).
102
104
  - `pickFile`: resolves with an empty array when the user cancels.
103
105
 
104
106
  ## Sizing
@@ -6,6 +6,9 @@ import android.text.Editable
6
6
  import android.text.InputType
7
7
  import android.text.TextWatcher
8
8
  import android.util.TypedValue
9
+ import android.view.ActionMode
10
+ import android.view.Menu
11
+ import android.view.MenuItem
9
12
  import android.view.Gravity
10
13
  import android.view.MotionEvent
11
14
  import android.widget.EditText
@@ -69,11 +72,50 @@ private constructor(
69
72
  editor.alpha = if (value) 1f else 0.5f
70
73
  }
71
74
 
75
+ override var readOnly: Boolean = false
76
+ set(value) {
77
+ if (field == value) return
78
+ field = value
79
+ // TYPE_NULL keeps the keyboard away; text stays selectable (long press, Copy). TYPE_NULL makes
80
+ // the view single-line, so multi-line wrapping is restored after it.
81
+ editor.inputType = if (value) InputType.TYPE_NULL else EDITABLE_INPUT
82
+ editor.isSingleLine = false
83
+ editor.setHorizontallyScrolling(false)
84
+ editor.setTextIsSelectable(value)
85
+ editor.showSoftInputOnFocus = !value
86
+ // The selection menu would still offer Cut and Paste on an EditText; only Copy, Share and Select all stay.
87
+ editor.customSelectionActionModeCallback = if (value) ReadOnlySelection else null
88
+ editor.customInsertionActionModeCallback = if (value) ReadOnlySelection else null
89
+ // setTextIsSelectable(false) also clears these.
90
+ if (!value) {
91
+ editor.isFocusableInTouchMode = true
92
+ editor.isFocusable = true
93
+ editor.isClickable = true
94
+ editor.isLongClickable = true
95
+ }
96
+ nativeState.layoutNode.markDirty()
97
+ }
98
+
72
99
  override fun setOnTextChange(listener: Callback<(text: String) -> Unit>?) {
73
100
  this.listener = listener
74
101
  }
75
102
 
103
+ private object ReadOnlySelection : ActionMode.Callback {
104
+ override fun onCreateActionMode(mode: ActionMode, menu: Menu) = true
105
+ override fun onPrepareActionMode(mode: ActionMode, menu: Menu): Boolean {
106
+ menu.removeItem(android.R.id.cut)
107
+ menu.removeItem(android.R.id.paste)
108
+ menu.removeItem(android.R.id.pasteAsPlainText)
109
+ return true
110
+ }
111
+ override fun onActionItemClicked(mode: ActionMode, item: MenuItem) = false
112
+ override fun onDestroyActionMode(mode: ActionMode) = Unit
113
+ }
114
+
76
115
  companion object : HybridNativeCodeEditorSpec.Companion {
116
+ private const val EDITABLE_INPUT =
117
+ InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
118
+
77
119
  @SuppressLint("ClickableViewAccessibility")
78
120
  override fun constructor(): HybridNativeCodeEditor {
79
121
  val context = AndroidHost.context
@@ -82,8 +124,7 @@ private constructor(
82
124
  editor.typeface = Typeface.MONOSPACE
83
125
  editor.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13f)
84
126
  editor.gravity = Gravity.TOP or Gravity.START
85
- editor.inputType =
86
- InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
127
+ editor.inputType = EDITABLE_INPUT
87
128
  editor.setHorizontallyScrolling(false)
88
129
  editor.isVerticalScrollBarEnabled = true
89
130
  editor.minLines = 1
@@ -51,6 +51,12 @@ private constructor(
51
51
  override var minimumValue: Double = 0.0
52
52
  override var maximumValue: Double = 1.0
53
53
  override var step: Double = 0.0
54
+ override var accessibilityLabel: String?
55
+ get() = control.contentDescription?.toString()
56
+ set(value) {
57
+ control.contentDescription = value
58
+ }
59
+
54
60
  override var enabled: Boolean
55
61
  get() = control.isEnabled
56
62
  set(value) {
@@ -39,6 +39,12 @@ private constructor(
39
39
  control.isEnabled = value
40
40
  }
41
41
 
42
+ override var accessibilityLabel: String?
43
+ get() = control.contentDescription?.toString()
44
+ set(value) {
45
+ control.contentDescription = value
46
+ }
47
+
42
48
  override fun setOnValueChange(listener: Callback<(value: Boolean) -> Unit>?) {
43
49
  this.listener = listener
44
50
  }
@@ -92,19 +92,19 @@ export function ControlsDemo() {
92
92
  <ScrollViewContent layout={{ padding: 20, paddingTop: 64, paddingBottom: 48 }}>
93
93
  <Text fontSize={28} fontWeight="bold" color={dark ? 'white' : 'black'}>Controls</Text>
94
94
  <Row title="Disable all" value={String(disabled)}>
95
- <Switch value={disabled} onValueChange={setDisabled} />
95
+ <Switch value={disabled} onValueChange={setDisabled} accessibilityLabel="Disable all" />
96
96
  </Row>
97
97
  <Row title="Locked switch (rejects changes)" value={`value stays ${locked}`}>
98
- <Switch value={locked} onValueChange={() => {}} disabled={disabled} />
98
+ <Switch value={locked} onValueChange={() => {}} disabled={disabled} accessibilityLabel="Locked switch" />
99
99
  </Row>
100
100
  <Row title="Switch" value={String(enabled)}>
101
- <Switch value={enabled} onValueChange={setEnabled} disabled={disabled} />
101
+ <Switch value={enabled} onValueChange={setEnabled} disabled={disabled} accessibilityLabel="Switch" />
102
102
  </Row>
103
103
  <Row title="Slider (step 5)" value={`value ${volume}, released at ${released ?? '-'}`} stacked>
104
- <Slider value={volume} min={0} max={100} step={5} onValueChange={setVolume} onSlidingComplete={setReleased} disabled={disabled} />
104
+ <Slider value={volume} min={0} max={100} step={5} onValueChange={setVolume} onSlidingComplete={setReleased} disabled={disabled} accessibilityLabel="Slider (step 5)" />
105
105
  </Row>
106
106
  <Row title="Slider (continuous)" value={opacity.toFixed(3)} stacked>
107
- <Slider value={opacity} min={0} max={1} onValueChange={setOpacity} disabled={disabled} />
107
+ <Slider value={opacity} min={0} max={1} onValueChange={setOpacity} disabled={disabled} accessibilityLabel="Slider (continuous)" />
108
108
  </Row>
109
109
  <Row title="Stepper" value={`${count} (min 0, max 10, step 0.5)`}>
110
110
  <Stepper value={count} min={0} max={10} step={0.5} onValueChange={setCount} disabled={disabled} />
@@ -70,11 +70,19 @@ final class HybridNativeCodeEditor: HybridNativeCodeEditorSpec {
70
70
 
71
71
  var enabled: Bool = true {
72
72
  didSet {
73
- view.isEditable = enabled
73
+ view.isEditable = enabled && !readOnly
74
74
  view.alpha = enabled ? 1 : 0.5
75
75
  }
76
76
  }
77
77
 
78
+ var readOnly: Bool = false {
79
+ didSet {
80
+ // Not editable, still selectable: long press selects and offers Copy.
81
+ view.isEditable = enabled && !readOnly
82
+ view.isSelectable = true
83
+ }
84
+ }
85
+
78
86
  private func applyFont() {
79
87
  let size = CGFloat(fontSize)
80
88
  view.font = UIFont(name: "Menlo", size: size) ?? .monospacedSystemFont(ofSize: size, weight: .regular)
@@ -35,6 +35,10 @@ final class HybridNativeSlider: HybridNativeSliderSpec {
35
35
  var minimumValue: Double = 0
36
36
  var maximumValue: Double = 1
37
37
  var step: Double = 0
38
+ var accessibilityLabel: String? {
39
+ get { view.accessibilityLabel }
40
+ set { view.accessibilityLabel = newValue }
41
+ }
38
42
  var enabled: Bool {
39
43
  get { view.isEnabled }
40
44
  set { view.isEnabled = newValue }
@@ -35,6 +35,11 @@ final class HybridNativeSwitch: HybridNativeSwitchSpec {
35
35
  set { view.isEnabled = newValue }
36
36
  }
37
37
 
38
+ var accessibilityLabel: String? {
39
+ get { view.accessibilityLabel }
40
+ set { view.accessibilityLabel = newValue }
41
+ }
42
+
38
43
  func setOnValueChange(listener: (any Callback<(Bool), Void>)?) throws {
39
44
  self.listener = listener
40
45
  }
@@ -34,6 +34,7 @@ namespace margelo::nitro::sbcontrols {
34
34
  clazz.registerHybridProperty("textColor", &JHybridNativeCodeEditorSpec::getTextColor, &JHybridNativeCodeEditorSpec::setTextColor);
35
35
  clazz.registerHybridProperty("fontSize", &JHybridNativeCodeEditorSpec::getFontSize, &JHybridNativeCodeEditorSpec::setFontSize);
36
36
  clazz.registerHybridProperty("enabled", &JHybridNativeCodeEditorSpec::getEnabled, &JHybridNativeCodeEditorSpec::setEnabled);
37
+ clazz.registerHybridProperty("readOnly", &JHybridNativeCodeEditorSpec::getReadOnly, &JHybridNativeCodeEditorSpec::setReadOnly);
37
38
  clazz.registerHybridMethod("setOnTextChange", &JHybridNativeCodeEditorSpec::setOnTextChange);
38
39
  clazz.registerHybridConstructor(&JHybridNativeCodeEditorSpec::constructor);
39
40
  });
@@ -115,6 +116,15 @@ namespace margelo::nitro::sbcontrols {
115
116
  static const auto __method = CxxPart::getClass()->getNonvirtualMethod<void(jboolean /* enabled */)>("setEnabled");
116
117
  __method(_javaPart, CxxPart::getClass(), enabled);
117
118
  }
119
+ jboolean JHybridNativeCodeEditorSpec::getReadOnly() {
120
+ static const auto __method = CxxPart::getClass()->getNonvirtualMethod<jboolean()>("getReadOnly");
121
+ auto __result = __method(_javaPart, CxxPart::getClass());
122
+ return __result;
123
+ }
124
+ void JHybridNativeCodeEditorSpec::setReadOnly(jboolean readOnly) {
125
+ static const auto __method = CxxPart::getClass()->getNonvirtualMethod<void(jboolean /* readOnly */)>("setReadOnly");
126
+ __method(_javaPart, CxxPart::getClass(), readOnly);
127
+ }
118
128
 
119
129
  // Methods
120
130
  void JHybridNativeCodeEditorSpec::setOnTextChange(const jni::local_ref<JOptional<JCallback<margelo::nitro::sbcontrols::JCallback_void_std__string::JavaPart>>>& listener) {
@@ -8,10 +8,12 @@
8
8
  #include <StorybookNitroControls/private/JHybridNativeSliderSpec.hpp>
9
9
  #include <NitroModules/JNIConverter+Primitives.hpp>
10
10
  #include <NitroModules/JSIConverter+JNIPrimitives.hpp>
11
- #include <StorybookNitroControls/private/JCallback_void_double.hpp>
12
- #include <NitroModules/JNIConverter+Callback.hpp>
11
+ #include <NitroModules/JNIConverter+String.hpp>
12
+ #include <NitroModules/JSIConverter+JString.hpp>
13
13
  #include <NitroModules/JNIConverter+Optional.hpp>
14
14
  #include <NitroModules/JSIConverter+JOptional.hpp>
15
+ #include <StorybookNitroControls/private/JCallback_void_double.hpp>
16
+ #include <NitroModules/JNIConverter+Callback.hpp>
15
17
  #include <memory>
16
18
  #include <NitroModules/JNIConverter+HybridObject.hpp>
17
19
 
@@ -32,6 +34,7 @@ namespace margelo::nitro::sbcontrols {
32
34
  clazz.registerHybridProperty("maximumValue", &JHybridNativeSliderSpec::getMaximumValue, &JHybridNativeSliderSpec::setMaximumValue);
33
35
  clazz.registerHybridProperty("step", &JHybridNativeSliderSpec::getStep, &JHybridNativeSliderSpec::setStep);
34
36
  clazz.registerHybridProperty("enabled", &JHybridNativeSliderSpec::getEnabled, &JHybridNativeSliderSpec::setEnabled);
37
+ clazz.registerHybridProperty("accessibilityLabel", &JHybridNativeSliderSpec::getAccessibilityLabel, &JHybridNativeSliderSpec::setAccessibilityLabel);
35
38
  clazz.registerHybridMethod("setOnValueChange", &JHybridNativeSliderSpec::setOnValueChange);
36
39
  clazz.registerHybridMethod("setOnSlidingComplete", &JHybridNativeSliderSpec::setOnSlidingComplete);
37
40
  clazz.registerHybridConstructor(&JHybridNativeSliderSpec::constructor);
@@ -118,6 +121,15 @@ namespace margelo::nitro::sbcontrols {
118
121
  static const auto __method = CxxPart::getClass()->getNonvirtualMethod<void(jboolean /* enabled */)>("setEnabled");
119
122
  __method(_javaPart, CxxPart::getClass(), enabled);
120
123
  }
124
+ jni::local_ref<JOptional<jni::JString>> JHybridNativeSliderSpec::getAccessibilityLabel() {
125
+ static const auto __method = CxxPart::getClass()->getNonvirtualMethod<jni::local_ref<JOptional<jni::JString>>()>("getAccessibilityLabel");
126
+ auto __result = __method(_javaPart, CxxPart::getClass());
127
+ return __result;
128
+ }
129
+ void JHybridNativeSliderSpec::setAccessibilityLabel(const jni::local_ref<JOptional<jni::JString>>& accessibilityLabel) {
130
+ static const auto __method = CxxPart::getClass()->getNonvirtualMethod<void(jni::alias_ref<JOptional<jni::JString>> /* accessibilityLabel */)>("setAccessibilityLabel");
131
+ __method(_javaPart, CxxPart::getClass(), accessibilityLabel);
132
+ }
121
133
 
122
134
  // Methods
123
135
  void JHybridNativeSliderSpec::setOnValueChange(const jni::local_ref<JOptional<JCallback<margelo::nitro::sbcontrols::JCallback_void_double::JavaPart>>>& listener) {
@@ -8,10 +8,12 @@
8
8
  #include <StorybookNitroControls/private/JHybridNativeSwitchSpec.hpp>
9
9
  #include <NitroModules/JNIConverter+Primitives.hpp>
10
10
  #include <NitroModules/JSIConverter+JNIPrimitives.hpp>
11
- #include <StorybookNitroControls/private/JCallback_void_bool.hpp>
12
- #include <NitroModules/JNIConverter+Callback.hpp>
11
+ #include <NitroModules/JNIConverter+String.hpp>
12
+ #include <NitroModules/JSIConverter+JString.hpp>
13
13
  #include <NitroModules/JNIConverter+Optional.hpp>
14
14
  #include <NitroModules/JSIConverter+JOptional.hpp>
15
+ #include <StorybookNitroControls/private/JCallback_void_bool.hpp>
16
+ #include <NitroModules/JNIConverter+Callback.hpp>
15
17
  #include <memory>
16
18
  #include <NitroModules/JNIConverter+HybridObject.hpp>
17
19
 
@@ -29,6 +31,7 @@ namespace margelo::nitro::sbcontrols {
29
31
  static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
30
32
  clazz.registerHybridProperty("value", &JHybridNativeSwitchSpec::getValue, &JHybridNativeSwitchSpec::setValue);
31
33
  clazz.registerHybridProperty("enabled", &JHybridNativeSwitchSpec::getEnabled, &JHybridNativeSwitchSpec::setEnabled);
34
+ clazz.registerHybridProperty("accessibilityLabel", &JHybridNativeSwitchSpec::getAccessibilityLabel, &JHybridNativeSwitchSpec::setAccessibilityLabel);
32
35
  clazz.registerHybridMethod("setOnValueChange", &JHybridNativeSwitchSpec::setOnValueChange);
33
36
  clazz.registerHybridConstructor(&JHybridNativeSwitchSpec::constructor);
34
37
  });
@@ -87,6 +90,15 @@ namespace margelo::nitro::sbcontrols {
87
90
  static const auto __method = CxxPart::getClass()->getNonvirtualMethod<void(jboolean /* enabled */)>("setEnabled");
88
91
  __method(_javaPart, CxxPart::getClass(), enabled);
89
92
  }
93
+ jni::local_ref<JOptional<jni::JString>> JHybridNativeSwitchSpec::getAccessibilityLabel() {
94
+ static const auto __method = CxxPart::getClass()->getNonvirtualMethod<jni::local_ref<JOptional<jni::JString>>()>("getAccessibilityLabel");
95
+ auto __result = __method(_javaPart, CxxPart::getClass());
96
+ return __result;
97
+ }
98
+ void JHybridNativeSwitchSpec::setAccessibilityLabel(const jni::local_ref<JOptional<jni::JString>>& accessibilityLabel) {
99
+ static const auto __method = CxxPart::getClass()->getNonvirtualMethod<void(jni::alias_ref<JOptional<jni::JString>> /* accessibilityLabel */)>("setAccessibilityLabel");
100
+ __method(_javaPart, CxxPart::getClass(), accessibilityLabel);
101
+ }
90
102
 
91
103
  // Methods
92
104
  void JHybridNativeSwitchSpec::setOnValueChange(const jni::local_ref<JOptional<JCallback<margelo::nitro::sbcontrols::JCallback_void_bool::JavaPart>>>& listener) {
@@ -80,6 +80,8 @@ namespace margelo::nitro::sbcontrols {
80
80
  void setFontSize(jdouble fontSize);
81
81
  jboolean getEnabled();
82
82
  void setEnabled(jboolean enabled);
83
+ jboolean getReadOnly();
84
+ void setReadOnly(jboolean readOnly);
83
85
 
84
86
  public:
85
87
  // Methods
@@ -14,10 +14,12 @@
14
14
  #include <StorybookNitroControls/private/JHybridNativeSliderSpecJavaPart.hpp>
15
15
  #include <NitroModules/JNIConverter+Primitives.hpp>
16
16
  #include <NitroModules/JSIConverter+JNIPrimitives.hpp>
17
- #include <StorybookNitroControls/private/JCallback_void_double.hpp>
18
- #include <NitroModules/JNIConverter+Callback.hpp>
17
+ #include <NitroModules/JNIConverter+String.hpp>
18
+ #include <NitroModules/JSIConverter+JString.hpp>
19
19
  #include <NitroModules/JNIConverter+Optional.hpp>
20
20
  #include <NitroModules/JSIConverter+JOptional.hpp>
21
+ #include <StorybookNitroControls/private/JCallback_void_double.hpp>
22
+ #include <NitroModules/JNIConverter+Callback.hpp>
21
23
  #include <StorybookNitroControls/private/JHybridNativeSliderSpec.hpp>
22
24
  #include <memory>
23
25
  #include <NitroModules/JNIConverter+HybridObject.hpp>
@@ -79,6 +81,8 @@ namespace margelo::nitro::sbcontrols {
79
81
  void setStep(jdouble step);
80
82
  jboolean getEnabled();
81
83
  void setEnabled(jboolean enabled);
84
+ jni::local_ref<JOptional<jni::JString>> getAccessibilityLabel();
85
+ void setAccessibilityLabel(const jni::local_ref<JOptional<jni::JString>>& accessibilityLabel);
82
86
 
83
87
  public:
84
88
  // Methods
@@ -14,10 +14,12 @@
14
14
  #include <StorybookNitroControls/private/JHybridNativeSwitchSpecJavaPart.hpp>
15
15
  #include <NitroModules/JNIConverter+Primitives.hpp>
16
16
  #include <NitroModules/JSIConverter+JNIPrimitives.hpp>
17
- #include <StorybookNitroControls/private/JCallback_void_bool.hpp>
18
- #include <NitroModules/JNIConverter+Callback.hpp>
17
+ #include <NitroModules/JNIConverter+String.hpp>
18
+ #include <NitroModules/JSIConverter+JString.hpp>
19
19
  #include <NitroModules/JNIConverter+Optional.hpp>
20
20
  #include <NitroModules/JSIConverter+JOptional.hpp>
21
+ #include <StorybookNitroControls/private/JCallback_void_bool.hpp>
22
+ #include <NitroModules/JNIConverter+Callback.hpp>
21
23
  #include <StorybookNitroControls/private/JHybridNativeSwitchSpec.hpp>
22
24
  #include <memory>
23
25
  #include <NitroModules/JNIConverter+HybridObject.hpp>
@@ -73,6 +75,8 @@ namespace margelo::nitro::sbcontrols {
73
75
  void setValue(jboolean value);
74
76
  jboolean getEnabled();
75
77
  void setEnabled(jboolean enabled);
78
+ jni::local_ref<JOptional<jni::JString>> getAccessibilityLabel();
79
+ void setAccessibilityLabel(const jni::local_ref<JOptional<jni::JString>>& accessibilityLabel);
76
80
 
77
81
  public:
78
82
  // Methods
@@ -57,6 +57,12 @@ abstract class HybridNativeCodeEditorSpec: com.margelo.nitro.renderer.HybridView
57
57
  @set:Keep
58
58
  abstract var enabled: Boolean
59
59
 
60
+ @get:DoNotStrip
61
+ @get:Keep
62
+ @set:DoNotStrip
63
+ @set:Keep
64
+ abstract var readOnly: Boolean
65
+
60
66
  // Methods
61
67
  @DoNotStrip
62
68
  @Keep
@@ -59,6 +59,12 @@ abstract class HybridNativeSliderSpec: com.margelo.nitro.renderer.HybridViewSpec
59
59
  @set:Keep
60
60
  abstract var enabled: Boolean
61
61
 
62
+ @get:DoNotStrip
63
+ @get:Keep
64
+ @set:DoNotStrip
65
+ @set:Keep
66
+ abstract var accessibilityLabel: String?
67
+
62
68
  // Methods
63
69
  @DoNotStrip
64
70
  @Keep
@@ -41,6 +41,12 @@ abstract class HybridNativeSwitchSpec: com.margelo.nitro.renderer.HybridViewSpec
41
41
  @set:Keep
42
42
  abstract var enabled: Boolean
43
43
 
44
+ @get:DoNotStrip
45
+ @get:Keep
46
+ @set:DoNotStrip
47
+ @set:Keep
48
+ abstract var accessibilityLabel: String?
49
+
44
50
  // Methods
45
51
  @DoNotStrip
46
52
  @Keep
@@ -54,6 +54,14 @@ namespace margelo::nitro::sbcontrols {
54
54
  return _swiftPart.setEnabled(enabled);
55
55
  }
56
56
 
57
+ bool HybridNativeCodeEditorSpecSwift::getReadOnly() {
58
+ return _swiftPart.getReadOnly();
59
+ }
60
+
61
+ void HybridNativeCodeEditorSpecSwift::setReadOnly(bool readOnly) {
62
+ return _swiftPart.setReadOnly(readOnly);
63
+ }
64
+
57
65
  // Methods
58
66
 
59
67
  void HybridNativeCodeEditorSpecSwift::setOnTextChange(const swift::Optional<Callback<void(const swift::String&)>>& listener) {
@@ -80,6 +88,7 @@ namespace margelo::nitro::sbcontrols {
80
88
  clazz.registerHybridProperty("textColor", &HybridNativeCodeEditorSpecSwift::getTextColor, &HybridNativeCodeEditorSpecSwift::setTextColor);
81
89
  clazz.registerHybridProperty("fontSize", &HybridNativeCodeEditorSpecSwift::getFontSize, &HybridNativeCodeEditorSpecSwift::setFontSize);
82
90
  clazz.registerHybridProperty("enabled", &HybridNativeCodeEditorSpecSwift::getEnabled, &HybridNativeCodeEditorSpecSwift::setEnabled);
91
+ clazz.registerHybridProperty("readOnly", &HybridNativeCodeEditorSpecSwift::getReadOnly, &HybridNativeCodeEditorSpecSwift::setReadOnly);
83
92
  clazz.registerHybridMethod("setOnTextChange", &HybridNativeCodeEditorSpecSwift::setOnTextChange);
84
93
  clazz.registerHybridConstructor(&HybridNativeCodeEditorSpecSwift::constructor);
85
94
  });
@@ -58,6 +58,14 @@ namespace margelo::nitro::sbcontrols {
58
58
  return _swiftPart.setEnabled(enabled);
59
59
  }
60
60
 
61
+ swift::Optional<swift::String> HybridNativeSliderSpecSwift::getAccessibilityLabel() {
62
+ return _swiftPart.getAccessibilityLabel();
63
+ }
64
+
65
+ void HybridNativeSliderSpecSwift::setAccessibilityLabel(const swift::Optional<swift::String>& accessibilityLabel) {
66
+ return _swiftPart.setAccessibilityLabel(accessibilityLabel);
67
+ }
68
+
61
69
  // Methods
62
70
 
63
71
  void HybridNativeSliderSpecSwift::setOnValueChange(const swift::Optional<Callback<void(double)>>& listener) {
@@ -91,6 +99,7 @@ namespace margelo::nitro::sbcontrols {
91
99
  clazz.registerHybridProperty("maximumValue", &HybridNativeSliderSpecSwift::getMaximumValue, &HybridNativeSliderSpecSwift::setMaximumValue);
92
100
  clazz.registerHybridProperty("step", &HybridNativeSliderSpecSwift::getStep, &HybridNativeSliderSpecSwift::setStep);
93
101
  clazz.registerHybridProperty("enabled", &HybridNativeSliderSpecSwift::getEnabled, &HybridNativeSliderSpecSwift::setEnabled);
102
+ clazz.registerHybridProperty("accessibilityLabel", &HybridNativeSliderSpecSwift::getAccessibilityLabel, &HybridNativeSliderSpecSwift::setAccessibilityLabel);
94
103
  clazz.registerHybridMethod("setOnValueChange", &HybridNativeSliderSpecSwift::setOnValueChange);
95
104
  clazz.registerHybridMethod("setOnSlidingComplete", &HybridNativeSliderSpecSwift::setOnSlidingComplete);
96
105
  clazz.registerHybridConstructor(&HybridNativeSliderSpecSwift::constructor);
@@ -34,6 +34,14 @@ namespace margelo::nitro::sbcontrols {
34
34
  return _swiftPart.setEnabled(enabled);
35
35
  }
36
36
 
37
+ swift::Optional<swift::String> HybridNativeSwitchSpecSwift::getAccessibilityLabel() {
38
+ return _swiftPart.getAccessibilityLabel();
39
+ }
40
+
41
+ void HybridNativeSwitchSpecSwift::setAccessibilityLabel(const swift::Optional<swift::String>& accessibilityLabel) {
42
+ return _swiftPart.setAccessibilityLabel(accessibilityLabel);
43
+ }
44
+
37
45
  // Methods
38
46
 
39
47
  void HybridNativeSwitchSpecSwift::setOnValueChange(const swift::Optional<Callback<void(bool)>>& listener) {
@@ -57,6 +65,7 @@ namespace margelo::nitro::sbcontrols {
57
65
  static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
58
66
  clazz.registerHybridProperty("value", &HybridNativeSwitchSpecSwift::getValue, &HybridNativeSwitchSpecSwift::setValue);
59
67
  clazz.registerHybridProperty("enabled", &HybridNativeSwitchSpecSwift::getEnabled, &HybridNativeSwitchSpecSwift::setEnabled);
68
+ clazz.registerHybridProperty("accessibilityLabel", &HybridNativeSwitchSpecSwift::getAccessibilityLabel, &HybridNativeSwitchSpecSwift::setAccessibilityLabel);
60
69
  clazz.registerHybridMethod("setOnValueChange", &HybridNativeSwitchSpecSwift::setOnValueChange);
61
70
  clazz.registerHybridConstructor(&HybridNativeSwitchSpecSwift::constructor);
62
71
  });
@@ -65,6 +65,8 @@ namespace margelo::nitro::sbcontrols {
65
65
  void setFontSize(double fontSize);
66
66
  bool getEnabled();
67
67
  void setEnabled(bool enabled);
68
+ bool getReadOnly();
69
+ void setReadOnly(bool readOnly);
68
70
  // Methods
69
71
  void setOnTextChange(const swift::Optional<Callback<void(const swift::String&)>>& listener);
70
72
  // Constructor
@@ -66,6 +66,8 @@ namespace margelo::nitro::sbcontrols {
66
66
  void setStep(double step);
67
67
  bool getEnabled();
68
68
  void setEnabled(bool enabled);
69
+ swift::Optional<swift::String> getAccessibilityLabel();
70
+ void setAccessibilityLabel(const swift::Optional<swift::String>& accessibilityLabel);
69
71
  // Methods
70
72
  void setOnValueChange(const swift::Optional<Callback<void(double)>>& listener);
71
73
  void setOnSlidingComplete(const swift::Optional<Callback<void(double)>>& listener);
@@ -60,6 +60,8 @@ namespace margelo::nitro::sbcontrols {
60
60
  void setValue(bool value);
61
61
  bool getEnabled();
62
62
  void setEnabled(bool enabled);
63
+ swift::Optional<swift::String> getAccessibilityLabel();
64
+ void setAccessibilityLabel(const swift::Optional<swift::String>& accessibilityLabel);
63
65
  // Methods
64
66
  void setOnValueChange(const swift::Optional<Callback<void(bool)>>& listener);
65
67
  // Constructor
@@ -19,6 +19,7 @@ public protocol HybridNativeCodeEditorSpec_protocol: HybridNativeCodeEditorSpec_
19
19
  var textColor: Double { get set }
20
20
  var fontSize: Double { get set }
21
21
  var enabled: Bool { get set }
22
+ var readOnly: Bool { get set }
22
23
 
23
24
  // Methods
24
25
  func setOnTextChange(listener: (any Callback<(/* text */ String), Void>)?) throws -> Void
@@ -175,6 +175,15 @@ public final class HybridNativeCodeEditorSpec_cxx: HybridViewSpec_cxx {
175
175
  __implementation.enabled = enabled
176
176
  }
177
177
 
178
+ public final func getReadOnly() -> Bool {
179
+ let value = __implementation.readOnly
180
+ return value
181
+ }
182
+
183
+ public final func setReadOnly(readOnly: Bool) -> Void {
184
+ __implementation.readOnly = readOnly
185
+ }
186
+
178
187
  // Methods
179
188
 
180
189
  public final func setOnTextChange(listener: (margelo.nitro.sbcontrols.swift_bridge.Callback_void_swift__String)?) -> bridge.Result_void {
@@ -19,6 +19,7 @@ public protocol HybridNativeSliderSpec_protocol: HybridNativeSliderSpec_base, Hy
19
19
  var maximumValue: Double { get set }
20
20
  var step: Double { get set }
21
21
  var enabled: Bool { get set }
22
+ var accessibilityLabel: String? { get set }
22
23
 
23
24
  // Methods
24
25
  func setOnValueChange(listener: (any Callback<(/* value */ Double), Void>)?) throws -> Void
@@ -179,6 +179,15 @@ public final class HybridNativeSliderSpec_cxx: HybridViewSpec_cxx {
179
179
  __implementation.enabled = enabled
180
180
  }
181
181
 
182
+ public final func getAccessibilityLabel() -> String? {
183
+ let value = __implementation.accessibilityLabel
184
+ return value
185
+ }
186
+
187
+ public final func setAccessibilityLabel(accessibilityLabel: String?) -> Void {
188
+ __implementation.accessibilityLabel = accessibilityLabel
189
+ }
190
+
182
191
  // Methods
183
192
 
184
193
  public final func setOnValueChange(listener: (margelo.nitro.sbcontrols.swift_bridge.Callback_void_double)?) -> bridge.Result_void {
@@ -16,6 +16,7 @@ public protocol HybridNativeSwitchSpec_protocol: HybridNativeSwitchSpec_base, Hy
16
16
  // Properties
17
17
  var value: Bool { get set }
18
18
  var enabled: Bool { get set }
19
+ var accessibilityLabel: String? { get set }
19
20
 
20
21
  // Methods
21
22
  func setOnValueChange(listener: (any Callback<(/* value */ Bool), Void>)?) throws -> Void
@@ -152,6 +152,15 @@ public final class HybridNativeSwitchSpec_cxx: HybridViewSpec_cxx {
152
152
  __implementation.enabled = enabled
153
153
  }
154
154
 
155
+ public final func getAccessibilityLabel() -> String? {
156
+ let value = __implementation.accessibilityLabel
157
+ return value
158
+ }
159
+
160
+ public final func setAccessibilityLabel(accessibilityLabel: String?) -> Void {
161
+ __implementation.accessibilityLabel = accessibilityLabel
162
+ }
163
+
155
164
  // Methods
156
165
 
157
166
  public final func setOnValueChange(listener: (margelo.nitro.sbcontrols.swift_bridge.Callback_void_bool)?) -> bridge.Result_void {