@rocapine/react-native-onboarding-ui 1.23.0 → 1.25.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 (66) hide show
  1. package/dist/UI/Pages/ComposableScreen/Renderer.d.ts.map +1 -1
  2. package/dist/UI/Pages/ComposableScreen/Renderer.js +4 -1
  3. package/dist/UI/Pages/ComposableScreen/Renderer.js.map +1 -1
  4. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +21 -0
  5. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
  6. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +10 -1
  7. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
  8. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +289 -4
  9. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
  10. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js +98 -57
  11. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js.map +1 -1
  12. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts +8 -0
  13. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
  14. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts +8 -0
  15. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
  16. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +8 -0
  17. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
  18. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +8 -0
  19. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -1
  20. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +8 -0
  21. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
  22. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +8 -0
  23. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -1
  24. package/dist/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts +98 -0
  25. package/dist/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +1 -0
  26. package/dist/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.js +51 -0
  27. package/dist/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.js.map +1 -0
  28. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +8 -0
  29. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
  30. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +8 -0
  31. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
  32. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +8 -0
  33. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
  34. package/dist/UI/Pages/ComposableScreen/elements/SafeAreaViewElement.d.ts +8 -0
  35. package/dist/UI/Pages/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +1 -1
  36. package/dist/UI/Pages/ComposableScreen/elements/ScrollViewElement.d.ts +120 -0
  37. package/dist/UI/Pages/ComposableScreen/elements/ScrollViewElement.d.ts.map +1 -0
  38. package/dist/UI/Pages/ComposableScreen/elements/ScrollViewElement.js +67 -0
  39. package/dist/UI/Pages/ComposableScreen/elements/ScrollViewElement.js.map +1 -0
  40. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +8 -0
  41. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -1
  42. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +8 -0
  43. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
  44. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +8 -0
  45. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
  46. package/dist/UI/Pages/ComposableScreen/elements/ZStackElement.d.ts +8 -0
  47. package/dist/UI/Pages/ComposableScreen/elements/ZStackElement.d.ts.map +1 -1
  48. package/dist/UI/Pages/ComposableScreen/elements/collectDefaults.d.ts.map +1 -1
  49. package/dist/UI/Pages/ComposableScreen/elements/collectDefaults.js +2 -0
  50. package/dist/UI/Pages/ComposableScreen/elements/collectDefaults.js.map +1 -1
  51. package/dist/UI/Pages/ComposableScreen/elements/renderElement.d.ts.map +1 -1
  52. package/dist/UI/Pages/ComposableScreen/elements/renderElement.js +8 -0
  53. package/dist/UI/Pages/ComposableScreen/elements/renderElement.js.map +1 -1
  54. package/dist/UI/Pages/ComposableScreen/types.d.ts +18 -0
  55. package/dist/UI/Pages/ComposableScreen/types.d.ts.map +1 -1
  56. package/dist/UI/Pages/ComposableScreen/types.js +51 -1
  57. package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
  58. package/package.json +1 -1
  59. package/src/UI/Pages/ComposableScreen/Renderer.tsx +16 -8
  60. package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +20 -0
  61. package/src/UI/Pages/ComposableScreen/elements/ButtonElement.tsx +169 -69
  62. package/src/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.tsx +81 -0
  63. package/src/UI/Pages/ComposableScreen/elements/ScrollViewElement.tsx +115 -0
  64. package/src/UI/Pages/ComposableScreen/elements/collectDefaults.ts +2 -0
  65. package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +10 -0
  66. package/src/UI/Pages/ComposableScreen/types.ts +83 -3
@@ -21,6 +21,11 @@ import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./ele
21
21
  import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
22
22
  import { type ZStackElementProps, ZStackElementPropsSchema } from "./elements/ZStackElement";
23
23
  import { type SafeAreaViewElementProps, SafeAreaViewElementPropsSchema } from "./elements/SafeAreaViewElement";
24
+ import { type ScrollViewElementProps, ScrollViewElementPropsSchema } from "./elements/ScrollViewElement";
25
+ import {
26
+ type KeyboardAvoidingViewElementProps,
27
+ KeyboardAvoidingViewElementPropsSchema,
28
+ } from "./elements/KeyboardAvoidingViewElement";
24
29
 
25
30
  export type { BaseBoxProps } from "./elements/BaseBoxProps";
26
31
  export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
@@ -39,6 +44,11 @@ export type { DatePickerElementProps } from "./elements/DatePickerElement";
39
44
  export type { CarouselElementProps } from "./elements/CarouselElement";
40
45
  export type { ZStackElementProps } from "./elements/ZStackElement";
41
46
  export type { SafeAreaViewElementProps, SafeAreaEdge, SafeAreaEdgeMode } from "./elements/SafeAreaViewElement";
47
+ export type { ScrollViewElementProps, ScrollViewContentInset } from "./elements/ScrollViewElement";
48
+ export type {
49
+ KeyboardAvoidingViewElementProps,
50
+ KeyboardAvoidingBehavior,
51
+ } from "./elements/KeyboardAvoidingViewElement";
42
52
 
43
53
  // UIElement union — must live here (not in elements/) to avoid circular deps
44
54
  // because the Stack variant's children: UIElement[] references itself.
@@ -151,6 +161,22 @@ export type UIElement =
151
161
  type: "SafeAreaView";
152
162
  props: SafeAreaViewElementProps;
153
163
  children: UIElement[];
164
+ }
165
+ | {
166
+ id: string;
167
+ name?: string;
168
+ renderWhen?: LeafCondition | ConditionGroup;
169
+ type: "ScrollView";
170
+ props: ScrollViewElementProps;
171
+ children: UIElement[];
172
+ }
173
+ | {
174
+ id: string;
175
+ name?: string;
176
+ renderWhen?: LeafCondition | ConditionGroup;
177
+ type: "KeyboardAvoidingView";
178
+ props: KeyboardAvoidingViewElementProps;
179
+ children: UIElement[];
154
180
  };
155
181
 
156
182
  export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
@@ -264,12 +290,66 @@ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
264
290
  props: SafeAreaViewElementPropsSchema,
265
291
  children: z.array(UIElementSchema),
266
292
  }),
293
+ z.object({
294
+ id: z.string(),
295
+ name: z.string().optional(),
296
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
297
+ type: z.literal("ScrollView"),
298
+ props: ScrollViewElementPropsSchema,
299
+ children: z.array(UIElementSchema),
300
+ }),
301
+ z.object({
302
+ id: z.string(),
303
+ name: z.string().optional(),
304
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
305
+ type: z.literal("KeyboardAvoidingView"),
306
+ props: KeyboardAvoidingViewElementPropsSchema,
307
+ children: z.array(UIElementSchema),
308
+ }),
267
309
  ])
268
310
  );
269
311
 
270
- export const ComposableScreenStepPayloadSchema = z.object({
271
- elements: z.array(UIElementSchema),
272
- });
312
+ // See packages/onboarding for the canonical comment; mirror nesting guard here because
313
+ // the UI re-parses the step with `ComposableScreenStepTypeSchema.parse(step)` in Renderer.tsx.
314
+ const collectNestedKeyboardAvoidingViews = (
315
+ nodes: UIElement[],
316
+ insideKav: boolean,
317
+ out: string[]
318
+ ): void => {
319
+ for (const node of nodes) {
320
+ if (node.type === "KeyboardAvoidingView") {
321
+ if (insideKav) out.push(node.id);
322
+ collectNestedKeyboardAvoidingViews(node.children, true, out);
323
+ continue;
324
+ }
325
+ if (
326
+ node.type === "YStack" ||
327
+ node.type === "XStack" ||
328
+ node.type === "ZStack" ||
329
+ node.type === "SafeAreaView" ||
330
+ node.type === "ScrollView" ||
331
+ node.type === "Carousel"
332
+ ) {
333
+ collectNestedKeyboardAvoidingViews(node.children, insideKav, out);
334
+ }
335
+ }
336
+ };
337
+
338
+ export const ComposableScreenStepPayloadSchema = z
339
+ .object({
340
+ elements: z.array(UIElementSchema),
341
+ })
342
+ .superRefine((payload, ctx) => {
343
+ const offenders: string[] = [];
344
+ collectNestedKeyboardAvoidingViews(payload.elements, false, offenders);
345
+ for (const id of offenders) {
346
+ ctx.addIssue({
347
+ code: z.ZodIssueCode.custom,
348
+ path: ["elements"],
349
+ message: `KeyboardAvoidingView (id="${id}") cannot be nested inside another KeyboardAvoidingView.`,
350
+ });
351
+ }
352
+ });
273
353
 
274
354
  export const ComposableScreenStepTypeSchema = z.object({
275
355
  id: z.string(),