@rocapine/react-native-onboarding-ui 1.9.0 → 1.11.1

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 (85) hide show
  1. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +26 -4
  2. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
  3. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +11 -2
  4. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
  5. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +22 -10
  6. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
  7. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js +3 -3
  8. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js.map +1 -1
  9. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts +79 -0
  10. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts.map +1 -0
  11. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js +133 -0
  12. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js.map +1 -0
  13. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts +16 -3
  14. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
  15. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js +3 -2
  16. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -1
  17. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +81 -0
  18. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -0
  19. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js +121 -0
  20. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js.map +1 -0
  21. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +14 -2
  22. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -1
  23. package/dist/UI/Pages/ComposableScreen/elements/IconElement.js +12 -2
  24. package/dist/UI/Pages/ComposableScreen/elements/IconElement.js.map +1 -1
  25. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +15 -2
  26. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
  27. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js +15 -7
  28. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js.map +1 -1
  29. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +20 -2
  30. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -1
  31. package/dist/UI/Pages/ComposableScreen/elements/InputElement.js +17 -2
  32. package/dist/UI/Pages/ComposableScreen/elements/InputElement.js.map +1 -1
  33. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +15 -2
  34. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
  35. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js +12 -2
  36. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js.map +1 -1
  37. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +15 -2
  38. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
  39. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js +3 -2
  40. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js.map +1 -1
  41. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +17 -4
  42. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
  43. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.js +25 -14
  44. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.js.map +1 -1
  45. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +28 -47
  46. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -1
  47. package/dist/UI/Pages/ComposableScreen/elements/StackElement.js +30 -47
  48. package/dist/UI/Pages/ComposableScreen/elements/StackElement.js.map +1 -1
  49. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +35 -23
  50. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
  51. package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +35 -35
  52. package/dist/UI/Pages/ComposableScreen/elements/TextElement.js.map +1 -1
  53. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +15 -2
  54. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
  55. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js +12 -2
  56. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js.map +1 -1
  57. package/dist/UI/Pages/ComposableScreen/elements/renderElement.d.ts.map +1 -1
  58. package/dist/UI/Pages/ComposableScreen/elements/renderElement.js +8 -0
  59. package/dist/UI/Pages/ComposableScreen/elements/renderElement.js.map +1 -1
  60. package/dist/UI/Pages/ComposableScreen/elements/shared.d.ts +1 -0
  61. package/dist/UI/Pages/ComposableScreen/elements/shared.d.ts.map +1 -1
  62. package/dist/UI/Pages/ComposableScreen/elements/shared.js +4 -1
  63. package/dist/UI/Pages/ComposableScreen/elements/shared.js.map +1 -1
  64. package/dist/UI/Pages/ComposableScreen/types.d.ts +15 -0
  65. package/dist/UI/Pages/ComposableScreen/types.d.ts.map +1 -1
  66. package/dist/UI/Pages/ComposableScreen/types.js +15 -0
  67. package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
  68. package/package.json +11 -4
  69. package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +22 -4
  70. package/src/UI/Pages/ComposableScreen/elements/ButtonElement.tsx +3 -5
  71. package/src/UI/Pages/ComposableScreen/elements/CarouselElement.tsx +152 -0
  72. package/src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx +3 -3
  73. package/src/UI/Pages/ComposableScreen/elements/DatePickerElement.tsx +172 -0
  74. package/src/UI/Pages/ComposableScreen/elements/IconElement.tsx +12 -3
  75. package/src/UI/Pages/ComposableScreen/elements/ImageElement.tsx +16 -8
  76. package/src/UI/Pages/ComposableScreen/elements/InputElement.tsx +20 -3
  77. package/src/UI/Pages/ComposableScreen/elements/LottieElement.tsx +12 -3
  78. package/src/UI/Pages/ComposableScreen/elements/RadioGroupElement.tsx +3 -3
  79. package/src/UI/Pages/ComposableScreen/elements/RiveElement.tsx +26 -16
  80. package/src/UI/Pages/ComposableScreen/elements/StackElement.tsx +31 -70
  81. package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +36 -47
  82. package/src/UI/Pages/ComposableScreen/elements/VideoElement.tsx +12 -3
  83. package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +10 -0
  84. package/src/UI/Pages/ComposableScreen/elements/shared.ts +4 -0
  85. package/src/UI/Pages/ComposableScreen/types.ts +30 -0
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { z } from "zod";
3
3
  import { Text } from "react-native";
4
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
4
5
  import { UIElement } from "../types";
5
- import { RenderContext, interpolate } from "./shared";
6
+ import { RenderContext, interpolate, dim } from "./shared";
6
7
 
7
- export type TextElementProps = {
8
+ export type TextElementProps = BaseBoxProps & {
8
9
  content: string;
9
10
  mode?: "plain" | "expression";
10
11
  fontSize?: number;
@@ -14,20 +15,9 @@ export type TextElementProps = {
14
15
  textAlign?: "left" | "center" | "right";
15
16
  letterSpacing?: number;
16
17
  lineHeight?: number;
17
- backgroundColor?: string;
18
- padding?: number;
19
- paddingHorizontal?: number;
20
- paddingVertical?: number;
21
- margin?: number;
22
- marginHorizontal?: number;
23
- marginVertical?: number;
24
- borderWidth?: number;
25
- borderRadius?: number;
26
- borderColor?: string;
27
- opacity?: number;
28
18
  };
29
19
 
30
- export const TextElementPropsSchema = z.object({
20
+ export const TextElementPropsSchema = BaseBoxPropsSchema.extend({
31
21
  content: z.string(),
32
22
  mode: z.enum(["plain", "expression"]).optional(),
33
23
  fontSize: z.number().optional(),
@@ -37,17 +27,6 @@ export const TextElementPropsSchema = z.object({
37
27
  textAlign: z.enum(["left", "center", "right"]).optional(),
38
28
  letterSpacing: z.number().optional(),
39
29
  lineHeight: z.number().optional(),
40
- backgroundColor: z.string().optional(),
41
- padding: z.number().optional(),
42
- paddingHorizontal: z.number().optional(),
43
- paddingVertical: z.number().optional(),
44
- margin: z.number().optional(),
45
- marginHorizontal: z.number().optional(),
46
- marginVertical: z.number().optional(),
47
- borderWidth: z.number().optional(),
48
- borderRadius: z.number().optional(),
49
- borderColor: z.string().optional(),
50
- opacity: z.number().min(0).max(1).optional(),
51
30
  });
52
31
 
53
32
  type TextUIElement = Extract<UIElement, { type: "Text" }>;
@@ -60,33 +39,43 @@ type Props = {
60
39
 
61
40
  export const TextElementComponent = ({ element, ctx, parentType }: Props): React.ReactElement => {
62
41
  const { theme, variables } = ctx;
42
+ const p = element.props;
63
43
  const content =
64
- element.props.mode === "expression"
65
- ? interpolate(element.props.content, variables)
66
- : element.props.content;
44
+ p.mode === "expression"
45
+ ? interpolate(p.content, variables)
46
+ : p.content;
67
47
 
68
48
  return (
69
49
  <Text
70
50
  style={{
71
- fontSize: element.props.fontSize,
72
- fontWeight: element.props.fontWeight as any,
73
- fontFamily: element.props.fontFamily,
74
- color: element.props.color ?? theme.colors.text.primary,
75
- textAlign: element.props.textAlign,
76
- letterSpacing: element.props.letterSpacing,
77
- lineHeight: element.props.lineHeight,
78
- backgroundColor: element.props.backgroundColor,
79
- padding: element.props.padding,
80
- paddingHorizontal: element.props.paddingHorizontal,
81
- paddingVertical: element.props.paddingVertical,
82
- margin: element.props.margin,
83
- marginHorizontal: element.props.marginHorizontal,
84
- marginVertical: element.props.marginVertical,
85
- borderWidth: element.props.borderWidth,
86
- borderRadius: element.props.borderRadius,
87
- borderColor: element.props.borderColor,
88
- opacity: element.props.opacity,
89
- flexShrink: parentType === "XStack" ? 1 : undefined,
51
+ flex: p.flex,
52
+ flexShrink: p.flexShrink ?? (parentType === "XStack" ? 1 : undefined),
53
+ flexGrow: p.flexGrow,
54
+ alignSelf: p.alignSelf,
55
+ width: dim(p.width),
56
+ height: dim(p.height),
57
+ minWidth: p.minWidth,
58
+ maxWidth: p.maxWidth,
59
+ minHeight: p.minHeight,
60
+ maxHeight: p.maxHeight,
61
+ fontSize: p.fontSize,
62
+ fontWeight: p.fontWeight as any,
63
+ fontFamily: p.fontFamily,
64
+ color: p.color ?? theme.colors.text.primary,
65
+ textAlign: p.textAlign,
66
+ letterSpacing: p.letterSpacing,
67
+ lineHeight: p.lineHeight,
68
+ backgroundColor: p.backgroundColor,
69
+ padding: p.padding,
70
+ paddingHorizontal: p.paddingHorizontal,
71
+ paddingVertical: p.paddingVertical,
72
+ margin: p.margin,
73
+ marginHorizontal: p.marginHorizontal,
74
+ marginVertical: p.marginVertical,
75
+ borderWidth: p.borderWidth,
76
+ borderRadius: p.borderRadius,
77
+ borderColor: p.borderColor,
78
+ opacity: p.opacity,
90
79
  }}
91
80
  >
92
81
  {content}
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { View, Text, StyleSheet } from "react-native";
4
4
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
5
  import { UIElement } from "../types";
6
- import { RenderContext } from "./shared";
6
+ import { RenderContext, dim } from "./shared";
7
7
  import { getTextStyle } from "../../../Theme/helpers";
8
8
 
9
9
  export type VideoElementProps = BaseBoxProps & {
@@ -65,9 +65,18 @@ type Props = {
65
65
  export const VideoElementRenderer = ({ element, ctx }: Props): React.ReactElement => {
66
66
  const { theme } = ctx;
67
67
  const wrapperStyle = {
68
- width: element.props.width ?? ("100%" as `${number}%`),
69
- height: element.props.height ?? 200,
68
+ flex: element.props.flex,
69
+ flexShrink: element.props.flexShrink,
70
+ flexGrow: element.props.flexGrow,
71
+ alignSelf: element.props.alignSelf,
72
+ width: dim(element.props.width) ?? ("100%" as `${number}%`),
73
+ height: dim(element.props.height ?? 200),
74
+ minWidth: element.props.minWidth,
75
+ maxWidth: element.props.maxWidth,
76
+ minHeight: element.props.minHeight,
77
+ maxHeight: element.props.maxHeight,
70
78
  opacity: element.props.opacity,
79
+ backgroundColor: element.props.backgroundColor,
71
80
  margin: element.props.margin,
72
81
  marginHorizontal: element.props.marginHorizontal,
73
82
  marginVertical: element.props.marginVertical,
@@ -12,6 +12,8 @@ import { InputElementComponent } from "./InputElement";
12
12
  import { RadioGroupComponent } from "./RadioGroupElement";
13
13
  import { CheckboxGroupComponent } from "./CheckboxGroupElement";
14
14
  import { ButtonElementComponent } from "./ButtonElement";
15
+ import { DatePickerElementComponent } from "./DatePickerElement";
16
+ import { CarouselElementComponent } from "./CarouselElement";
15
17
 
16
18
  export const renderElement = (
17
19
  element: UIElement,
@@ -62,5 +64,13 @@ export const renderElement = (
62
64
  return <ButtonElementComponent key={element.id} element={element} ctx={ctx} />;
63
65
  }
64
66
 
67
+ if (element.type === "DatePicker") {
68
+ return <DatePickerElementComponent key={element.id} element={element} ctx={ctx} />;
69
+ }
70
+
71
+ if (element.type === "Carousel") {
72
+ return <CarouselElementComponent key={element.id} element={element} ctx={ctx} />;
73
+ }
74
+
65
75
  return null;
66
76
  };
@@ -13,3 +13,7 @@ export type RenderContext = {
13
13
 
14
14
  export const interpolate = (template: string, variables: Record<string, ComposableVariableEntry>): string =>
15
15
  template.replace(/\{\{([^}]+?)\}\}/g, (_, key) => variables[key]?.label ?? variables[key]?.value ?? "");
16
+
17
+ // Cast number | string dimension values to DimensionValue for React Native style props
18
+ export const dim = (v: number | string | undefined): import("react-native").DimensionValue | undefined =>
19
+ v as import("react-native").DimensionValue | undefined;
@@ -11,6 +11,8 @@ import { type InputElementProps, InputElementPropsSchema } from "./elements/Inpu
11
11
  import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/ButtonElement";
12
12
  import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
13
13
  import { type CheckboxGroupElementProps, CheckboxGroupElementPropsSchema } from "./elements/CheckboxGroupElement";
14
+ import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./elements/DatePickerElement";
15
+ import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
14
16
 
15
17
  export type { BaseBoxProps } from "./elements/BaseBoxProps";
16
18
  export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
@@ -25,6 +27,8 @@ export type { InputElementProps } from "./elements/InputElement";
25
27
  export type { ButtonElementProps } from "./elements/ButtonElement";
26
28
  export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
27
29
  export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
30
+ export type { DatePickerElementProps } from "./elements/DatePickerElement";
31
+ export type { CarouselElementProps } from "./elements/CarouselElement";
28
32
 
29
33
  // UIElement union — must live here (not in elements/) to avoid circular deps
30
34
  // because the Stack variant's children: UIElement[] references itself.
@@ -95,6 +99,19 @@ export type UIElement =
95
99
  name?: string;
96
100
  type: "CheckboxGroup";
97
101
  props: CheckboxGroupElementProps;
102
+ }
103
+ | {
104
+ id: string;
105
+ name?: string;
106
+ type: "DatePicker";
107
+ props: DatePickerElementProps;
108
+ }
109
+ | {
110
+ id: string;
111
+ name?: string;
112
+ type: "Carousel";
113
+ props: CarouselElementProps;
114
+ children: UIElement[];
98
115
  };
99
116
 
100
117
  export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
@@ -166,6 +183,19 @@ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
166
183
  type: z.literal("CheckboxGroup"),
167
184
  props: CheckboxGroupElementPropsSchema,
168
185
  }),
186
+ z.object({
187
+ id: z.string(),
188
+ name: z.string().optional(),
189
+ type: z.literal("DatePicker"),
190
+ props: DatePickerElementPropsSchema,
191
+ }),
192
+ z.object({
193
+ id: z.string(),
194
+ name: z.string().optional(),
195
+ type: z.literal("Carousel"),
196
+ props: CarouselElementPropsSchema,
197
+ children: z.array(UIElementSchema),
198
+ }),
169
199
  ])
170
200
  );
171
201