react-native-nitro-input 0.2.0 → 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 (164) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +43 -1
  3. package/android/CMakeLists.txt +4 -0
  4. package/android/gradle.properties +1 -1
  5. package/android/src/main/cpp/JRollingEngine.cpp +3 -2
  6. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +20 -0
  7. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +209 -0
  8. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +25 -0
  9. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +69 -10
  10. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +164 -24
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +2 -1
  12. package/cpp/RollingEngine.cpp +12 -2
  13. package/cpp/RollingEngine.hpp +8 -1
  14. package/cpp/numberformat/HybridNitroNumberFormat.cpp +498 -0
  15. package/cpp/numberformat/HybridNitroNumberFormat.hpp +74 -0
  16. package/cpp/numberformat/HybridNitroNumberFormatFactory.hpp +11 -0
  17. package/cpp/numberformat/NumberFormatCore.cpp +629 -0
  18. package/cpp/numberformat/NumberFormatCore.hpp +154 -0
  19. package/cpp/numberformat/NumberFormatProbe.cpp +354 -0
  20. package/cpp/numberformat/NumberFormatProbe.hpp +63 -0
  21. package/ios/HybridNitroInputView.swift +15 -0
  22. package/ios/HybridNitroNumberFormatPlatform.swift +348 -0
  23. package/ios/HybridNitroNumberView.swift +19 -0
  24. package/ios/NitroInputView.swift +79 -19
  25. package/ios/NitroNumberView.swift +171 -31
  26. package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  27. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
  28. package/lib/commonjs/src/NitroInput.js +8 -6
  29. package/lib/commonjs/src/NitroNumber.js +4 -2
  30. package/lib/commonjs/src/NumberFormat.js +525 -0
  31. package/lib/commonjs/src/formatProps.js +48 -0
  32. package/lib/commonjs/src/index.js +3 -1
  33. package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
  34. package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  35. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
  36. package/lib/module/src/NitroInput.js +8 -6
  37. package/lib/module/src/NitroNumber.js +4 -2
  38. package/lib/module/src/NumberFormat.js +521 -0
  39. package/lib/module/src/formatProps.js +45 -0
  40. package/lib/module/src/index.js +1 -0
  41. package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
  42. package/lib/typescript/src/NitroInput.d.ts +22 -0
  43. package/lib/typescript/src/NitroNumber.d.ts +36 -1
  44. package/lib/typescript/src/NumberFormat.d.ts +47 -0
  45. package/lib/typescript/src/formatProps.d.ts +21 -0
  46. package/lib/typescript/src/index.d.ts +2 -0
  47. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +10 -0
  48. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +13 -1
  49. package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
  50. package/nitro.json +16 -0
  51. package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
  52. package/nitrogen/generated/android/NitroInputOnLoad.cpp +28 -0
  53. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +45 -0
  54. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +10 -0
  55. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp +118 -0
  56. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.hpp +64 -0
  57. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +54 -0
  58. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +12 -0
  59. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
  60. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
  61. package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +3 -0
  62. package/nitrogen/generated/android/c++/JNumberFormatCompactDisplay.hpp +58 -0
  63. package/nitrogen/generated/android/c++/JNumberFormatCurrencyDisplay.hpp +64 -0
  64. package/nitrogen/generated/android/c++/JNumberFormatCurrencySign.hpp +58 -0
  65. package/nitrogen/generated/android/c++/JNumberFormatNotation.hpp +64 -0
  66. package/nitrogen/generated/android/c++/JNumberFormatPlatformOptions.hpp +161 -0
  67. package/nitrogen/generated/android/c++/JNumberFormatPlatformSymbols.hpp +89 -0
  68. package/nitrogen/generated/android/c++/JNumberFormatRoundingMode.hpp +79 -0
  69. package/nitrogen/generated/android/c++/JNumberFormatSignDisplay.hpp +67 -0
  70. package/nitrogen/generated/android/c++/JNumberFormatStyle.hpp +64 -0
  71. package/nitrogen/generated/android/c++/JNumberFormatUnitDisplay.hpp +61 -0
  72. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +25 -0
  73. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +30 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +30 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatformSpec.kt +60 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +36 -0
  77. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
  78. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +2 -1
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCompactDisplay.kt +23 -0
  80. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencyDisplay.kt +25 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencySign.kt +23 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatNotation.kt +25 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformOptions.kt +136 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformSymbols.kt +91 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatRoundingMode.kt +30 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatSignDisplay.kt +26 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatStyle.kt +25 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatUnitDisplay.kt +24 -0
  89. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
  90. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +63 -0
  91. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +40 -0
  92. package/nitrogen/generated/ios/NitroInputAutolinking.mm +18 -0
  93. package/nitrogen/generated/ios/NitroInputAutolinking.swift +12 -0
  94. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +30 -0
  95. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.cpp +11 -0
  96. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.hpp +122 -0
  97. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +42 -0
  98. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
  99. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
  100. package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
  101. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +36 -0
  102. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +5 -0
  103. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +55 -0
  104. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec.swift +56 -0
  105. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec_cxx.swift +159 -0
  106. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +6 -0
  107. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +144 -0
  108. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
  109. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
  110. package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +4 -0
  111. package/nitrogen/generated/ios/swift/NumberFormatCompactDisplay.swift +40 -0
  112. package/nitrogen/generated/ios/swift/NumberFormatCurrencyDisplay.swift +48 -0
  113. package/nitrogen/generated/ios/swift/NumberFormatCurrencySign.swift +40 -0
  114. package/nitrogen/generated/ios/swift/NumberFormatNotation.swift +48 -0
  115. package/nitrogen/generated/ios/swift/NumberFormatPlatformOptions.swift +159 -0
  116. package/nitrogen/generated/ios/swift/NumberFormatPlatformSymbols.swift +69 -0
  117. package/nitrogen/generated/ios/swift/NumberFormatRoundingMode.swift +68 -0
  118. package/nitrogen/generated/ios/swift/NumberFormatSignDisplay.swift +52 -0
  119. package/nitrogen/generated/ios/swift/NumberFormatStyle.swift +48 -0
  120. package/nitrogen/generated/ios/swift/NumberFormatUnitDisplay.swift +44 -0
  121. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +10 -0
  122. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +10 -0
  123. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp +22 -0
  124. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.hpp +70 -0
  125. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.cpp +22 -0
  126. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.hpp +70 -0
  127. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +23 -0
  128. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +71 -0
  129. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +12 -0
  130. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +12 -0
  131. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
  132. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
  133. package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +4 -0
  134. package/nitrogen/generated/shared/c++/NumberFormatCompactDisplay.hpp +76 -0
  135. package/nitrogen/generated/shared/c++/NumberFormatCurrencyDisplay.hpp +84 -0
  136. package/nitrogen/generated/shared/c++/NumberFormatCurrencySign.hpp +76 -0
  137. package/nitrogen/generated/shared/c++/NumberFormatGrouping.hpp +80 -0
  138. package/nitrogen/generated/shared/c++/NumberFormatNotation.hpp +84 -0
  139. package/nitrogen/generated/shared/c++/NumberFormatOptions.hpp +193 -0
  140. package/nitrogen/generated/shared/c++/NumberFormatPart.hpp +87 -0
  141. package/nitrogen/generated/shared/c++/NumberFormatPlatformOptions.hpp +176 -0
  142. package/nitrogen/generated/shared/c++/NumberFormatPlatformSymbols.hpp +115 -0
  143. package/nitrogen/generated/shared/c++/NumberFormatRoundingMode.hpp +104 -0
  144. package/nitrogen/generated/shared/c++/NumberFormatRoundingPriority.hpp +80 -0
  145. package/nitrogen/generated/shared/c++/NumberFormatSignDisplay.hpp +88 -0
  146. package/nitrogen/generated/shared/c++/NumberFormatStyle.hpp +84 -0
  147. package/nitrogen/generated/shared/c++/NumberFormatTrailingZeroDisplay.hpp +76 -0
  148. package/nitrogen/generated/shared/c++/NumberFormatUnitDisplay.hpp +80 -0
  149. package/nitrogen/generated/shared/c++/ResolvedNumberFormatOptions.hpp +197 -0
  150. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +10 -0
  151. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +15 -0
  152. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +12 -0
  153. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +18 -0
  154. package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  155. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +6 -0
  156. package/package.json +2 -2
  157. package/src/NitroInput.tsx +42 -7
  158. package/src/NitroNumber.tsx +57 -7
  159. package/src/NumberFormat.ts +563 -0
  160. package/src/formatProps.ts +59 -0
  161. package/src/index.ts +18 -0
  162. package/src/specs/NitroInput.nitro.ts +10 -0
  163. package/src/specs/NitroNumber.nitro.ts +13 -1
  164. package/src/specs/NumberFormat.nitro.ts +145 -0
@@ -0,0 +1,197 @@
1
+ ///
2
+ /// ResolvedNumberFormatOptions.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `NumberFormatStyle` to properly resolve imports.
32
+ namespace margelo::nitro::nitroinput { enum class NumberFormatStyle; }
33
+ // Forward declaration of `NumberFormatCurrencyDisplay` to properly resolve imports.
34
+ namespace margelo::nitro::nitroinput { enum class NumberFormatCurrencyDisplay; }
35
+ // Forward declaration of `NumberFormatCurrencySign` to properly resolve imports.
36
+ namespace margelo::nitro::nitroinput { enum class NumberFormatCurrencySign; }
37
+ // Forward declaration of `NumberFormatUnitDisplay` to properly resolve imports.
38
+ namespace margelo::nitro::nitroinput { enum class NumberFormatUnitDisplay; }
39
+ // Forward declaration of `NumberFormatGrouping` to properly resolve imports.
40
+ namespace margelo::nitro::nitroinput { enum class NumberFormatGrouping; }
41
+ // Forward declaration of `NumberFormatNotation` to properly resolve imports.
42
+ namespace margelo::nitro::nitroinput { enum class NumberFormatNotation; }
43
+ // Forward declaration of `NumberFormatCompactDisplay` to properly resolve imports.
44
+ namespace margelo::nitro::nitroinput { enum class NumberFormatCompactDisplay; }
45
+ // Forward declaration of `NumberFormatSignDisplay` to properly resolve imports.
46
+ namespace margelo::nitro::nitroinput { enum class NumberFormatSignDisplay; }
47
+ // Forward declaration of `NumberFormatRoundingMode` to properly resolve imports.
48
+ namespace margelo::nitro::nitroinput { enum class NumberFormatRoundingMode; }
49
+ // Forward declaration of `NumberFormatRoundingPriority` to properly resolve imports.
50
+ namespace margelo::nitro::nitroinput { enum class NumberFormatRoundingPriority; }
51
+ // Forward declaration of `NumberFormatTrailingZeroDisplay` to properly resolve imports.
52
+ namespace margelo::nitro::nitroinput { enum class NumberFormatTrailingZeroDisplay; }
53
+
54
+ #include <string>
55
+ #include "NumberFormatStyle.hpp"
56
+ #include <optional>
57
+ #include "NumberFormatCurrencyDisplay.hpp"
58
+ #include "NumberFormatCurrencySign.hpp"
59
+ #include "NumberFormatUnitDisplay.hpp"
60
+ #include "NumberFormatGrouping.hpp"
61
+ #include <variant>
62
+ #include "NumberFormatNotation.hpp"
63
+ #include "NumberFormatCompactDisplay.hpp"
64
+ #include "NumberFormatSignDisplay.hpp"
65
+ #include "NumberFormatRoundingMode.hpp"
66
+ #include "NumberFormatRoundingPriority.hpp"
67
+ #include "NumberFormatTrailingZeroDisplay.hpp"
68
+
69
+ namespace margelo::nitro::nitroinput {
70
+
71
+ /**
72
+ * A struct which can be represented as a JavaScript object (ResolvedNumberFormatOptions).
73
+ */
74
+ struct ResolvedNumberFormatOptions final {
75
+ public:
76
+ std::string locale SWIFT_PRIVATE;
77
+ std::string numberingSystem SWIFT_PRIVATE;
78
+ NumberFormatStyle style SWIFT_PRIVATE;
79
+ std::optional<std::string> currency SWIFT_PRIVATE;
80
+ std::optional<NumberFormatCurrencyDisplay> currencyDisplay SWIFT_PRIVATE;
81
+ std::optional<NumberFormatCurrencySign> currencySign SWIFT_PRIVATE;
82
+ std::optional<std::string> unit SWIFT_PRIVATE;
83
+ std::optional<NumberFormatUnitDisplay> unitDisplay SWIFT_PRIVATE;
84
+ double minimumIntegerDigits SWIFT_PRIVATE;
85
+ std::optional<double> minimumFractionDigits SWIFT_PRIVATE;
86
+ std::optional<double> maximumFractionDigits SWIFT_PRIVATE;
87
+ std::optional<double> minimumSignificantDigits SWIFT_PRIVATE;
88
+ std::optional<double> maximumSignificantDigits SWIFT_PRIVATE;
89
+ std::variant<bool, NumberFormatGrouping> useGrouping SWIFT_PRIVATE;
90
+ NumberFormatNotation notation SWIFT_PRIVATE;
91
+ std::optional<NumberFormatCompactDisplay> compactDisplay SWIFT_PRIVATE;
92
+ NumberFormatSignDisplay signDisplay SWIFT_PRIVATE;
93
+ double roundingIncrement SWIFT_PRIVATE;
94
+ NumberFormatRoundingMode roundingMode SWIFT_PRIVATE;
95
+ NumberFormatRoundingPriority roundingPriority SWIFT_PRIVATE;
96
+ NumberFormatTrailingZeroDisplay trailingZeroDisplay SWIFT_PRIVATE;
97
+
98
+ public:
99
+ ResolvedNumberFormatOptions() = default;
100
+ explicit ResolvedNumberFormatOptions(std::string locale, std::string numberingSystem, NumberFormatStyle style, std::optional<std::string> currency, std::optional<NumberFormatCurrencyDisplay> currencyDisplay, std::optional<NumberFormatCurrencySign> currencySign, std::optional<std::string> unit, std::optional<NumberFormatUnitDisplay> unitDisplay, double minimumIntegerDigits, std::optional<double> minimumFractionDigits, std::optional<double> maximumFractionDigits, std::optional<double> minimumSignificantDigits, std::optional<double> maximumSignificantDigits, std::variant<bool, NumberFormatGrouping> useGrouping, NumberFormatNotation notation, std::optional<NumberFormatCompactDisplay> compactDisplay, NumberFormatSignDisplay signDisplay, double roundingIncrement, NumberFormatRoundingMode roundingMode, NumberFormatRoundingPriority roundingPriority, NumberFormatTrailingZeroDisplay trailingZeroDisplay): locale(locale), numberingSystem(numberingSystem), style(style), currency(currency), currencyDisplay(currencyDisplay), currencySign(currencySign), unit(unit), unitDisplay(unitDisplay), minimumIntegerDigits(minimumIntegerDigits), minimumFractionDigits(minimumFractionDigits), maximumFractionDigits(maximumFractionDigits), minimumSignificantDigits(minimumSignificantDigits), maximumSignificantDigits(maximumSignificantDigits), useGrouping(useGrouping), notation(notation), compactDisplay(compactDisplay), signDisplay(signDisplay), roundingIncrement(roundingIncrement), roundingMode(roundingMode), roundingPriority(roundingPriority), trailingZeroDisplay(trailingZeroDisplay) {}
101
+
102
+ public:
103
+ friend bool operator==(const ResolvedNumberFormatOptions& lhs, const ResolvedNumberFormatOptions& rhs) = default;
104
+ };
105
+
106
+ } // namespace margelo::nitro::nitroinput
107
+
108
+ namespace margelo::nitro {
109
+
110
+ // C++ ResolvedNumberFormatOptions <> JS ResolvedNumberFormatOptions (object)
111
+ template <>
112
+ struct JSIConverter<margelo::nitro::nitroinput::ResolvedNumberFormatOptions> final {
113
+ static inline margelo::nitro::nitroinput::ResolvedNumberFormatOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
114
+ jsi::Object obj = arg.asObject(runtime);
115
+ return margelo::nitro::nitroinput::ResolvedNumberFormatOptions(
116
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locale"))),
117
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"))),
118
+ JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "style"))),
119
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency"))),
120
+ JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay"))),
121
+ JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencySign>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySign"))),
122
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit"))),
123
+ JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatUnitDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay"))),
124
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits"))),
125
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits"))),
126
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits"))),
127
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits"))),
128
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits"))),
129
+ JSIConverter<std::variant<bool, margelo::nitro::nitroinput::NumberFormatGrouping>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useGrouping"))),
130
+ JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notation"))),
131
+ JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCompactDisplay>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay"))),
132
+ JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signDisplay"))),
133
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingIncrement"))),
134
+ JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingMode"))),
135
+ JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingPriority>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingPriority"))),
136
+ JSIConverter<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trailingZeroDisplay")))
137
+ );
138
+ }
139
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroinput::ResolvedNumberFormatOptions& arg) {
140
+ jsi::Object obj(runtime);
141
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "locale"), JSIConverter<std::string>::toJSI(runtime, arg.locale));
142
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem"), JSIConverter<std::string>::toJSI(runtime, arg.numberingSystem));
143
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "style"), JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle>::toJSI(runtime, arg.style));
144
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "currency"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currency));
145
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>>::toJSI(runtime, arg.currencyDisplay));
146
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencySign"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencySign>>::toJSI(runtime, arg.currencySign));
147
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.unit));
148
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatUnitDisplay>>::toJSI(runtime, arg.unitDisplay));
149
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits"), JSIConverter<double>::toJSI(runtime, arg.minimumIntegerDigits));
150
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minimumFractionDigits));
151
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumFractionDigits));
152
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minimumSignificantDigits));
153
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maximumSignificantDigits));
154
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "useGrouping"), JSIConverter<std::variant<bool, margelo::nitro::nitroinput::NumberFormatGrouping>>::toJSI(runtime, arg.useGrouping));
155
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "notation"), JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation>::toJSI(runtime, arg.notation));
156
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay"), JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCompactDisplay>>::toJSI(runtime, arg.compactDisplay));
157
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "signDisplay"), JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay>::toJSI(runtime, arg.signDisplay));
158
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingIncrement"), JSIConverter<double>::toJSI(runtime, arg.roundingIncrement));
159
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingMode"), JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode>::toJSI(runtime, arg.roundingMode));
160
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "roundingPriority"), JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingPriority>::toJSI(runtime, arg.roundingPriority));
161
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "trailingZeroDisplay"), JSIConverter<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay>::toJSI(runtime, arg.trailingZeroDisplay));
162
+ return obj;
163
+ }
164
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
165
+ if (!value.isObject()) {
166
+ return false;
167
+ }
168
+ jsi::Object obj = value.getObject(runtime);
169
+ if (!nitro::isPlainObject(runtime, obj)) {
170
+ return false;
171
+ }
172
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locale")))) return false;
173
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberingSystem")))) return false;
174
+ if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatStyle>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "style")))) return false;
175
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency")))) return false;
176
+ if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencyDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyDisplay")))) return false;
177
+ if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCurrencySign>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySign")))) return false;
178
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))) return false;
179
+ if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatUnitDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unitDisplay")))) return false;
180
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumIntegerDigits")))) return false;
181
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumFractionDigits")))) return false;
182
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumFractionDigits")))) return false;
183
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minimumSignificantDigits")))) return false;
184
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maximumSignificantDigits")))) return false;
185
+ if (!JSIConverter<std::variant<bool, margelo::nitro::nitroinput::NumberFormatGrouping>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useGrouping")))) return false;
186
+ if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatNotation>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notation")))) return false;
187
+ if (!JSIConverter<std::optional<margelo::nitro::nitroinput::NumberFormatCompactDisplay>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compactDisplay")))) return false;
188
+ if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatSignDisplay>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signDisplay")))) return false;
189
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingIncrement")))) return false;
190
+ if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingMode>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingMode")))) return false;
191
+ if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatRoundingPriority>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "roundingPriority")))) return false;
192
+ if (!JSIConverter<margelo::nitro::nitroinput::NumberFormatTrailingZeroDisplay>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trailingZeroDisplay")))) return false;
193
+ return true;
194
+ }
195
+ };
196
+
197
+ } // namespace margelo::nitro
@@ -50,6 +50,11 @@ namespace margelo::nitro::nitroinput::views {
50
50
  signPlacement(nitro::ReactProp<NitroInputSignPlacement>::fromRawValue("NitroInputView", "signPlacement", rawProps, sourceProps.signPlacement)),
51
51
  prefixAlign(nitro::ReactProp<NitroInputAffixAlign>::fromRawValue("NitroInputView", "prefixAlign", rawProps, sourceProps.prefixAlign)),
52
52
  suffixAlign(nitro::ReactProp<NitroInputAffixAlign>::fromRawValue("NitroInputView", "suffixAlign", rawProps, sourceProps.suffixAlign)),
53
+ letterSpacing(nitro::ReactProp<double>::fromRawValue("NitroInputView", "letterSpacing", rawProps, sourceProps.letterSpacing)),
54
+ prefixSpacing(nitro::ReactProp<double>::fromRawValue("NitroInputView", "prefixSpacing", rawProps, sourceProps.prefixSpacing)),
55
+ suffixSpacing(nitro::ReactProp<double>::fromRawValue("NitroInputView", "suffixSpacing", rawProps, sourceProps.suffixSpacing)),
56
+ prefixOffset(nitro::ReactProp<double>::fromRawValue("NitroInputView", "prefixOffset", rawProps, sourceProps.prefixOffset)),
57
+ suffixOffset(nitro::ReactProp<double>::fromRawValue("NitroInputView", "suffixOffset", rawProps, sourceProps.suffixOffset)),
53
58
  placeholder(nitro::ReactProp<std::string>::fromRawValue("NitroInputView", "placeholder", rawProps, sourceProps.placeholder)),
54
59
  placeholderColor(nitro::ReactProp<double>::fromRawValue("NitroInputView", "placeholderColor", rawProps, sourceProps.placeholderColor)),
55
60
  duration(nitro::ReactProp<double>::fromRawValue("NitroInputView", "duration", rawProps, sourceProps.duration)),
@@ -146,6 +151,11 @@ namespace margelo::nitro::nitroinput::views {
146
151
  case hashString("signPlacement"): return true;
147
152
  case hashString("prefixAlign"): return true;
148
153
  case hashString("suffixAlign"): return true;
154
+ case hashString("letterSpacing"): return true;
155
+ case hashString("prefixSpacing"): return true;
156
+ case hashString("suffixSpacing"): return true;
157
+ case hashString("prefixOffset"): return true;
158
+ case hashString("suffixOffset"): return true;
149
159
  case hashString("placeholder"): return true;
150
160
  case hashString("placeholderColor"): return true;
151
161
  case hashString("duration"): return true;
@@ -89,6 +89,11 @@ namespace margelo::nitro::nitroinput::views {
89
89
  nitro::ReactProp<NitroInputSignPlacement> signPlacement;
90
90
  nitro::ReactProp<NitroInputAffixAlign> prefixAlign;
91
91
  nitro::ReactProp<NitroInputAffixAlign> suffixAlign;
92
+ nitro::ReactProp<double> letterSpacing;
93
+ nitro::ReactProp<double> prefixSpacing;
94
+ nitro::ReactProp<double> suffixSpacing;
95
+ nitro::ReactProp<double> prefixOffset;
96
+ nitro::ReactProp<double> suffixOffset;
92
97
  nitro::ReactProp<std::string> placeholder;
93
98
  nitro::ReactProp<double> placeholderColor;
94
99
  nitro::ReactProp<double> duration;
@@ -185,6 +190,11 @@ namespace margelo::nitro::nitroinput::views {
185
190
  signPlacement.hasSameValue(other.signPlacement) &&
186
191
  prefixAlign.hasSameValue(other.prefixAlign) &&
187
192
  suffixAlign.hasSameValue(other.suffixAlign) &&
193
+ letterSpacing.hasSameValue(other.letterSpacing) &&
194
+ prefixSpacing.hasSameValue(other.prefixSpacing) &&
195
+ suffixSpacing.hasSameValue(other.suffixSpacing) &&
196
+ prefixOffset.hasSameValue(other.prefixOffset) &&
197
+ suffixOffset.hasSameValue(other.suffixOffset) &&
188
198
  placeholder.hasSameValue(other.placeholder) &&
189
199
  placeholderColor.hasSameValue(other.placeholderColor) &&
190
200
  duration.hasSameValue(other.duration) &&
@@ -282,6 +292,11 @@ namespace margelo::nitro::nitroinput::views {
282
292
  signPlacement.isProvided() ||
283
293
  prefixAlign.isProvided() ||
284
294
  suffixAlign.isProvided() ||
295
+ letterSpacing.isProvided() ||
296
+ prefixSpacing.isProvided() ||
297
+ suffixSpacing.isProvided() ||
298
+ prefixOffset.isProvided() ||
299
+ suffixOffset.isProvided() ||
285
300
  placeholder.isProvided() ||
286
301
  placeholderColor.isProvided() ||
287
302
  duration.isProvided() ||
@@ -54,6 +54,12 @@ namespace margelo::nitro::nitroinput::views {
54
54
  affixAlign(nitro::ReactProp<std::optional<NitroNumberAffixAlign>>::fromRawValue("NitroNumberView", "affixAlign", rawProps, sourceProps.affixAlign)),
55
55
  prefixAlign(nitro::ReactProp<std::optional<NitroNumberAffixAlign>>::fromRawValue("NitroNumberView", "prefixAlign", rawProps, sourceProps.prefixAlign)),
56
56
  suffixAlign(nitro::ReactProp<std::optional<NitroNumberAffixAlign>>::fromRawValue("NitroNumberView", "suffixAlign", rawProps, sourceProps.suffixAlign)),
57
+ letterSpacing(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroNumberView", "letterSpacing", rawProps, sourceProps.letterSpacing)),
58
+ prefixSpacing(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroNumberView", "prefixSpacing", rawProps, sourceProps.prefixSpacing)),
59
+ suffixSpacing(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroNumberView", "suffixSpacing", rawProps, sourceProps.suffixSpacing)),
60
+ prefixOffset(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroNumberView", "prefixOffset", rawProps, sourceProps.prefixOffset)),
61
+ suffixOffset(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroNumberView", "suffixOffset", rawProps, sourceProps.suffixOffset)),
62
+ tabularNums(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroNumberView", "tabularNums", rawProps, sourceProps.tabularNums)),
57
63
  adjustsFontSizeToFit(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroNumberView", "adjustsFontSizeToFit", rawProps, sourceProps.adjustsFontSizeToFit)),
58
64
  minimumFontScale(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroNumberView", "minimumFontScale", rawProps, sourceProps.minimumFontScale)),
59
65
  allowFontScaling(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroNumberView", "allowFontScaling", rawProps, sourceProps.allowFontScaling)),
@@ -104,6 +110,12 @@ namespace margelo::nitro::nitroinput::views {
104
110
  case hashString("affixAlign"): return true;
105
111
  case hashString("prefixAlign"): return true;
106
112
  case hashString("suffixAlign"): return true;
113
+ case hashString("letterSpacing"): return true;
114
+ case hashString("prefixSpacing"): return true;
115
+ case hashString("suffixSpacing"): return true;
116
+ case hashString("prefixOffset"): return true;
117
+ case hashString("suffixOffset"): return true;
118
+ case hashString("tabularNums"): return true;
107
119
  case hashString("adjustsFontSizeToFit"): return true;
108
120
  case hashString("minimumFontScale"): return true;
109
121
  case hashString("allowFontScaling"): return true;
@@ -84,6 +84,12 @@ namespace margelo::nitro::nitroinput::views {
84
84
  nitro::ReactProp<std::optional<NitroNumberAffixAlign>> affixAlign;
85
85
  nitro::ReactProp<std::optional<NitroNumberAffixAlign>> prefixAlign;
86
86
  nitro::ReactProp<std::optional<NitroNumberAffixAlign>> suffixAlign;
87
+ nitro::ReactProp<std::optional<double>> letterSpacing;
88
+ nitro::ReactProp<std::optional<double>> prefixSpacing;
89
+ nitro::ReactProp<std::optional<double>> suffixSpacing;
90
+ nitro::ReactProp<std::optional<double>> prefixOffset;
91
+ nitro::ReactProp<std::optional<double>> suffixOffset;
92
+ nitro::ReactProp<std::optional<bool>> tabularNums;
87
93
  nitro::ReactProp<std::optional<bool>> adjustsFontSizeToFit;
88
94
  nitro::ReactProp<std::optional<double>> minimumFontScale;
89
95
  nitro::ReactProp<std::optional<bool>> allowFontScaling;
@@ -134,6 +140,12 @@ namespace margelo::nitro::nitroinput::views {
134
140
  affixAlign.hasSameValue(other.affixAlign) &&
135
141
  prefixAlign.hasSameValue(other.prefixAlign) &&
136
142
  suffixAlign.hasSameValue(other.suffixAlign) &&
143
+ letterSpacing.hasSameValue(other.letterSpacing) &&
144
+ prefixSpacing.hasSameValue(other.prefixSpacing) &&
145
+ suffixSpacing.hasSameValue(other.suffixSpacing) &&
146
+ prefixOffset.hasSameValue(other.prefixOffset) &&
147
+ suffixOffset.hasSameValue(other.suffixOffset) &&
148
+ tabularNums.hasSameValue(other.tabularNums) &&
137
149
  adjustsFontSizeToFit.hasSameValue(other.adjustsFontSizeToFit) &&
138
150
  minimumFontScale.hasSameValue(other.minimumFontScale) &&
139
151
  allowFontScaling.hasSameValue(other.allowFontScaling) &&
@@ -185,6 +197,12 @@ namespace margelo::nitro::nitroinput::views {
185
197
  affixAlign.isProvided() ||
186
198
  prefixAlign.isProvided() ||
187
199
  suffixAlign.isProvided() ||
200
+ letterSpacing.isProvided() ||
201
+ prefixSpacing.isProvided() ||
202
+ suffixSpacing.isProvided() ||
203
+ prefixOffset.isProvided() ||
204
+ suffixOffset.isProvided() ||
205
+ tabularNums.isProvided() ||
188
206
  adjustsFontSizeToFit.isProvided() ||
189
207
  minimumFontScale.isProvided() ||
190
208
  allowFontScaling.isProvided() ||
@@ -34,6 +34,11 @@
34
34
  "signPlacement": true,
35
35
  "prefixAlign": true,
36
36
  "suffixAlign": true,
37
+ "letterSpacing": true,
38
+ "prefixSpacing": true,
39
+ "suffixSpacing": true,
40
+ "prefixOffset": true,
41
+ "suffixOffset": true,
37
42
  "placeholder": true,
38
43
  "placeholderColor": true,
39
44
  "duration": true,
@@ -38,6 +38,12 @@
38
38
  "affixAlign": true,
39
39
  "prefixAlign": true,
40
40
  "suffixAlign": true,
41
+ "letterSpacing": true,
42
+ "prefixSpacing": true,
43
+ "suffixSpacing": true,
44
+ "prefixOffset": true,
45
+ "suffixOffset": true,
46
+ "tabularNums": true,
41
47
  "adjustsFontSizeToFit": true,
42
48
  "minimumFontScale": true,
43
49
  "allowFontScaling": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-input",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Native text for React Native, built with Nitro: a text and amount input with native formatting, masks and a Torph-style reflow, and an animated number (odometer, SwiftUI-style numeric text, ticker) whose digits roll or swap natively, with currency layouts and animated currency switches, shrink-to-fit, a loading shimmer and a jackpot reveal.",
5
5
  "main": "lib/commonjs/src/index.js",
6
6
  "module": "lib/module/src/index.js",
@@ -39,7 +39,7 @@
39
39
  "specs": "nitrogen --logLevel=\"debug\"",
40
40
  "prepack": "bun run build",
41
41
  "test": "jest",
42
- "test:cpp": "mkdir -p .cache && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/ReflowEngine.cpp cpp/AmountFormatter.cpp cpp/__tests__/ReflowEngineTest.cpp -o .cache/reflow-engine-test && .cache/reflow-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/__tests__/AmountFormatterTest.cpp -o .cache/amount-formatter-test && .cache/amount-formatter-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineTest.cpp -o .cache/mask-engine-test && .cache/mask-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/OutlineGeometry.cpp cpp/__tests__/OutlineGeometryTest.cpp -o .cache/outline-geometry-test && .cache/outline-geometry-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-test && .cache/rolling-engine-test",
42
+ "test:cpp": "mkdir -p .cache && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/ReflowEngine.cpp cpp/AmountFormatter.cpp cpp/__tests__/ReflowEngineTest.cpp -o .cache/reflow-engine-test && .cache/reflow-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/__tests__/AmountFormatterTest.cpp -o .cache/amount-formatter-test && .cache/amount-formatter-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineTest.cpp -o .cache/mask-engine-test && .cache/mask-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/OutlineGeometry.cpp cpp/__tests__/OutlineGeometryTest.cpp -o .cache/outline-geometry-test && .cache/outline-geometry-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-test && .cache/rolling-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/__tests__/NumberFormatCoreTest.cpp -o .cache/number-format-core-test && .cache/number-format-core-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/numberformat/NumberFormatProbe.cpp cpp/__tests__/NumberFormatProbeTest.cpp -o .cache/number-format-probe-test && .cache/number-format-probe-test",
43
43
  "test:cpp:sanitize": "mkdir -p .cache && clang++ -std=c++20 -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-sanitize && .cache/rolling-engine-sanitize",
44
44
  "release": "release-it"
45
45
  },
@@ -52,6 +52,8 @@ import {
52
52
  type NitroInputTransform,
53
53
  } from './worklets'
54
54
  import { toNumericWeight, toProcessedColor } from './styleHelpers'
55
+ import { formatProps } from './formatProps'
56
+ import type { NumberFormat } from './NumberFormat'
55
57
 
56
58
  /**
57
59
  * React Native's registry of mounted text inputs. `TextInput.State` only
@@ -362,6 +364,27 @@ export interface NitroInputProps extends Omit<ViewProps, 'children' | 'onFocus'
362
364
  prefixAlign?: NitroInputAffixAlign
363
365
  /** Alignment of `suffix` only. Defaults to `affixAlign`. */
364
366
  suffixAlign?: NitroInputAffixAlign
367
+ /**
368
+ * Points added after every glyph, like `Text`'s `letterSpacing` (negative
369
+ * tightens). A smaller prefix or suffix gets it in proportion to its size.
370
+ * Default: `0`.
371
+ */
372
+ letterSpacing?: number
373
+ /** Points between the prefix and the text, in place of the letter spacing there. Defaults to the letter spacing. */
374
+ prefixSpacing?: number
375
+ /** Points between the text and the suffix, in place of the letter spacing there. Defaults to the letter spacing. */
376
+ suffixSpacing?: number
377
+ /** Points the prefix is moved down after `prefixAlign` places it (negative: up). Default: `0`. */
378
+ prefixOffset?: number
379
+ /** Points the suffix is moved down after `suffixAlign` places it (negative: up). Default: `0`. */
380
+ suffixOffset?: number
381
+ /**
382
+ * A `NumberFormat` the amount follows: its prefix and suffix (the currency
383
+ * where the locale puts it), grouping and decimal separators, fraction
384
+ * digits and where the sign goes. Sets `mode` to `'number'` unless it is
385
+ * given. The individual props override what it says.
386
+ */
387
+ format?: NumberFormat
365
388
  /** Shown while the field is empty and reflowed away by the first character. In `'number'` mode `'0'` reads well. */
366
389
  placeholder?: string
367
390
  /** Color of the placeholder. Defaults to the platform placeholder color. */
@@ -632,6 +655,12 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
632
655
  signPlacement,
633
656
  prefixAlign,
634
657
  suffixAlign,
658
+ letterSpacing,
659
+ prefixSpacing,
660
+ suffixSpacing,
661
+ prefixOffset,
662
+ suffixOffset,
663
+ format,
635
664
  placeholder,
636
665
  placeholderTextColor,
637
666
  duration,
@@ -1074,13 +1103,14 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
1074
1103
  if (prefix) warnIncompatible('prefix')
1075
1104
  if (suffix) warnIncompatible('suffix')
1076
1105
  }
1077
- const resolvedMode = isMultiline ? 'text' : (mode ?? 'text')
1106
+ const derived = format ? formatProps(format) : undefined
1107
+ const resolvedMode = isMultiline ? 'text' : (mode ?? (derived ? 'number' : 'text'))
1078
1108
  const reflows = !isMultiline && transition === 'reflow'
1079
1109
  // The affixes are accessory views beside one line of text; a wrapping text
1080
1110
  // view has no slot for them, so they go with the mode rather than being
1081
1111
  // half-drawn on one platform and not the other.
1082
- const resolvedPrefix = isMultiline ? '' : (prefix ?? '')
1083
- const resolvedSuffix = isMultiline ? '' : (suffix ?? '')
1112
+ const resolvedPrefix = isMultiline ? '' : (prefix ?? derived?.prefix ?? '')
1113
+ const resolvedSuffix = isMultiline ? '' : (suffix ?? derived?.suffix ?? '')
1084
1114
  // A new `maskNotations` literal each render must not re-set the native
1085
1115
  // prop, so it is keyed on its contents. Always an array (empty = none):
1086
1116
  // removing the prop would reach native as `null`, which Nitro's array
@@ -1092,7 +1122,7 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
1092
1122
  // eslint-disable-next-line react-hooks/exhaustive-deps
1093
1123
  [notationsKey]
1094
1124
  )
1095
- const resolvedFractionDigits = fractionDigits ?? 2
1125
+ const resolvedFractionDigits = fractionDigits ?? derived?.fractionDigits ?? 2
1096
1126
  const resolvedKeyboardType =
1097
1127
  keyboardType ??
1098
1128
  (inputMode != null
@@ -1196,15 +1226,20 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
1196
1226
  plain={!reflows}
1197
1227
  fractionDigits={resolvedFractionDigits}
1198
1228
  maxIntegerDigits={maxIntegerDigits ?? 15}
1199
- groupingSeparator={groupingSeparator ?? ','}
1200
- decimalSeparator={decimalSeparator ?? '.'}
1229
+ groupingSeparator={groupingSeparator ?? derived?.groupingSeparator ?? ','}
1230
+ decimalSeparator={decimalSeparator ?? derived?.decimalSeparator ?? '.'}
1201
1231
  prefix={resolvedPrefix}
1202
1232
  suffix={resolvedSuffix}
1203
1233
  prefixFontSize={prefixFontSize ?? resolvedFontSize}
1204
1234
  suffixFontSize={suffixFontSize ?? resolvedFontSize}
1205
- signPlacement={signPlacement ?? 'beforeAffix'}
1235
+ signPlacement={signPlacement ?? derived?.signPlacement ?? 'beforeAffix'}
1206
1236
  prefixAlign={prefixAlign ?? resolvedAffixAlign}
1207
1237
  suffixAlign={suffixAlign ?? resolvedAffixAlign}
1238
+ letterSpacing={letterSpacing ?? 0}
1239
+ prefixSpacing={prefixSpacing ?? Infinity}
1240
+ suffixSpacing={suffixSpacing ?? Infinity}
1241
+ prefixOffset={prefixOffset ?? 0}
1242
+ suffixOffset={suffixOffset ?? 0}
1208
1243
  placeholder={placeholder ?? ''}
1209
1244
  placeholderColor={processedPlaceholderColor}
1210
1245
  duration={duration ?? 400}
@@ -29,6 +29,8 @@ import type {
29
29
  NitroNumberTextAlign,
30
30
  } from './specs/NitroNumber.nitro'
31
31
  import { toNumericWeight, toProcessedColor } from './styleHelpers'
32
+ import { formatProps } from './formatProps'
33
+ import type { NumberFormat } from './NumberFormat'
32
34
 
33
35
  /**
34
36
  * The raw Nitro host component. Prefer {@link NitroNumber}, which adds
@@ -111,7 +113,12 @@ export interface NitroNumberProps extends Omit<ViewProps, 'children'> {
111
113
  * (`150` for the numeric transition).
112
114
  */
113
115
  stagger?: number
114
- /** Which way the digits roll. `'auto'` follows the sign of the change. Default: `'auto'`. */
116
+ /**
117
+ * Which way the digits roll. `'auto'` follows the sign of the change;
118
+ * `'up'` / `'down'` force one; `'shortest'` rolls each digit its own
119
+ * shorter way round (1 → 2 is one step up even when the value falls, where
120
+ * `'auto'` rolls nine steps down), which is calmer on big jumps. The numeric transition and the reveal ignore it. Default: `'auto'`.
121
+ */
115
122
  direction?: NitroNumberDirection
116
123
  /**
117
124
  * Jackpot reveal, the casino "you won" presentation. While `false` the view
@@ -185,6 +192,35 @@ export interface NitroNumberProps extends Omit<ViewProps, 'children'> {
185
192
  prefixAlign?: NitroNumberAffixAlign
186
193
  /** Alignment of `suffix` only. Defaults to `affixAlign`. */
187
194
  suffixAlign?: NitroNumberAffixAlign
195
+ /**
196
+ * Points added after every glyph, like `Text`'s `letterSpacing` (negative
197
+ * tightens). A smaller prefix or suffix gets it in proportion to its size.
198
+ * Default: `0`.
199
+ */
200
+ letterSpacing?: number
201
+ /** Points between the prefix and the digits, in place of the letter spacing there. Defaults to the letter spacing. */
202
+ prefixSpacing?: number
203
+ /** Points between the digits and the suffix, in place of the letter spacing there. Defaults to the letter spacing. */
204
+ suffixSpacing?: number
205
+ /** Points the prefix is moved down after `prefixAlign` places it (negative: up). Default: `0`. */
206
+ prefixOffset?: number
207
+ /** Points the suffix is moved down after `suffixAlign` places it (negative: up). Default: `0`. */
208
+ suffixOffset?: number
209
+ /**
210
+ * `true` (the default): every digit as wide as the widest, so columns never
211
+ * move, what a ticker or a price wants. `false`: each digit at its own
212
+ * width, the font's proportional figures, for a face whose "1" is narrow
213
+ * (or that has no tabular figures at all); a changing column's width
214
+ * then eases once from the old digit's to the new one's.
215
+ */
216
+ tabularNums?: boolean
217
+ /**
218
+ * A `NumberFormat` the number follows: its prefix and suffix (the currency
219
+ * where the locale puts it), grouping and decimal separators, fraction
220
+ * digits and minimum integer digits. The individual props override what it
221
+ * says.
222
+ */
223
+ format?: NumberFormat
188
224
  /**
189
225
  * Scale the number down when the view is narrower than its content, and back
190
226
  * up (never above `fontSize`) when it fits again. Give the view a fixed
@@ -297,6 +333,13 @@ export const NitroNumber = forwardRef<NitroNumberHandle, NitroNumberProps>(
297
333
  affixAlign,
298
334
  prefixAlign,
299
335
  suffixAlign,
336
+ letterSpacing,
337
+ prefixSpacing,
338
+ suffixSpacing,
339
+ prefixOffset,
340
+ suffixOffset,
341
+ tabularNums,
342
+ format,
300
343
  adjustsFontSizeToFit,
301
344
  minimumFontScale,
302
345
  allowFontScaling,
@@ -406,6 +449,7 @@ export const NitroNumber = forwardRef<NitroNumberHandle, NitroNumberProps>(
406
449
  const numericWeight = toNumericWeight(fontWeight) ?? 400
407
450
  const resolvedFontSize = fontSize ?? 32
408
451
  const resolvedAffixAlign = affixAlign ?? 'baseline'
452
+ const derived = format ? formatProps(format) : undefined
409
453
 
410
454
  const autoSize = useMemo(
411
455
  () =>
@@ -430,12 +474,12 @@ export const NitroNumber = forwardRef<NitroNumberHandle, NitroNumberProps>(
430
474
  style={[autoSize, style]}
431
475
  hybridRef={hybridRef}
432
476
  value={value}
433
- fractionDigits={fractionDigits ?? 0}
434
- minimumIntegerDigits={minimumIntegerDigits ?? 1}
435
- groupingSeparator={groupingSeparator ?? ''}
436
- decimalSeparator={decimalSeparator ?? '.'}
437
- prefix={prefix ?? ''}
438
- suffix={suffix ?? ''}
477
+ fractionDigits={fractionDigits ?? derived?.fractionDigits ?? 0}
478
+ minimumIntegerDigits={minimumIntegerDigits ?? derived?.minimumIntegerDigits ?? 1}
479
+ groupingSeparator={groupingSeparator ?? derived?.groupingSeparator ?? ''}
480
+ decimalSeparator={decimalSeparator ?? derived?.decimalSeparator ?? '.'}
481
+ prefix={prefix ?? derived?.prefix ?? ''}
482
+ suffix={suffix ?? derived?.suffix ?? ''}
439
483
  transition={transition ?? 'roll'}
440
484
  flashUpColor={processedFlashUp}
441
485
  flashDownColor={processedFlashDown}
@@ -465,6 +509,12 @@ export const NitroNumber = forwardRef<NitroNumberHandle, NitroNumberProps>(
465
509
  affixAlign={resolvedAffixAlign}
466
510
  prefixAlign={prefixAlign ?? resolvedAffixAlign}
467
511
  suffixAlign={suffixAlign ?? resolvedAffixAlign}
512
+ letterSpacing={letterSpacing ?? 0}
513
+ prefixSpacing={prefixSpacing ?? Infinity}
514
+ suffixSpacing={suffixSpacing ?? Infinity}
515
+ prefixOffset={prefixOffset ?? 0}
516
+ suffixOffset={suffixOffset ?? 0}
517
+ tabularNums={tabularNums ?? true}
468
518
  adjustsFontSizeToFit={adjustsFontSizeToFit ?? false}
469
519
  minimumFontScale={minimumFontScale ?? 0.5}
470
520
  allowFontScaling={allowFontScaling ?? false}