@velion-la/onboarding-sdk-react-native 1.4.0-beta.2 → 1.4.0-beta.3

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 (224) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/README.md +22 -1
  3. package/lib/commonjs/camera/AddressSearchBar.js +9 -7
  4. package/lib/commonjs/camera/AddressSearchBar.js.map +1 -1
  5. package/lib/commonjs/camera/DocumentCapture.js +7 -6
  6. package/lib/commonjs/camera/DocumentCapture.js.map +1 -1
  7. package/lib/commonjs/camera/LivenessCamera.js +6 -5
  8. package/lib/commonjs/camera/LivenessCamera.js.map +1 -1
  9. package/lib/commonjs/camera/MapAddressPicker.js +2 -1
  10. package/lib/commonjs/camera/MapAddressPicker.js.map +1 -1
  11. package/lib/commonjs/index.js +6 -0
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/steps/AddressInfoStep.js +4 -3
  14. package/lib/commonjs/steps/AddressInfoStep.js.map +1 -1
  15. package/lib/commonjs/steps/DocumentsOcrStep.js +4 -3
  16. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
  17. package/lib/commonjs/steps/EconomicActivityStep.js +3 -2
  18. package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -1
  19. package/lib/commonjs/steps/EmailOtpStep.js +2 -1
  20. package/lib/commonjs/steps/EmailOtpStep.js.map +1 -1
  21. package/lib/commonjs/steps/FaceMatchStep.js +3 -2
  22. package/lib/commonjs/steps/FaceMatchStep.js.map +1 -1
  23. package/lib/commonjs/steps/LivenessMatchStep.js +3 -2
  24. package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -1
  25. package/lib/commonjs/steps/PhoneOtpStep.js +2 -1
  26. package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -1
  27. package/lib/commonjs/steps/TermsAndConditionsStep.js +3 -2
  28. package/lib/commonjs/steps/TermsAndConditionsStep.js.map +1 -1
  29. package/lib/commonjs/types/index.js +7 -6
  30. package/lib/commonjs/types/index.js.map +1 -1
  31. package/lib/commonjs/ui/StepShell.js +3 -2
  32. package/lib/commonjs/ui/StepShell.js.map +1 -1
  33. package/lib/commonjs/ui/VelionOnboardingScreen.js +5 -4
  34. package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
  35. package/lib/commonjs/ui/icons/StepIcon.js +2 -2
  36. package/lib/commonjs/ui/icons/StepIcon.js.map +1 -1
  37. package/lib/commonjs/ui/overlays/AnalyzingOverlay.js +3 -2
  38. package/lib/commonjs/ui/overlays/AnalyzingOverlay.js.map +1 -1
  39. package/lib/commonjs/ui/overlays/LoadingOverlay.js +2 -1
  40. package/lib/commonjs/ui/overlays/LoadingOverlay.js.map +1 -1
  41. package/lib/commonjs/ui/overlays/RetryDialog.js +4 -3
  42. package/lib/commonjs/ui/overlays/RetryDialog.js.map +1 -1
  43. package/lib/commonjs/ui/primitives/BackButton.js +2 -1
  44. package/lib/commonjs/ui/primitives/BackButton.js.map +1 -1
  45. package/lib/commonjs/ui/primitives/Banner.js +3 -2
  46. package/lib/commonjs/ui/primitives/Banner.js.map +1 -1
  47. package/lib/commonjs/ui/primitives/Button.js +8 -5
  48. package/lib/commonjs/ui/primitives/Button.js.map +1 -1
  49. package/lib/commonjs/ui/primitives/Checkbox.js +5 -4
  50. package/lib/commonjs/ui/primitives/Checkbox.js.map +1 -1
  51. package/lib/commonjs/ui/primitives/CountrySelect.js +16 -13
  52. package/lib/commonjs/ui/primitives/CountrySelect.js.map +1 -1
  53. package/lib/commonjs/ui/primitives/DatePicker.js +4 -3
  54. package/lib/commonjs/ui/primitives/DatePicker.js.map +1 -1
  55. package/lib/commonjs/ui/primitives/Input.js +9 -7
  56. package/lib/commonjs/ui/primitives/Input.js.map +1 -1
  57. package/lib/commonjs/ui/primitives/SearchableSingleSelectList.js +8 -6
  58. package/lib/commonjs/ui/primitives/SearchableSingleSelectList.js.map +1 -1
  59. package/lib/commonjs/ui/primitives/Select.js +11 -9
  60. package/lib/commonjs/ui/primitives/Select.js.map +1 -1
  61. package/lib/commonjs/ui/primitives/Text.js +67 -0
  62. package/lib/commonjs/ui/primitives/Text.js.map +1 -0
  63. package/lib/commonjs/ui/primitives/index.js +13 -0
  64. package/lib/commonjs/ui/primitives/index.js.map +1 -1
  65. package/lib/commonjs/ui/theme/ThemeProvider.js +14 -1
  66. package/lib/commonjs/ui/theme/ThemeProvider.js.map +1 -1
  67. package/lib/commonjs/ui/theme/fontLoader.js +77 -0
  68. package/lib/commonjs/ui/theme/fontLoader.js.map +1 -0
  69. package/lib/commonjs/ui/theme/fonts.js +200 -0
  70. package/lib/commonjs/ui/theme/fonts.js.map +1 -0
  71. package/lib/commonjs/ui/theme/index.js +31 -0
  72. package/lib/commonjs/ui/theme/index.js.map +1 -1
  73. package/lib/commonjs/ui/theme/tokens.js +32 -9
  74. package/lib/commonjs/ui/theme/tokens.js.map +1 -1
  75. package/lib/module/camera/AddressSearchBar.js +5 -3
  76. package/lib/module/camera/AddressSearchBar.js.map +1 -1
  77. package/lib/module/camera/DocumentCapture.js +2 -1
  78. package/lib/module/camera/DocumentCapture.js.map +1 -1
  79. package/lib/module/camera/LivenessCamera.js +2 -1
  80. package/lib/module/camera/LivenessCamera.js.map +1 -1
  81. package/lib/module/camera/MapAddressPicker.js +2 -1
  82. package/lib/module/camera/MapAddressPicker.js.map +1 -1
  83. package/lib/module/index.js +1 -1
  84. package/lib/module/index.js.map +1 -1
  85. package/lib/module/steps/AddressInfoStep.js +2 -1
  86. package/lib/module/steps/AddressInfoStep.js.map +1 -1
  87. package/lib/module/steps/DocumentsOcrStep.js +2 -1
  88. package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
  89. package/lib/module/steps/EconomicActivityStep.js +2 -1
  90. package/lib/module/steps/EconomicActivityStep.js.map +1 -1
  91. package/lib/module/steps/EmailOtpStep.js +2 -1
  92. package/lib/module/steps/EmailOtpStep.js.map +1 -1
  93. package/lib/module/steps/FaceMatchStep.js +2 -1
  94. package/lib/module/steps/FaceMatchStep.js.map +1 -1
  95. package/lib/module/steps/LivenessMatchStep.js +2 -1
  96. package/lib/module/steps/LivenessMatchStep.js.map +1 -1
  97. package/lib/module/steps/PhoneOtpStep.js +2 -1
  98. package/lib/module/steps/PhoneOtpStep.js.map +1 -1
  99. package/lib/module/steps/TermsAndConditionsStep.js +2 -1
  100. package/lib/module/steps/TermsAndConditionsStep.js.map +1 -1
  101. package/lib/module/types/index.js +7 -6
  102. package/lib/module/types/index.js.map +1 -1
  103. package/lib/module/ui/StepShell.js +2 -1
  104. package/lib/module/ui/StepShell.js.map +1 -1
  105. package/lib/module/ui/VelionOnboardingScreen.js +2 -1
  106. package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
  107. package/lib/module/ui/icons/StepIcon.js +1 -1
  108. package/lib/module/ui/icons/StepIcon.js.map +1 -1
  109. package/lib/module/ui/overlays/AnalyzingOverlay.js +2 -1
  110. package/lib/module/ui/overlays/AnalyzingOverlay.js.map +1 -1
  111. package/lib/module/ui/overlays/LoadingOverlay.js +2 -1
  112. package/lib/module/ui/overlays/LoadingOverlay.js.map +1 -1
  113. package/lib/module/ui/overlays/RetryDialog.js +2 -1
  114. package/lib/module/ui/overlays/RetryDialog.js.map +1 -1
  115. package/lib/module/ui/primitives/BackButton.js +2 -1
  116. package/lib/module/ui/primitives/BackButton.js.map +1 -1
  117. package/lib/module/ui/primitives/Banner.js +2 -1
  118. package/lib/module/ui/primitives/Banner.js.map +1 -1
  119. package/lib/module/ui/primitives/Button.js +7 -4
  120. package/lib/module/ui/primitives/Button.js.map +1 -1
  121. package/lib/module/ui/primitives/Checkbox.js +2 -1
  122. package/lib/module/ui/primitives/Checkbox.js.map +1 -1
  123. package/lib/module/ui/primitives/CountrySelect.js +8 -5
  124. package/lib/module/ui/primitives/CountrySelect.js.map +1 -1
  125. package/lib/module/ui/primitives/DatePicker.js +2 -1
  126. package/lib/module/ui/primitives/DatePicker.js.map +1 -1
  127. package/lib/module/ui/primitives/Input.js +6 -4
  128. package/lib/module/ui/primitives/Input.js.map +1 -1
  129. package/lib/module/ui/primitives/SearchableSingleSelectList.js +5 -3
  130. package/lib/module/ui/primitives/SearchableSingleSelectList.js.map +1 -1
  131. package/lib/module/ui/primitives/Select.js +5 -3
  132. package/lib/module/ui/primitives/Select.js.map +1 -1
  133. package/lib/module/ui/primitives/Text.js +65 -0
  134. package/lib/module/ui/primitives/Text.js.map +1 -0
  135. package/lib/module/ui/primitives/index.js +1 -0
  136. package/lib/module/ui/primitives/index.js.map +1 -1
  137. package/lib/module/ui/theme/ThemeProvider.js +13 -1
  138. package/lib/module/ui/theme/ThemeProvider.js.map +1 -1
  139. package/lib/module/ui/theme/fontLoader.js +70 -0
  140. package/lib/module/ui/theme/fontLoader.js.map +1 -0
  141. package/lib/module/ui/theme/fonts.js +191 -0
  142. package/lib/module/ui/theme/fonts.js.map +1 -0
  143. package/lib/module/ui/theme/index.js +3 -2
  144. package/lib/module/ui/theme/index.js.map +1 -1
  145. package/lib/module/ui/theme/tokens.js +31 -9
  146. package/lib/module/ui/theme/tokens.js.map +1 -1
  147. package/lib/typescript/camera/AddressSearchBar.d.ts.map +1 -1
  148. package/lib/typescript/index.d.ts +1 -1
  149. package/lib/typescript/index.d.ts.map +1 -1
  150. package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -1
  151. package/lib/typescript/steps/EconomicActivityStep.d.ts.map +1 -1
  152. package/lib/typescript/steps/EmailOtpStep.d.ts.map +1 -1
  153. package/lib/typescript/steps/FaceMatchStep.d.ts.map +1 -1
  154. package/lib/typescript/steps/LivenessMatchStep.d.ts.map +1 -1
  155. package/lib/typescript/steps/PhoneOtpStep.d.ts.map +1 -1
  156. package/lib/typescript/steps/TermsAndConditionsStep.d.ts.map +1 -1
  157. package/lib/typescript/types/index.d.ts +35 -7
  158. package/lib/typescript/types/index.d.ts.map +1 -1
  159. package/lib/typescript/ui/StepShell.d.ts.map +1 -1
  160. package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
  161. package/lib/typescript/ui/overlays/LoadingOverlay.d.ts.map +1 -1
  162. package/lib/typescript/ui/overlays/RetryDialog.d.ts.map +1 -1
  163. package/lib/typescript/ui/primitives/BackButton.d.ts.map +1 -1
  164. package/lib/typescript/ui/primitives/Banner.d.ts.map +1 -1
  165. package/lib/typescript/ui/primitives/Button.d.ts +2 -1
  166. package/lib/typescript/ui/primitives/Button.d.ts.map +1 -1
  167. package/lib/typescript/ui/primitives/Checkbox.d.ts.map +1 -1
  168. package/lib/typescript/ui/primitives/CountrySelect.d.ts.map +1 -1
  169. package/lib/typescript/ui/primitives/DatePicker.d.ts.map +1 -1
  170. package/lib/typescript/ui/primitives/Input.d.ts +3 -3
  171. package/lib/typescript/ui/primitives/Input.d.ts.map +1 -1
  172. package/lib/typescript/ui/primitives/SearchableSingleSelectList.d.ts.map +1 -1
  173. package/lib/typescript/ui/primitives/Select.d.ts.map +1 -1
  174. package/lib/typescript/ui/primitives/Text.d.ts +19 -0
  175. package/lib/typescript/ui/primitives/Text.d.ts.map +1 -0
  176. package/lib/typescript/ui/primitives/index.d.ts +1 -0
  177. package/lib/typescript/ui/primitives/index.d.ts.map +1 -1
  178. package/lib/typescript/ui/theme/ThemeProvider.d.ts +7 -0
  179. package/lib/typescript/ui/theme/ThemeProvider.d.ts.map +1 -1
  180. package/lib/typescript/ui/theme/fontLoader.d.ts +28 -0
  181. package/lib/typescript/ui/theme/fontLoader.d.ts.map +1 -0
  182. package/lib/typescript/ui/theme/fonts.d.ts +157 -0
  183. package/lib/typescript/ui/theme/fonts.d.ts.map +1 -0
  184. package/lib/typescript/ui/theme/index.d.ts +3 -2
  185. package/lib/typescript/ui/theme/index.d.ts.map +1 -1
  186. package/lib/typescript/ui/theme/tokens.d.ts +25 -2
  187. package/lib/typescript/ui/theme/tokens.d.ts.map +1 -1
  188. package/package.json +2 -1
  189. package/src/camera/AddressSearchBar.tsx +3 -4
  190. package/src/camera/DocumentCapture.tsx +1 -1
  191. package/src/camera/LivenessCamera.tsx +1 -1
  192. package/src/camera/MapAddressPicker.tsx +1 -1
  193. package/src/index.ts +2 -0
  194. package/src/steps/AddressInfoStep.tsx +6 -1
  195. package/src/steps/DocumentsOcrStep.tsx +1 -1
  196. package/src/steps/EconomicActivityStep.tsx +6 -1
  197. package/src/steps/EmailOtpStep.tsx +6 -1
  198. package/src/steps/FaceMatchStep.tsx +6 -1
  199. package/src/steps/LivenessMatchStep.tsx +7 -1
  200. package/src/steps/PhoneOtpStep.tsx +6 -1
  201. package/src/steps/TermsAndConditionsStep.tsx +7 -1
  202. package/src/types/index.ts +35 -7
  203. package/src/ui/StepShell.tsx +6 -1
  204. package/src/ui/VelionOnboardingScreen.tsx +5 -1
  205. package/src/ui/icons/StepIcon.tsx +1 -1
  206. package/src/ui/overlays/AnalyzingOverlay.tsx +1 -1
  207. package/src/ui/overlays/LoadingOverlay.tsx +7 -1
  208. package/src/ui/overlays/RetryDialog.tsx +5 -1
  209. package/src/ui/primitives/BackButton.tsx +5 -1
  210. package/src/ui/primitives/Banner.tsx +5 -1
  211. package/src/ui/primitives/Button.tsx +5 -4
  212. package/src/ui/primitives/Checkbox.tsx +5 -1
  213. package/src/ui/primitives/CountrySelect.tsx +5 -6
  214. package/src/ui/primitives/DatePicker.tsx +7 -1
  215. package/src/ui/primitives/Input.tsx +6 -6
  216. package/src/ui/primitives/SearchableSingleSelectList.tsx +3 -4
  217. package/src/ui/primitives/Select.tsx +3 -3
  218. package/src/ui/primitives/Text.tsx +66 -0
  219. package/src/ui/primitives/index.ts +1 -0
  220. package/src/ui/theme/ThemeProvider.tsx +15 -2
  221. package/src/ui/theme/fontLoader.ts +92 -0
  222. package/src/ui/theme/fonts.ts +220 -0
  223. package/src/ui/theme/index.ts +9 -0
  224. package/src/ui/theme/tokens.ts +44 -6
@@ -1,6 +1,7 @@
1
1
  export {
2
2
  ThemeProvider,
3
3
  useTheme,
4
+ useOptionalTheme,
4
5
  useReducedMotion,
5
6
  type ThemeProviderProps,
6
7
  } from './ThemeProvider';
@@ -12,6 +13,14 @@ export {
12
13
  mixHex,
13
14
  withAlpha,
14
15
  isHexDark,
16
+ DEFAULT_CONTROL_HEIGHT_PX,
15
17
  type ResolvedTheme,
16
18
  type ThemeTokenSet,
17
19
  } from './tokens';
20
+ export {
21
+ VELION_FONT_IDS,
22
+ resolveFontId,
23
+ fontStyleFor,
24
+ type VelionFontId,
25
+ type VelionCatalogFontId,
26
+ } from './fonts';
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type { VelionTheme } from '../../types';
12
+ import type { VelionCatalogFontId } from './fonts';
12
13
 
13
14
  /** Tonal token set. Shape matches `VelionTheme` (all required, no undefineds). */
14
15
  export type ThemeTokenSet = Required<VelionTheme>;
@@ -23,8 +24,21 @@ export interface ResolvedTheme extends ThemeTokenSet {
23
24
  effectiveMode: 'light' | 'dark';
24
25
  /** The numeric pixel value parsed from `borderRadius` (the SDK-wide default). */
25
26
  borderRadiusPx: number;
27
+ /** Minimum height of inputs and selects, parsed from `inputHeight`. */
28
+ inputHeightPx: number;
29
+ /** Minimum height of buttons, parsed from `buttonHeight`. */
30
+ buttonHeightPx: number;
31
+ /**
32
+ * Catalog font every text renders with, or `null` for the system font.
33
+ * Set only once the font files are loaded, so a text never names a face the
34
+ * platform does not have yet.
35
+ */
36
+ fontId: VelionCatalogFontId | null;
26
37
  }
27
38
 
39
+ /** Default for `inputHeight` and `buttonHeight`: the 44 px tap target. */
40
+ export const DEFAULT_CONTROL_HEIGHT_PX = 44;
41
+
28
42
  export const LIGHT_TOKENS: ThemeTokenSet = {
29
43
  primaryColor: '#2563EB',
30
44
  secondaryColor: '#1D4ED8',
@@ -32,7 +46,7 @@ export const LIGHT_TOKENS: ThemeTokenSet = {
32
46
  textColor: '#111827',
33
47
  textSecondaryColor: '#6B7280',
34
48
  borderRadius: '8px',
35
- fontFamily: 'System',
49
+ fontFamily: 'system',
36
50
  errorColor: '#DC2626',
37
51
  successColor: '#16A34A',
38
52
  warningColor: '#D97706',
@@ -40,6 +54,8 @@ export const LIGHT_TOKENS: ThemeTokenSet = {
40
54
  cardShadow: '0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -2px rgba(0,0,0,0.10)',
41
55
  hideStepIcons: false,
42
56
  hideProgressBar: false,
57
+ inputHeight: '44px',
58
+ buttonHeight: '44px',
43
59
  };
44
60
 
45
61
  export const DARK_TOKENS: ThemeTokenSet = {
@@ -49,7 +65,7 @@ export const DARK_TOKENS: ThemeTokenSet = {
49
65
  textColor: '#F1F5F9',
50
66
  textSecondaryColor: '#94A3B8',
51
67
  borderRadius: '8px',
52
- fontFamily: 'System',
68
+ fontFamily: 'system',
53
69
  errorColor: '#F87171',
54
70
  successColor: '#34D399',
55
71
  warningColor: '#FBBF24',
@@ -57,6 +73,8 @@ export const DARK_TOKENS: ThemeTokenSet = {
57
73
  cardShadow: '0 8px 18px -4px rgba(0,0,0,0.55), 0 4px 8px -4px rgba(0,0,0,0.40)',
58
74
  hideStepIcons: false,
59
75
  hideProgressBar: false,
76
+ inputHeight: '44px',
77
+ buttonHeight: '44px',
60
78
  };
61
79
 
62
80
  export function getDefaultThemeTokens(
@@ -65,10 +83,16 @@ export function getDefaultThemeTokens(
65
83
  return colorMode === 'dark' ? { ...DARK_TOKENS } : { ...LIGHT_TOKENS };
66
84
  }
67
85
 
68
- /** Layers consumer overrides on top of the base tokens for the requested mode. */
86
+ /**
87
+ * Layers consumer overrides on top of the base tokens for the requested mode.
88
+ *
89
+ * `loadedFontId` is the catalog font whose files are already loaded (see
90
+ * `ThemeProvider`); until then texts keep the system font.
91
+ */
69
92
  export function resolveTheme(
70
93
  theme: VelionTheme | undefined,
71
94
  colorMode: 'light' | 'dark',
95
+ loadedFontId: VelionCatalogFontId | null = null,
72
96
  ): ResolvedTheme {
73
97
  const base = colorMode === 'dark' ? DARK_TOKENS : LIGHT_TOKENS;
74
98
  const merged: ThemeTokenSet = { ...base, ...theme };
@@ -79,7 +103,16 @@ export function resolveTheme(
79
103
  ? 'dark'
80
104
  : 'light';
81
105
  const borderRadiusPx = parsePx(merged.borderRadius, 8);
82
- return { ...merged, effectiveMode, borderRadiusPx };
106
+ const inputHeightPx = parsePx(merged.inputHeight, DEFAULT_CONTROL_HEIGHT_PX);
107
+ const buttonHeightPx = parsePx(merged.buttonHeight, DEFAULT_CONTROL_HEIGHT_PX);
108
+ return {
109
+ ...merged,
110
+ effectiveMode,
111
+ borderRadiusPx,
112
+ inputHeightPx,
113
+ buttonHeightPx,
114
+ fontId: loadedFontId,
115
+ };
83
116
  }
84
117
 
85
118
  /** WCAG relative-luminance check. Returns false on unparsable input. */
@@ -149,8 +182,13 @@ function clamp(n: number, min: number, max: number): number {
149
182
  return n;
150
183
  }
151
184
 
152
- function parsePx(value: string, fallback: number): number {
153
- const m = value.trim().match(/^(\d+(?:\.\d+)?)\s*px$/i);
185
+ /**
186
+ * Parses a `'12px'` theme length. A bare number (`'12'`) is read as pixels;
187
+ * anything else — other units, garbage, a missing value — gives `fallback`.
188
+ */
189
+ export function parsePx(value: string | undefined, fallback: number): number {
190
+ if (typeof value !== 'string') return fallback;
191
+ const m = value.trim().match(/^(\d+(?:\.\d+)?)\s*(?:px)?$/i);
154
192
  if (m && m[1]) {
155
193
  const parsed = Number(m[1]);
156
194
  if (Number.isFinite(parsed)) return parsed;