@velion-la/onboarding-sdk-react-native 1.1.0-beta.2 → 1.1.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 (68) hide show
  1. package/README.md +40 -0
  2. package/lib/commonjs/steps/AddressInfoStep.js +41 -13
  3. package/lib/commonjs/steps/AddressInfoStep.js.map +1 -1
  4. package/lib/commonjs/steps/DocumentsOcrStep.js +37 -31
  5. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
  6. package/lib/commonjs/steps/EconomicActivityStep.js +53 -52
  7. package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -1
  8. package/lib/commonjs/ui/ScreenScaffold.js +99 -0
  9. package/lib/commonjs/ui/ScreenScaffold.js.map +1 -0
  10. package/lib/commonjs/ui/StepShell.js +23 -42
  11. package/lib/commonjs/ui/StepShell.js.map +1 -1
  12. package/lib/commonjs/ui/VelionOnboardingScreen.js +13 -10
  13. package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
  14. package/lib/commonjs/ui/forms/index.js +7 -0
  15. package/lib/commonjs/ui/forms/index.js.map +1 -1
  16. package/lib/commonjs/ui/forms/useFieldChain.js +56 -0
  17. package/lib/commonjs/ui/forms/useFieldChain.js.map +1 -0
  18. package/lib/commonjs/ui/keyboard.js +147 -0
  19. package/lib/commonjs/ui/keyboard.js.map +1 -0
  20. package/lib/commonjs/ui/screenInsets.js +67 -0
  21. package/lib/commonjs/ui/screenInsets.js.map +1 -0
  22. package/lib/module/steps/AddressInfoStep.js +41 -13
  23. package/lib/module/steps/AddressInfoStep.js.map +1 -1
  24. package/lib/module/steps/DocumentsOcrStep.js +37 -31
  25. package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
  26. package/lib/module/steps/EconomicActivityStep.js +54 -53
  27. package/lib/module/steps/EconomicActivityStep.js.map +1 -1
  28. package/lib/module/ui/ScreenScaffold.js +94 -0
  29. package/lib/module/ui/ScreenScaffold.js.map +1 -0
  30. package/lib/module/ui/StepShell.js +24 -43
  31. package/lib/module/ui/StepShell.js.map +1 -1
  32. package/lib/module/ui/VelionOnboardingScreen.js +13 -10
  33. package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
  34. package/lib/module/ui/forms/index.js +1 -0
  35. package/lib/module/ui/forms/index.js.map +1 -1
  36. package/lib/module/ui/forms/useFieldChain.js +52 -0
  37. package/lib/module/ui/forms/useFieldChain.js.map +1 -0
  38. package/lib/module/ui/keyboard.js +143 -0
  39. package/lib/module/ui/keyboard.js.map +1 -0
  40. package/lib/module/ui/screenInsets.js +61 -0
  41. package/lib/module/ui/screenInsets.js.map +1 -0
  42. package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -1
  43. package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
  44. package/lib/typescript/steps/EconomicActivityStep.d.ts.map +1 -1
  45. package/lib/typescript/ui/ScreenScaffold.d.ts +57 -0
  46. package/lib/typescript/ui/ScreenScaffold.d.ts.map +1 -0
  47. package/lib/typescript/ui/StepShell.d.ts +1 -3
  48. package/lib/typescript/ui/StepShell.d.ts.map +1 -1
  49. package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
  50. package/lib/typescript/ui/forms/index.d.ts +1 -0
  51. package/lib/typescript/ui/forms/index.d.ts.map +1 -1
  52. package/lib/typescript/ui/forms/useFieldChain.d.ts +30 -0
  53. package/lib/typescript/ui/forms/useFieldChain.d.ts.map +1 -0
  54. package/lib/typescript/ui/keyboard.d.ts +69 -0
  55. package/lib/typescript/ui/keyboard.d.ts.map +1 -0
  56. package/lib/typescript/ui/screenInsets.d.ts +68 -0
  57. package/lib/typescript/ui/screenInsets.d.ts.map +1 -0
  58. package/package.json +5 -1
  59. package/src/steps/AddressInfoStep.tsx +37 -0
  60. package/src/steps/DocumentsOcrStep.tsx +50 -36
  61. package/src/steps/EconomicActivityStep.tsx +54 -44
  62. package/src/ui/ScreenScaffold.tsx +130 -0
  63. package/src/ui/StepShell.tsx +27 -56
  64. package/src/ui/VelionOnboardingScreen.tsx +16 -13
  65. package/src/ui/forms/index.ts +1 -0
  66. package/src/ui/forms/useFieldChain.ts +63 -0
  67. package/src/ui/keyboard.tsx +196 -0
  68. package/src/ui/screenInsets.ts +89 -0
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @fileoverview Chrome inset math for every full-screen surface (OSDKR-14).
3
+ *
4
+ * Pure functions, deliberately free of React and react-native imports so the
5
+ * geometry can be unit-tested. `ScreenScaffold` is the only component that
6
+ * should consume them directly — screens read the result off the scaffold.
7
+ *
8
+ * Two rules encoded here, both learned from real bugs:
9
+ *
10
+ * - **Floors.** `useSafeAreaInsets` degrades to zeros when the host strips
11
+ * `react-native-safe-area-context` or renders us outside a provider, and a
12
+ * device with no notch legitimately reports 0. A CTA flush against the
13
+ * screen edge is wrong in both cases, so every inset carries a minimum gap.
14
+ * - **The ProgressBar is chrome too.** It floats above the step content at the
15
+ * very top of the screen, so anything pinned to the top (a "back" control)
16
+ * must clear the status bar *and* the bar's own height, or the two overlap.
17
+ */
18
+
19
+ import type { EdgeInsets } from '../utils/useSafeAreaInsets';
20
+
21
+ /**
22
+ * Minimum breathing room between interactive chrome and the screen edge, used
23
+ * when the device (or a missing provider) reports a zero inset.
24
+ */
25
+ export const MIN_EDGE_GAP = 12;
26
+
27
+ export interface ScreenInsets {
28
+ /**
29
+ * Raw safe top inset — the status bar / notch / punch-hole. Deliberately
30
+ * *not* floored: the ProgressBar is painted flush under the status bar, and
31
+ * a floor would push it down on devices that legitimately report 0.
32
+ */
33
+ top: number;
34
+ /**
35
+ * Top inset for chrome pinned above the step content: the safe top (floored,
36
+ * because this chrome is interactive) plus the floating ProgressBar's
37
+ * height, so a "back" control never tucks under it.
38
+ */
39
+ topChrome: number;
40
+ /**
41
+ * Safe bottom inset, floored — clears the Android navigation bar (including
42
+ * the 3-button bar on edge-to-edge) and the iOS home indicator.
43
+ */
44
+ bottom: number;
45
+ left: number;
46
+ right: number;
47
+ }
48
+
49
+ /**
50
+ * Resolve the chrome insets for a full-screen surface.
51
+ *
52
+ * @param raw Device insets as reported by `react-native-safe-area-context`.
53
+ * @param progressBarHeight Height of the floating ProgressBar, or 0 when the
54
+ * flow hides it — `topChrome` collapses to `top` in that case.
55
+ */
56
+ export function computeScreenInsets(
57
+ raw: EdgeInsets,
58
+ progressBarHeight = 0,
59
+ ): ScreenInsets {
60
+ return {
61
+ top: Math.max(raw.top, 0),
62
+ topChrome: Math.max(raw.top, MIN_EDGE_GAP) + Math.max(progressBarHeight, 0),
63
+ bottom: Math.max(raw.bottom, MIN_EDGE_GAP),
64
+ left: Math.max(raw.left, 0),
65
+ right: Math.max(raw.right, 0),
66
+ };
67
+ }
68
+
69
+ /**
70
+ * Breathing room between a pinned CTA and whatever sits below it — the
71
+ * navigation bar, or the keyboard. Clearing the bar is not enough on its own:
72
+ * a button whose edge touches the system bar reads as clipped.
73
+ */
74
+ export const FOOTER_EDGE_GAP = 14;
75
+
76
+ /**
77
+ * Bottom padding for a strip pinned to the bottom of the screen (a CTA row).
78
+ *
79
+ * While the keyboard is up it must sit above the keyboard rather than the
80
+ * navigation bar — under Android edge-to-edge the window no longer shrinks, so
81
+ * the keyboard overlaps our layout and a plain safe-area inset would leave the
82
+ * CTA buried underneath it.
83
+ */
84
+ export function bottomChromeInset(
85
+ insets: ScreenInsets,
86
+ keyboardHeight: number,
87
+ ): number {
88
+ return Math.max(insets.bottom, keyboardHeight) + FOOTER_EDGE_GAP;
89
+ }