@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
@@ -6,7 +6,8 @@
6
6
  * - Secondary: filled with `secondaryColor`.
7
7
  * - Ghost: transparent with border + text in `textColor`.
8
8
  *
9
- * 44 px min tap target (Apple HIG / WCAG 2.5.5). Disabled state dims at 0.45
9
+ * Min height from `theme.buttonHeight` (44 px by default, the Apple HIG /
10
+ * WCAG 2.5.5 tap target). Disabled state dims at 0.45
10
11
  * opacity (matches `.vl-btn:disabled`).
11
12
  */
12
13
 
@@ -15,12 +16,12 @@ import {
15
16
  ActivityIndicator,
16
17
  Pressable,
17
18
  StyleSheet,
18
- Text,
19
19
  View,
20
20
  type GestureResponderEvent,
21
21
  type StyleProp,
22
22
  type ViewStyle,
23
23
  } from 'react-native';
24
+ import { Text } from './Text';
24
25
  import { useTheme, withAlpha } from '../theme';
25
26
 
26
27
  export type ButtonVariant = 'primary' | 'secondary' | 'ghost';
@@ -66,6 +67,7 @@ export function Button({
66
67
  testID={testID}
67
68
  style={({ pressed }) => [
68
69
  styles.base,
70
+ { minHeight: theme.buttonHeightPx },
69
71
  { borderRadius: theme.borderRadiusPx },
70
72
  variantStyles.container,
71
73
  fullWidth && styles.fullWidth,
@@ -136,9 +138,8 @@ function buildVariantStyles(
136
138
 
137
139
  const styles = StyleSheet.create({
138
140
  base: {
139
- minHeight: 44,
140
141
  paddingHorizontal: 16,
141
- paddingVertical: 10,
142
+ paddingVertical: 8,
142
143
  borderWidth: 1,
143
144
  alignItems: 'center',
144
145
  justifyContent: 'center',
@@ -9,7 +9,11 @@
9
9
  * No external icon dependency: the check is a tinted square with a "✓" glyph.
10
10
  */
11
11
 
12
- import { StyleSheet, Text, View } from 'react-native';
12
+ import {
13
+ StyleSheet,
14
+ View,
15
+ } from 'react-native';
16
+ import { Text } from './Text';
13
17
  import { Pressable } from 'react-native';
14
18
  import { mixHex, useTheme } from '../theme';
15
19
 
@@ -18,12 +18,11 @@ import {
18
18
  Modal,
19
19
  Pressable,
20
20
  StyleSheet,
21
- Text,
22
- TextInput,
23
21
  View,
24
22
  type StyleProp,
25
23
  type ViewStyle,
26
24
  } from 'react-native';
25
+ import { Text, TextInput } from './Text';
27
26
  import { useTheme, withAlpha } from '../theme';
28
27
  import {
29
28
  filterIso3166Countries,
@@ -116,6 +115,7 @@ export function CountrySelect({
116
115
  onPress={() => setOpen(true)}
117
116
  style={[
118
117
  styles.trigger,
118
+ { minHeight: theme.inputHeightPx },
119
119
  {
120
120
  backgroundColor: theme.backgroundColor,
121
121
  borderColor: hasError ? theme.errorColor : theme.borderColor,
@@ -179,6 +179,7 @@ export function CountrySelect({
179
179
  onChangeText={setQuery}
180
180
  style={[
181
181
  styles.search,
182
+ { minHeight: theme.inputHeightPx },
182
183
  {
183
184
  color: theme.textColor,
184
185
  backgroundColor: theme.backgroundColor,
@@ -270,9 +271,8 @@ const styles = StyleSheet.create({
270
271
  fontWeight: '400',
271
272
  },
272
273
  trigger: {
273
- minHeight: 44,
274
274
  paddingHorizontal: 12,
275
- paddingVertical: 10,
275
+ paddingVertical: 8,
276
276
  borderWidth: 1,
277
277
  flexDirection: 'row',
278
278
  alignItems: 'center',
@@ -316,9 +316,8 @@ const styles = StyleSheet.create({
316
316
  marginBottom: 8,
317
317
  },
318
318
  search: {
319
- minHeight: 44,
320
319
  paddingHorizontal: 12,
321
- paddingVertical: 10,
320
+ paddingVertical: 8,
322
321
  fontSize: 15,
323
322
  borderWidth: 1,
324
323
  marginBottom: 8,
@@ -22,7 +22,13 @@
22
22
  */
23
23
 
24
24
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
25
- import { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';
25
+ import {
26
+ StyleSheet,
27
+ View,
28
+ type StyleProp,
29
+ type ViewStyle,
30
+ } from 'react-native';
31
+ import { Text } from './Text';
26
32
  import { useTheme } from '../theme';
27
33
  import { Select, type SelectOption } from './Select';
28
34
 
@@ -2,7 +2,7 @@
2
2
  * Themed text input with optional inline error message.
3
3
  *
4
4
  * Matches `.vl-hbi__input` semantics:
5
- * - 44 px min height tap target.
5
+ * - Min height from `theme.inputHeight` (44 px by default, the tap target).
6
6
  * - Border switches to `errorColor` and a subtle ring when `errorMessage` is set.
7
7
  * - Pairs an externally controlled label rendered above (see `<Field>` helper).
8
8
  */
@@ -10,13 +10,13 @@
10
10
  import { forwardRef, useId } from 'react';
11
11
  import {
12
12
  StyleSheet,
13
- Text,
14
- TextInput,
15
13
  View,
16
14
  type StyleProp,
15
+ type TextInput as RNTextInput,
17
16
  type TextInputProps,
18
17
  type ViewStyle,
19
18
  } from 'react-native';
19
+ import { Text, TextInput } from './Text';
20
20
  import { useTheme } from '../theme';
21
21
 
22
22
  export interface InputProps extends Omit<TextInputProps, 'style'> {
@@ -26,7 +26,7 @@ export interface InputProps extends Omit<TextInputProps, 'style'> {
26
26
  containerStyle?: StyleProp<ViewStyle>;
27
27
  }
28
28
 
29
- export const Input = forwardRef<TextInput, InputProps>(function Input(
29
+ export const Input = forwardRef<RNTextInput, InputProps>(function Input(
30
30
  { label, errorMessage, required, containerStyle, ...rest },
31
31
  ref,
32
32
  ) {
@@ -55,6 +55,7 @@ export const Input = forwardRef<TextInput, InputProps>(function Input(
55
55
  {...rest}
56
56
  style={[
57
57
  styles.input,
58
+ { minHeight: theme.inputHeightPx },
58
59
  {
59
60
  color: theme.textColor,
60
61
  backgroundColor: theme.backgroundColor,
@@ -96,9 +97,8 @@ const styles = StyleSheet.create({
96
97
  fontWeight: '400',
97
98
  },
98
99
  input: {
99
- minHeight: 44,
100
100
  paddingHorizontal: 12,
101
- paddingVertical: 10,
101
+ paddingVertical: 8,
102
102
  fontSize: 15,
103
103
  borderWidth: 1,
104
104
  },
@@ -21,12 +21,11 @@ import {
21
21
  FlatList,
22
22
  Pressable,
23
23
  StyleSheet,
24
- Text,
25
- TextInput,
26
24
  View,
27
25
  type StyleProp,
28
26
  type ViewStyle,
29
27
  } from 'react-native';
28
+ import { Text, TextInput } from './Text';
30
29
  import { useTheme, withAlpha } from '../theme';
31
30
  import {
32
31
  filterSearchableOptions,
@@ -79,6 +78,7 @@ export function SearchableSingleSelectList({
79
78
  onChangeText={setQuery}
80
79
  style={[
81
80
  styles.search,
81
+ { minHeight: theme.inputHeightPx },
82
82
  {
83
83
  color: theme.textColor,
84
84
  backgroundColor: theme.backgroundColor,
@@ -155,9 +155,8 @@ const styles = StyleSheet.create({
155
155
  width: '100%',
156
156
  },
157
157
  search: {
158
- minHeight: 44,
159
158
  paddingHorizontal: 12,
160
- paddingVertical: 10,
159
+ paddingVertical: 8,
161
160
  fontSize: 15,
162
161
  borderWidth: 1,
163
162
  marginBottom: 8,
@@ -13,11 +13,11 @@ import {
13
13
  Pressable,
14
14
  ScrollView,
15
15
  StyleSheet,
16
- Text,
17
16
  View,
18
17
  type StyleProp,
19
18
  type ViewStyle,
20
19
  } from 'react-native';
20
+ import { Text } from './Text';
21
21
  import { useTheme, withAlpha } from '../theme';
22
22
 
23
23
  export interface SelectOption {
@@ -78,6 +78,7 @@ export function Select({
78
78
  onPress={() => setOpen(true)}
79
79
  style={[
80
80
  styles.trigger,
81
+ { minHeight: theme.inputHeightPx },
81
82
  {
82
83
  backgroundColor: theme.backgroundColor,
83
84
  borderColor: hasError ? theme.errorColor : theme.borderColor,
@@ -199,9 +200,8 @@ const styles = StyleSheet.create({
199
200
  fontWeight: '400',
200
201
  },
201
202
  trigger: {
202
- minHeight: 44,
203
203
  paddingHorizontal: 12,
204
- paddingVertical: 10,
204
+ paddingVertical: 8,
205
205
  borderWidth: 1,
206
206
  flexDirection: 'row',
207
207
  alignItems: 'center',
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview Themed `Text` and `TextInput` (OSDKR-45).
3
+ *
4
+ * Drop-in replacements for the React Native components that render with the
5
+ * theme's catalog font. Every SDK text goes through them — a test fails if a
6
+ * file imports `Text` or `TextInput` from `react-native` directly — so the
7
+ * font configured in `VelionTheme.fontFamily` reaches all of them.
8
+ *
9
+ * The face is picked from the text's own `fontWeight`, or from the enclosing
10
+ * `Text`'s when a nested one sets none (React Native inherits the weight, but
11
+ * a nested text names its own face, so the weight has to travel with it).
12
+ * With no catalog font
13
+ * loaded (or outside a `ThemeProvider`) they behave exactly like the React
14
+ * Native components.
15
+ */
16
+
17
+ import { createContext, forwardRef, useContext } from 'react';
18
+ import {
19
+ StyleSheet,
20
+ Text as RNText,
21
+ TextInput as RNTextInput,
22
+ type TextInputProps,
23
+ type TextProps,
24
+ } from 'react-native';
25
+ import { fontStyleFor } from '../theme/fonts';
26
+ import { useOptionalTheme } from '../theme/ThemeProvider';
27
+
28
+ /** `fontWeight` of the enclosing `Text`, for nested texts that set none. */
29
+ const InheritedWeight = createContext<unknown>(undefined);
30
+
31
+ export const Text = forwardRef<RNText, TextProps>(function Text(
32
+ { style, children, ...rest },
33
+ ref,
34
+ ) {
35
+ const fontId = useOptionalTheme()?.fontId ?? null;
36
+ const inheritedWeight = useContext(InheritedWeight);
37
+ if (!fontId) {
38
+ return (
39
+ <RNText ref={ref} {...rest} style={style}>
40
+ {children}
41
+ </RNText>
42
+ );
43
+ }
44
+ const weight = StyleSheet.flatten(style)?.fontWeight ?? inheritedWeight;
45
+ return (
46
+ <RNText ref={ref} {...rest} style={[style, fontStyleFor(fontId, weight)]}>
47
+ <InheritedWeight.Provider value={weight}>{children}</InheritedWeight.Provider>
48
+ </RNText>
49
+ );
50
+ });
51
+
52
+ export const TextInput = forwardRef<RNTextInput, TextInputProps>(
53
+ function TextInput({ style, ...rest }, ref) {
54
+ const fontId = useOptionalTheme()?.fontId ?? null;
55
+ const fontStyle = fontId
56
+ ? fontStyleFor(fontId, StyleSheet.flatten(style)?.fontWeight)
57
+ : undefined;
58
+ return (
59
+ <RNTextInput
60
+ ref={ref}
61
+ {...rest}
62
+ style={fontStyle ? [style, fontStyle] : style}
63
+ />
64
+ );
65
+ },
66
+ );
@@ -1,3 +1,4 @@
1
+ export { Text, TextInput } from './Text';
1
2
  export { Button, type ButtonProps, type ButtonVariant } from './Button';
2
3
  export { BackButton, type BackButtonProps } from './BackButton';
3
4
  export { Input, type InputProps } from './Input';
@@ -4,6 +4,8 @@
4
4
  * - `ThemeProvider` resolves tokens from `VelionConfig.theme` + colorMode and
5
5
  * exposes them to descendants.
6
6
  * - `useTheme()` returns the active `ResolvedTheme`.
7
+ * - The catalog font named by `fontFamily` is loaded here (`useCatalogFont`)
8
+ * and exposed as `theme.fontId` once it is usable.
7
9
  * - `useReducedMotion()` honours the OS-level `prefers-reduced-motion` flag —
8
10
  * components disable animations when true.
9
11
  */
@@ -19,6 +21,7 @@ import React, {
19
21
  import { AccessibilityInfo, useColorScheme } from 'react-native';
20
22
  import type { VelionTheme } from '../../types';
21
23
  import { resolveTheme, type ResolvedTheme } from './tokens';
24
+ import { useCatalogFont } from './fontLoader';
22
25
 
23
26
  interface ThemeContextValue {
24
27
  theme: ResolvedTheme;
@@ -48,9 +51,11 @@ export function ThemeProvider({
48
51
  return systemScheme === 'dark' ? 'dark' : 'light';
49
52
  }, [colorMode, systemScheme]);
50
53
 
54
+ const loadedFontId = useCatalogFont(themeOverrides?.fontFamily);
55
+
51
56
  const theme = useMemo(
52
- () => resolveTheme(themeOverrides, resolvedMode),
53
- [themeOverrides, resolvedMode],
57
+ () => resolveTheme(themeOverrides, resolvedMode, loadedFontId),
58
+ [themeOverrides, resolvedMode, loadedFontId],
54
59
  );
55
60
 
56
61
  const value = useMemo<ThemeContextValue>(
@@ -73,6 +78,14 @@ export function useTheme(): ResolvedTheme {
73
78
  return ctx.theme;
74
79
  }
75
80
 
81
+ /**
82
+ * Like `useTheme`, but `null` outside a `ThemeProvider` instead of throwing.
83
+ * For primitives that must also render where no provider is mounted.
84
+ */
85
+ export function useOptionalTheme(): ResolvedTheme | null {
86
+ return useContext(ThemeContext)?.theme ?? null;
87
+ }
88
+
76
89
  export function useReducedMotion(): boolean {
77
90
  const ctx = useContext(ThemeContext);
78
91
  return ctx?.reduceMotion ?? false;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @fileoverview Loads the theme's catalog font with `expo-font` (OSDKR-45).
3
+ *
4
+ * `useCatalogFont` returns the catalog id only once every face is registered,
5
+ * so `ThemeProvider` never hands texts a family the platform does not have.
6
+ * Until then — and for good if the download fails — texts use the system font.
7
+ */
8
+
9
+ import { useEffect, useState } from 'react';
10
+ import * as ExpoFont from 'expo-font';
11
+ import { log } from '../../utils/log';
12
+ import {
13
+ fontSources,
14
+ resolveFontId,
15
+ type VelionCatalogFontId,
16
+ } from './fonts';
17
+
18
+ /** The slice of `expo-font` the loader uses; injectable for tests. */
19
+ export interface FontApi {
20
+ isLoaded(fontFamily: string): boolean;
21
+ loadAsync(fontMap: Record<string, string>): Promise<void>;
22
+ }
23
+
24
+ const expoFontApi: FontApi = {
25
+ isLoaded: (fontFamily) => ExpoFont.isLoaded(fontFamily),
26
+ loadAsync: (fontMap) => ExpoFont.loadAsync(fontMap),
27
+ };
28
+
29
+ /** True when every face of the font is already registered. */
30
+ export function isCatalogFontLoaded(
31
+ fontId: VelionCatalogFontId,
32
+ api: FontApi = expoFontApi,
33
+ ): boolean {
34
+ return Object.keys(fontSources(fontId)).every((face) => api.isLoaded(face));
35
+ }
36
+
37
+ /**
38
+ * Registers every face of the font. Resolves `true` when they are all usable
39
+ * and `false` when the download failed; it never rejects, because a missing
40
+ * font must not break the flow.
41
+ */
42
+ export async function loadCatalogFont(
43
+ fontId: VelionCatalogFontId,
44
+ api: FontApi = expoFontApi,
45
+ ): Promise<boolean> {
46
+ if (isCatalogFontLoaded(fontId, api)) return true;
47
+ try {
48
+ await api.loadAsync(fontSources(fontId));
49
+ return true;
50
+ } catch (error) {
51
+ log.warn(
52
+ `Could not load font "${fontId}"; using the system font.`,
53
+ error,
54
+ );
55
+ return false;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Resolves `fontFamily` against the catalog and loads it. Returns the id once
61
+ * the font is usable, `null` while it loads, when it failed, or when the value
62
+ * is not a catalog font.
63
+ */
64
+ export function useCatalogFont(
65
+ fontFamily: string | undefined,
66
+ ): VelionCatalogFontId | null {
67
+ const fontId = resolveFontId(fontFamily);
68
+ const [loadedFontId, setLoadedFontId] = useState<VelionCatalogFontId | null>(
69
+ () => (fontId && isCatalogFontLoaded(fontId) ? fontId : null),
70
+ );
71
+
72
+ useEffect(() => {
73
+ if (!fontId) {
74
+ if (fontFamily && fontFamily.trim().toLowerCase() !== 'system') {
75
+ log.warn(
76
+ `Font "${fontFamily}" is not in the SDK font catalog; using the system font.`,
77
+ );
78
+ }
79
+ setLoadedFontId(null);
80
+ return undefined;
81
+ }
82
+ let active = true;
83
+ loadCatalogFont(fontId).then((loaded) => {
84
+ if (active) setLoadedFontId(loaded ? fontId : null);
85
+ });
86
+ return () => {
87
+ active = false;
88
+ };
89
+ }, [fontId, fontFamily]);
90
+
91
+ return loadedFontId === fontId ? loadedFontId : null;
92
+ }
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @fileoverview Closed font catalog for `VelionTheme.fontFamily` (OSDKR-45).
3
+ *
4
+ * The theme names a font by id; the SDK maps that id to the font files it
5
+ * downloads with `expo-font`. A URL never comes from configuration (R-B12 of
6
+ * the web-onboarding design): an id outside the catalog renders with the
7
+ * system font. The ids and the catalog must stay in sync with the web SDK
8
+ * (OSDKW-39), so a workflow looks the same on web and mobile.
9
+ *
10
+ * Each family ships four static faces (400 / 500 / 600 / 700) — the weights
11
+ * the SDK's text styles use. Lighter weights resolve to 400 and heavier ones
12
+ * to 700. The files are the Google Fonts TTF instances (iOS and Android do not
13
+ * load WOFF2); the URLs are immutable and versioned by Google.
14
+ *
15
+ * This module has no React Native imports so it can be unit-tested in Node.
16
+ */
17
+
18
+ /** Weight slots the catalog ships a face for. */
19
+ export type FontWeightSlot = 400 | 500 | 600 | 700;
20
+
21
+ interface FontFamilyEntry {
22
+ /** Family name as Google Fonts publishes it. */
23
+ displayName: string;
24
+ /** One TTF per weight slot. */
25
+ faces: Record<FontWeightSlot, string>;
26
+ }
27
+
28
+ const CATALOG = {
29
+ 'inter': {
30
+ displayName: 'Inter',
31
+ faces: {
32
+ 400: 'https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZg.ttf',
33
+ 500: 'https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuI6fMZg.ttf',
34
+ 600: 'https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuGKYMZg.ttf',
35
+ 700: 'https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuFuYMZg.ttf',
36
+ },
37
+ },
38
+ 'roboto': {
39
+ displayName: 'Roboto',
40
+ faces: {
41
+ 400: 'https://fonts.gstatic.com/s/roboto/v51/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWubEbWmT.ttf',
42
+ 500: 'https://fonts.gstatic.com/s/roboto/v51/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWub2bWmT.ttf',
43
+ 600: 'https://fonts.gstatic.com/s/roboto/v51/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWuYaammT.ttf',
44
+ 700: 'https://fonts.gstatic.com/s/roboto/v51/KFOMCnqEu92Fr1ME7kSn66aGLdTylUAMQXC89YmC2DPNWuYjammT.ttf',
45
+ },
46
+ },
47
+ 'open-sans': {
48
+ displayName: 'Open Sans',
49
+ faces: {
50
+ 400: 'https://fonts.gstatic.com/s/opensans/v44/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0C4n.ttf',
51
+ 500: 'https://fonts.gstatic.com/s/opensans/v44/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjr0C4n.ttf',
52
+ 600: 'https://fonts.gstatic.com/s/opensans/v44/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsgH1y4n.ttf',
53
+ 700: 'https://fonts.gstatic.com/s/opensans/v44/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsg-1y4n.ttf',
54
+ },
55
+ },
56
+ 'montserrat': {
57
+ displayName: 'Montserrat',
58
+ faces: {
59
+ 400: 'https://fonts.gstatic.com/s/montserrat/v31/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-.ttf',
60
+ 500: 'https://fonts.gstatic.com/s/montserrat/v31/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtZ6Ew-.ttf',
61
+ 600: 'https://fonts.gstatic.com/s/montserrat/v31/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCu170w-.ttf',
62
+ 700: 'https://fonts.gstatic.com/s/montserrat/v31/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCuM70w-.ttf',
63
+ },
64
+ },
65
+ 'poppins': {
66
+ displayName: 'Poppins',
67
+ faces: {
68
+ 400: 'https://fonts.gstatic.com/s/poppins/v24/pxiEyp8kv8JHgFVrFJA.ttf',
69
+ 500: 'https://fonts.gstatic.com/s/poppins/v24/pxiByp8kv8JHgFVrLGT9V1s.ttf',
70
+ 600: 'https://fonts.gstatic.com/s/poppins/v24/pxiByp8kv8JHgFVrLEj6V1s.ttf',
71
+ 700: 'https://fonts.gstatic.com/s/poppins/v24/pxiByp8kv8JHgFVrLCz7V1s.ttf',
72
+ },
73
+ },
74
+ 'nunito': {
75
+ displayName: 'Nunito',
76
+ faces: {
77
+ 400: 'https://fonts.gstatic.com/s/nunito/v32/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshRTM.ttf',
78
+ 500: 'https://fonts.gstatic.com/s/nunito/v32/XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhRTM.ttf',
79
+ 600: 'https://fonts.gstatic.com/s/nunito/v32/XRXI3I6Li01BKofiOc5wtlZ2di8HDGUmRTM.ttf',
80
+ 700: 'https://fonts.gstatic.com/s/nunito/v32/XRXI3I6Li01BKofiOc5wtlZ2di8HDFwmRTM.ttf',
81
+ },
82
+ },
83
+ 'source-sans-3': {
84
+ displayName: 'Source Sans 3',
85
+ faces: {
86
+ 400: 'https://fonts.gstatic.com/s/sourcesans3/v20/nwpBtKy2OAdR1K-IwhWudF-R9QMylBJAV3Bo8Ky461EN.ttf',
87
+ 500: 'https://fonts.gstatic.com/s/sourcesans3/v20/nwpBtKy2OAdR1K-IwhWudF-R9QMylBJAV3Bo8KyK61EN.ttf',
88
+ 600: 'https://fonts.gstatic.com/s/sourcesans3/v20/nwpBtKy2OAdR1K-IwhWudF-R9QMylBJAV3Bo8Kxm7FEN.ttf',
89
+ 700: 'https://fonts.gstatic.com/s/sourcesans3/v20/nwpBtKy2OAdR1K-IwhWudF-R9QMylBJAV3Bo8Kxf7FEN.ttf',
90
+ },
91
+ },
92
+ 'work-sans': {
93
+ displayName: 'Work Sans',
94
+ faces: {
95
+ 400: 'https://fonts.gstatic.com/s/worksans/v24/QGY_z_wNahGAdqQ43RhVcIgYT2Xz5u32K0nXNig.ttf',
96
+ 500: 'https://fonts.gstatic.com/s/worksans/v24/QGY_z_wNahGAdqQ43RhVcIgYT2Xz5u32K3vXNig.ttf',
97
+ 600: 'https://fonts.gstatic.com/s/worksans/v24/QGY_z_wNahGAdqQ43RhVcIgYT2Xz5u32K5fQNig.ttf',
98
+ 700: 'https://fonts.gstatic.com/s/worksans/v24/QGY_z_wNahGAdqQ43RhVcIgYT2Xz5u32K67QNig.ttf',
99
+ },
100
+ },
101
+ 'ibm-plex-sans': {
102
+ displayName: 'IBM Plex Sans',
103
+ faces: {
104
+ 400: 'https://fonts.gstatic.com/s/ibmplexsans/v23/zYXGKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1swZSAXcomDVmadSD6llzAA.ttf',
105
+ 500: 'https://fonts.gstatic.com/s/ibmplexsans/v23/zYXGKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1swZSAXcomDVmadSD2FlzAA.ttf',
106
+ 600: 'https://fonts.gstatic.com/s/ibmplexsans/v23/zYXGKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1swZSAXcomDVmadSDNF5zAA.ttf',
107
+ 700: 'https://fonts.gstatic.com/s/ibmplexsans/v23/zYXGKVElMYYaJe8bpLHnCwDKr932-G7dytD-Dmu1swZSAXcomDVmadSDDV5zAA.ttf',
108
+ },
109
+ },
110
+ 'dm-sans': {
111
+ displayName: 'DM Sans',
112
+ faces: {
113
+ 400: 'https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTg.ttf',
114
+ 500: 'https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTg.ttf',
115
+ 600: 'https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTg.ttf',
116
+ 700: 'https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTg.ttf',
117
+ },
118
+ },
119
+ } as const satisfies Record<string, FontFamilyEntry>;
120
+
121
+ /** Id of a font in the catalog. */
122
+ export type VelionCatalogFontId = keyof typeof CATALOG;
123
+
124
+ /**
125
+ * Accepted values of `VelionTheme.fontFamily`: a catalog id, or `'system'`
126
+ * (the platform font, the default).
127
+ */
128
+ export type VelionFontId = 'system' | VelionCatalogFontId;
129
+
130
+ /** Every accepted font id, `'system'` first. */
131
+ export const VELION_FONT_IDS: readonly VelionFontId[] = [
132
+ 'system',
133
+ ...(Object.keys(CATALOG) as VelionCatalogFontId[]),
134
+ ];
135
+
136
+ const WEIGHT_SLOTS: readonly FontWeightSlot[] = [400, 500, 600, 700];
137
+
138
+ /**
139
+ * Resolves the `fontFamily` theme value to a catalog id, or `null` for the
140
+ * system font.
141
+ *
142
+ * Tolerates the CSS-style values the web theme used to take: only the first
143
+ * family of a comma-separated stack counts, quotes and case are ignored, and
144
+ * the Google Fonts name works as well as the id (`'Open Sans'` and
145
+ * `'"Open Sans", sans-serif'` both give `open-sans`). Anything else gives
146
+ * `null`.
147
+ */
148
+ export function resolveFontId(
149
+ value: string | null | undefined,
150
+ ): VelionCatalogFontId | null {
151
+ if (!value) return null;
152
+ const first = value.split(',')[0] ?? '';
153
+ const normalized = first
154
+ .trim()
155
+ .replace(/^['"]|['"]$/g, '')
156
+ .trim()
157
+ .toLowerCase()
158
+ .replace(/[\s_]+/g, '-');
159
+ return Object.prototype.hasOwnProperty.call(CATALOG, normalized)
160
+ ? (normalized as VelionCatalogFontId)
161
+ : null;
162
+ }
163
+
164
+ /**
165
+ * Maps a React Native `fontWeight` to the face that renders it. Numeric
166
+ * weights round to the nearest slot (ties go up); `'bold'` is 700 and anything
167
+ * unrecognised, `'normal'` included, is 400.
168
+ */
169
+ export function weightSlot(fontWeight: unknown): FontWeightSlot {
170
+ if (fontWeight === 'bold') return 700;
171
+ const numeric =
172
+ typeof fontWeight === 'number' ? fontWeight : Number(fontWeight);
173
+ if (!Number.isFinite(numeric)) return 400;
174
+ if (numeric <= 400) return 400;
175
+ if (numeric >= 700) return 700;
176
+ return numeric < 550 ? 500 : 600;
177
+ }
178
+
179
+ /**
180
+ * Name the face is registered under with `expo-font`. Prefixed so it cannot
181
+ * collide with a font the host app loads itself.
182
+ */
183
+ export function fontFaceName(
184
+ fontId: VelionCatalogFontId,
185
+ weight: FontWeightSlot,
186
+ ): string {
187
+ return `VelionFont-${fontId}-${weight}`;
188
+ }
189
+
190
+ /** The `{ faceName: url }` map to hand to `expo-font`'s `loadAsync`. */
191
+ export function fontSources(
192
+ fontId: VelionCatalogFontId,
193
+ ): Record<string, string> {
194
+ const entry: FontFamilyEntry = CATALOG[fontId];
195
+ const sources: Record<string, string> = {};
196
+ for (const weight of WEIGHT_SLOTS) {
197
+ sources[fontFaceName(fontId, weight)] = entry.faces[weight];
198
+ }
199
+ return sources;
200
+ }
201
+
202
+ /**
203
+ * Style that makes a text render with the loaded catalog font.
204
+ *
205
+ * Returns `undefined` when there is no font to apply, so the text keeps the
206
+ * system font. `fontWeight` is set to the slot of the face picked: on iOS the
207
+ * face is looked up by family and weight, so a mismatched weight would pick
208
+ * another face; on Android it stops a synthetic bold on top of a bold face.
209
+ */
210
+ export function fontStyleFor(
211
+ fontId: VelionCatalogFontId | null,
212
+ fontWeight: unknown,
213
+ ): { fontFamily: string; fontWeight: `${FontWeightSlot}` } | undefined {
214
+ if (!fontId) return undefined;
215
+ const weight = weightSlot(fontWeight);
216
+ return {
217
+ fontFamily: fontFaceName(fontId, weight),
218
+ fontWeight: String(weight) as `${FontWeightSlot}`,
219
+ };
220
+ }