@rocapine/react-native-onboarding 1.7.0 → 1.8.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 (66) hide show
  1. package/dist/onboarding-example.d.ts +162 -0
  2. package/dist/onboarding-example.d.ts.map +1 -1
  3. package/dist/onboarding-example.js +36 -0
  4. package/dist/onboarding-example.js.map +1 -1
  5. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +39 -0
  6. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -0
  7. package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +20 -0
  8. package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +1 -0
  9. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +55 -0
  10. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -0
  11. package/dist/steps/ComposableScreen/elements/ButtonElement.js +18 -0
  12. package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +1 -0
  13. package/dist/steps/ComposableScreen/elements/IconElement.d.ts +37 -0
  14. package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +1 -0
  15. package/dist/steps/ComposableScreen/elements/IconElement.js +13 -0
  16. package/dist/steps/ComposableScreen/elements/IconElement.js.map +1 -0
  17. package/dist/steps/ComposableScreen/elements/ImageElement.d.ts +38 -0
  18. package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +1 -0
  19. package/dist/steps/ComposableScreen/elements/ImageElement.js +11 -0
  20. package/dist/steps/ComposableScreen/elements/ImageElement.js.map +1 -0
  21. package/dist/steps/ComposableScreen/elements/InputElement.d.ts +98 -0
  22. package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +1 -0
  23. package/dist/steps/ComposableScreen/elements/InputElement.js +25 -0
  24. package/dist/steps/ComposableScreen/elements/InputElement.js.map +1 -0
  25. package/dist/steps/ComposableScreen/elements/LottieElement.d.ts +35 -0
  26. package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +1 -0
  27. package/dist/steps/ComposableScreen/elements/LottieElement.js +12 -0
  28. package/dist/steps/ComposableScreen/elements/LottieElement.js.map +1 -0
  29. package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts +74 -0
  30. package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -0
  31. package/dist/steps/ComposableScreen/elements/RadioGroupElement.js +36 -0
  32. package/dist/steps/ComposableScreen/elements/RadioGroupElement.js.map +1 -0
  33. package/dist/steps/ComposableScreen/elements/RiveElement.d.ts +58 -0
  34. package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +1 -0
  35. package/dist/steps/ComposableScreen/elements/RiveElement.js +14 -0
  36. package/dist/steps/ComposableScreen/elements/RiveElement.js.map +1 -0
  37. package/dist/steps/ComposableScreen/elements/StackElement.d.ts +81 -0
  38. package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +1 -0
  39. package/dist/steps/ComposableScreen/elements/StackElement.js +32 -0
  40. package/dist/steps/ComposableScreen/elements/StackElement.js.map +1 -0
  41. package/dist/steps/ComposableScreen/elements/TextElement.d.ts +53 -0
  42. package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +1 -0
  43. package/dist/steps/ComposableScreen/elements/TextElement.js +27 -0
  44. package/dist/steps/ComposableScreen/elements/TextElement.js.map +1 -0
  45. package/dist/steps/ComposableScreen/elements/VideoElement.d.ts +37 -0
  46. package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +1 -0
  47. package/dist/steps/ComposableScreen/elements/VideoElement.js +13 -0
  48. package/dist/steps/ComposableScreen/elements/VideoElement.js.map +1 -0
  49. package/dist/steps/ComposableScreen/types.d.ts +40 -114
  50. package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
  51. package/dist/steps/ComposableScreen/types.js +33 -122
  52. package/dist/steps/ComposableScreen/types.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/onboarding-example.ts +36 -0
  55. package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +33 -0
  56. package/src/steps/ComposableScreen/elements/ButtonElement.ts +28 -0
  57. package/src/steps/ComposableScreen/elements/IconElement.ts +18 -0
  58. package/src/steps/ComposableScreen/elements/ImageElement.ts +14 -0
  59. package/src/steps/ComposableScreen/elements/InputElement.ts +42 -0
  60. package/src/steps/ComposableScreen/elements/LottieElement.ts +16 -0
  61. package/src/steps/ComposableScreen/elements/RadioGroupElement.ts +55 -0
  62. package/src/steps/ComposableScreen/elements/RiveElement.ts +20 -0
  63. package/src/steps/ComposableScreen/elements/StackElement.ts +57 -0
  64. package/src/steps/ComposableScreen/elements/TextElement.ts +47 -0
  65. package/src/steps/ComposableScreen/elements/VideoElement.ts +18 -0
  66. package/src/steps/ComposableScreen/types.ts +56 -235
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type IconElementProps = BaseBoxProps & {
5
+ name: string;
6
+ size?: number;
7
+ color?: string;
8
+ strokeWidth?: number;
9
+ backgroundColor?: string;
10
+ };
11
+
12
+ export const IconElementPropsSchema = BaseBoxPropsSchema.extend({
13
+ name: z.string().min(1, "icon name must not be empty"),
14
+ size: z.number().nonnegative().optional(),
15
+ color: z.string().optional(),
16
+ strokeWidth: z.number().nonnegative().optional(),
17
+ backgroundColor: z.string().optional(),
18
+ });
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type ImageElementProps = BaseBoxProps & {
5
+ url: string;
6
+ aspectRatio?: number;
7
+ resizeMode?: "cover" | "contain" | "stretch" | "center";
8
+ };
9
+
10
+ export const ImageElementPropsSchema = BaseBoxPropsSchema.extend({
11
+ url: z.string().min(1, "url must not be empty"),
12
+ aspectRatio: z.number().optional(),
13
+ resizeMode: z.enum(["cover", "contain", "stretch", "center"]).optional(),
14
+ });
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type InputElementProps = BaseBoxProps & {
5
+ variableName?: string;
6
+ placeholder?: string;
7
+ defaultValue?: string;
8
+ keyboardType?: "default" | "email-address" | "numeric" | "phone-pad" | "decimal-pad" | "url" | "number-pad" | "ascii-capable" | "numbers-and-punctuation" | "name-phone-pad" | "twitter" | "web-search" | "visible-password";
9
+ returnKeyType?: "done" | "next" | "go" | "search" | "send" | "default" | "emergency-call" | "google" | "join" | "route" | "yahoo" | "none" | "previous";
10
+ autoCapitalize?: "none" | "sentences" | "words" | "characters";
11
+ secureTextEntry?: boolean;
12
+ maxLength?: number;
13
+ multiline?: boolean;
14
+ numberOfLines?: number;
15
+ editable?: boolean;
16
+ color?: string;
17
+ backgroundColor?: string;
18
+ fontSize?: number;
19
+ fontWeight?: string;
20
+ textAlign?: "left" | "center" | "right";
21
+ placeholderColor?: string;
22
+ };
23
+
24
+ export const InputElementPropsSchema = BaseBoxPropsSchema.extend({
25
+ variableName: z.string().min(1).optional(),
26
+ placeholder: z.string().optional(),
27
+ defaultValue: z.string().optional(),
28
+ keyboardType: z.enum(["default", "email-address", "numeric", "phone-pad", "decimal-pad", "url", "number-pad", "ascii-capable", "numbers-and-punctuation", "name-phone-pad", "twitter", "web-search", "visible-password"]).optional(),
29
+ returnKeyType: z.enum(["done", "next", "go", "search", "send", "default", "emergency-call", "google", "join", "route", "yahoo", "none", "previous"]).optional(),
30
+ autoCapitalize: z.enum(["none", "sentences", "words", "characters"]).optional(),
31
+ secureTextEntry: z.boolean().optional(),
32
+ maxLength: z.number().int().nonnegative().optional(),
33
+ multiline: z.boolean().optional(),
34
+ numberOfLines: z.number().int().nonnegative().optional(),
35
+ editable: z.boolean().optional(),
36
+ color: z.string().optional(),
37
+ backgroundColor: z.string().optional(),
38
+ fontSize: z.number().optional(),
39
+ fontWeight: z.string().optional(),
40
+ textAlign: z.enum(["left", "center", "right"]).optional(),
41
+ placeholderColor: z.string().optional(),
42
+ });
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type LottieElementProps = BaseBoxProps & {
5
+ source: string;
6
+ autoPlay?: boolean;
7
+ loop?: boolean;
8
+ speed?: number;
9
+ };
10
+
11
+ export const LottieElementPropsSchema = BaseBoxPropsSchema.extend({
12
+ source: z.string().min(1, "source must not be empty"),
13
+ autoPlay: z.boolean().optional(),
14
+ loop: z.boolean().optional(),
15
+ speed: z.number().optional(),
16
+ });
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type RadioGroupElementProps = BaseBoxProps & {
5
+ variableName?: string;
6
+ defaultValue?: string;
7
+ gap?: number;
8
+ direction?: "vertical" | "horizontal";
9
+ items: Array<{ label: string; value: string }>;
10
+ itemBackgroundColor?: string;
11
+ itemSelectedBackgroundColor?: string;
12
+ itemBorderColor?: string;
13
+ itemSelectedBorderColor?: string;
14
+ itemBorderRadius?: number;
15
+ itemBorderWidth?: number;
16
+ itemColor?: string;
17
+ itemSelectedColor?: string;
18
+ itemFontSize?: number;
19
+ itemFontWeight?: string;
20
+ itemFontFamily?: string;
21
+ itemPadding?: number;
22
+ itemPaddingHorizontal?: number;
23
+ itemPaddingVertical?: number;
24
+ };
25
+
26
+ export const RadioGroupElementPropsSchema = BaseBoxPropsSchema.extend({
27
+ variableName: z.string().optional(),
28
+ defaultValue: z.string().optional(),
29
+ gap: z.number().optional(),
30
+ direction: z.enum(["vertical", "horizontal"]).optional(),
31
+ items: z.array(z.object({ label: z.string().trim().min(1, "item label must not be empty"), value: z.string().trim().min(1, "item value must not be empty") })).min(1, "items must not be empty"),
32
+ itemBackgroundColor: z.string().optional(),
33
+ itemSelectedBackgroundColor: z.string().optional(),
34
+ itemBorderColor: z.string().optional(),
35
+ itemSelectedBorderColor: z.string().optional(),
36
+ itemBorderRadius: z.number().optional(),
37
+ itemBorderWidth: z.number().optional(),
38
+ itemColor: z.string().optional(),
39
+ itemSelectedColor: z.string().optional(),
40
+ itemFontSize: z.number().optional(),
41
+ itemFontWeight: z.string().optional(),
42
+ itemFontFamily: z.string().optional(),
43
+ itemPadding: z.number().optional(),
44
+ itemPaddingHorizontal: z.number().optional(),
45
+ itemPaddingVertical: z.number().optional(),
46
+ }).superRefine((data, ctx) => {
47
+ const values = data.items.map((i) => i.value);
48
+ const unique = new Set(values);
49
+ if (unique.size !== values.length) {
50
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "item values must be unique", path: ["items"] });
51
+ }
52
+ if (data.defaultValue !== undefined && !unique.has(data.defaultValue)) {
53
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "defaultValue must match one of the item values", path: ["defaultValue"] });
54
+ }
55
+ });
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type RiveElementProps = BaseBoxProps & {
5
+ url: string;
6
+ autoplay?: boolean;
7
+ fit?: "Contain" | "Cover" | "Fill" | "FitWidth" | "FitHeight" | "None" | "ScaleDown" | "Layout";
8
+ alignment?: "TopLeft" | "TopCenter" | "TopRight" | "CenterLeft" | "Center" | "CenterRight" | "BottomLeft" | "BottomCenter" | "BottomRight";
9
+ artboardName?: string;
10
+ stateMachineName?: string;
11
+ };
12
+
13
+ export const RiveElementPropsSchema = BaseBoxPropsSchema.extend({
14
+ url: z.string().min(1, "url must not be empty"),
15
+ autoplay: z.boolean().optional(),
16
+ fit: z.enum(["Contain", "Cover", "Fill", "FitWidth", "FitHeight", "None", "ScaleDown", "Layout"]).optional(),
17
+ alignment: z.enum(["TopLeft", "TopCenter", "TopRight", "CenterLeft", "Center", "CenterRight", "BottomLeft", "BottomCenter", "BottomRight"]).optional(),
18
+ artboardName: z.string().optional(),
19
+ stateMachineName: z.string().optional(),
20
+ });
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+
3
+ export type StackElementProps = {
4
+ gap?: number;
5
+ padding?: number;
6
+ paddingHorizontal?: number;
7
+ paddingVertical?: number;
8
+ margin?: number;
9
+ marginHorizontal?: number;
10
+ marginVertical?: number;
11
+ flex?: number;
12
+ width?: number;
13
+ height?: number;
14
+ minWidth?: number;
15
+ maxWidth?: number;
16
+ minHeight?: number;
17
+ maxHeight?: number;
18
+ alignItems?: "flex-start" | "center" | "flex-end" | "stretch";
19
+ alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
20
+ justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
21
+ backgroundColor?: string;
22
+ flexWrap?: "wrap" | "nowrap";
23
+ flexShrink?: number;
24
+ borderWidth?: number;
25
+ borderRadius?: number;
26
+ borderColor?: string;
27
+ overflow?: "hidden" | "visible" | "scroll";
28
+ opacity?: number;
29
+ };
30
+
31
+ export const StackElementPropsSchema = z.object({
32
+ gap: z.number().optional(),
33
+ padding: z.number().optional(),
34
+ paddingHorizontal: z.number().optional(),
35
+ paddingVertical: z.number().optional(),
36
+ margin: z.number().optional(),
37
+ marginHorizontal: z.number().optional(),
38
+ marginVertical: z.number().optional(),
39
+ flex: z.number().optional(),
40
+ width: z.number().optional(),
41
+ height: z.number().optional(),
42
+ minWidth: z.number().optional(),
43
+ maxWidth: z.number().optional(),
44
+ minHeight: z.number().optional(),
45
+ maxHeight: z.number().optional(),
46
+ alignItems: z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
47
+ alignSelf: z.enum(["auto", "flex-start", "flex-end", "center", "stretch", "baseline"]).optional(),
48
+ justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
49
+ backgroundColor: z.string().optional(),
50
+ flexWrap: z.enum(["wrap", "nowrap"]).optional(),
51
+ flexShrink: z.number().optional(),
52
+ borderWidth: z.number().optional(),
53
+ borderRadius: z.number().optional(),
54
+ borderColor: z.string().optional(),
55
+ overflow: z.enum(["hidden", "visible", "scroll"]).optional(),
56
+ opacity: z.number().min(0).max(1).optional(),
57
+ });
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+
3
+ export type TextElementProps = {
4
+ content: string;
5
+ mode?: "plain" | "expression";
6
+ fontSize?: number;
7
+ fontWeight?: string;
8
+ fontFamily?: string;
9
+ color?: string;
10
+ textAlign?: "left" | "center" | "right";
11
+ letterSpacing?: number;
12
+ lineHeight?: number;
13
+ backgroundColor?: string;
14
+ padding?: number;
15
+ paddingHorizontal?: number;
16
+ paddingVertical?: number;
17
+ margin?: number;
18
+ marginHorizontal?: number;
19
+ marginVertical?: number;
20
+ borderWidth?: number;
21
+ borderRadius?: number;
22
+ borderColor?: string;
23
+ opacity?: number;
24
+ };
25
+
26
+ export const TextElementPropsSchema = z.object({
27
+ content: z.string(),
28
+ mode: z.enum(["plain", "expression"]).optional(),
29
+ fontSize: z.number().optional(),
30
+ fontWeight: z.string().optional(),
31
+ fontFamily: z.string().optional(),
32
+ color: z.string().optional(),
33
+ textAlign: z.enum(["left", "center", "right"]).optional(),
34
+ letterSpacing: z.number().optional(),
35
+ lineHeight: z.number().optional(),
36
+ backgroundColor: z.string().optional(),
37
+ padding: z.number().optional(),
38
+ paddingHorizontal: z.number().optional(),
39
+ paddingVertical: z.number().optional(),
40
+ margin: z.number().optional(),
41
+ marginHorizontal: z.number().optional(),
42
+ marginVertical: z.number().optional(),
43
+ borderWidth: z.number().optional(),
44
+ borderRadius: z.number().optional(),
45
+ borderColor: z.string().optional(),
46
+ opacity: z.number().min(0).max(1).optional(),
47
+ });
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
3
+
4
+ export type VideoElementProps = BaseBoxProps & {
5
+ url: string;
6
+ autoPlay?: boolean;
7
+ loop?: boolean;
8
+ muted?: boolean;
9
+ controls?: boolean;
10
+ };
11
+
12
+ export const VideoElementPropsSchema = BaseBoxPropsSchema.extend({
13
+ url: z.string().min(1, "url must not be empty"),
14
+ autoPlay: z.boolean().optional(),
15
+ loop: z.boolean().optional(),
16
+ muted: z.boolean().optional(),
17
+ controls: z.boolean().optional(),
18
+ });
@@ -1,285 +1,94 @@
1
1
  import { z } from "zod";
2
2
  import { CustomPayloadSchema } from "../common.types";
3
+ import { type StackElementProps, StackElementPropsSchema } from "./elements/StackElement";
4
+ import { type TextElementProps, TextElementPropsSchema } from "./elements/TextElement";
5
+ import { type ImageElementProps, ImageElementPropsSchema } from "./elements/ImageElement";
6
+ import { type LottieElementProps, LottieElementPropsSchema } from "./elements/LottieElement";
7
+ import { type RiveElementProps, RiveElementPropsSchema } from "./elements/RiveElement";
8
+ import { type IconElementProps, IconElementPropsSchema } from "./elements/IconElement";
9
+ import { type VideoElementProps, VideoElementPropsSchema } from "./elements/VideoElement";
10
+ import { type InputElementProps, InputElementPropsSchema } from "./elements/InputElement";
11
+ import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/ButtonElement";
12
+ import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
3
13
 
4
- type BaseBoxProps = {
5
- width?: number;
6
- height?: number;
7
- opacity?: number;
8
- margin?: number;
9
- marginHorizontal?: number;
10
- marginVertical?: number;
11
- padding?: number;
12
- paddingHorizontal?: number;
13
- paddingVertical?: number;
14
- borderWidth?: number;
15
- borderRadius?: number;
16
- borderColor?: string;
17
- };
14
+ export type { BaseBoxProps } from "./elements/BaseBoxProps";
15
+ export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
16
+ export type { StackElementProps } from "./elements/StackElement";
17
+ export type { TextElementProps } from "./elements/TextElement";
18
+ export type { ImageElementProps } from "./elements/ImageElement";
19
+ export type { LottieElementProps } from "./elements/LottieElement";
20
+ export type { RiveElementProps } from "./elements/RiveElement";
21
+ export type { IconElementProps } from "./elements/IconElement";
22
+ export type { VideoElementProps } from "./elements/VideoElement";
23
+ export type { InputElementProps } from "./elements/InputElement";
24
+ export type { ButtonElementProps } from "./elements/ButtonElement";
25
+ export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
18
26
 
27
+ // UIElement union — must live here (not in elements/) to avoid circular deps
28
+ // because the Stack variant's children: UIElement[] references itself.
19
29
  type UIElement =
20
30
  | {
21
31
  id: string;
22
32
  name?: string;
23
33
  type: "YStack" | "XStack";
24
- props: {
25
- gap?: number;
26
- padding?: number;
27
- paddingHorizontal?: number;
28
- paddingVertical?: number;
29
- margin?: number;
30
- marginHorizontal?: number;
31
- marginVertical?: number;
32
- flex?: number;
33
- width?: number;
34
- height?: number;
35
- minWidth?: number;
36
- maxWidth?: number;
37
- minHeight?: number;
38
- maxHeight?: number;
39
- alignItems?: "flex-start" | "center" | "flex-end" | "stretch";
40
- justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
41
- backgroundColor?: string;
42
- flexWrap?: "wrap" | "nowrap";
43
- flexShrink?: number;
44
- borderWidth?: number;
45
- borderRadius?: number;
46
- borderColor?: string;
47
- overflow?: "hidden" | "visible" | "scroll";
48
- opacity?: number;
49
- };
34
+ props: StackElementProps;
50
35
  children: UIElement[];
51
36
  }
52
37
  | {
53
38
  id: string;
54
39
  name?: string;
55
40
  type: "Text";
56
- props: {
57
- content: string;
58
- mode?: "plain" | "expression";
59
- fontSize?: number;
60
- fontWeight?: string;
61
- fontFamily?: string;
62
- color?: string;
63
- textAlign?: "left" | "center" | "right";
64
- letterSpacing?: number;
65
- lineHeight?: number;
66
- backgroundColor?: string;
67
- padding?: number;
68
- paddingHorizontal?: number;
69
- paddingVertical?: number;
70
- margin?: number;
71
- marginHorizontal?: number;
72
- marginVertical?: number;
73
- borderWidth?: number;
74
- borderRadius?: number;
75
- borderColor?: string;
76
- opacity?: number;
77
- };
41
+ props: TextElementProps;
78
42
  }
79
43
  | {
80
44
  id: string;
81
45
  name?: string;
82
46
  type: "Image";
83
- props: BaseBoxProps & {
84
- url: string;
85
- aspectRatio?: number;
86
- resizeMode?: "cover" | "contain" | "stretch" | "center";
87
- };
47
+ props: ImageElementProps;
88
48
  }
89
49
  | {
90
50
  id: string;
91
51
  name?: string;
92
52
  type: "Lottie";
93
- props: BaseBoxProps & {
94
- source: string;
95
- autoPlay?: boolean;
96
- loop?: boolean;
97
- speed?: number;
98
- };
53
+ props: LottieElementProps;
99
54
  }
100
55
  | {
101
56
  id: string;
102
57
  name?: string;
103
58
  type: "Rive";
104
- props: BaseBoxProps & {
105
- url: string;
106
- autoplay?: boolean;
107
- fit?: "Contain" | "Cover" | "Fill" | "FitWidth" | "FitHeight" | "None" | "ScaleDown" | "Layout";
108
- alignment?: "TopLeft" | "TopCenter" | "TopRight" | "CenterLeft" | "Center" | "CenterRight" | "BottomLeft" | "BottomCenter" | "BottomRight";
109
- artboardName?: string;
110
- stateMachineName?: string;
111
- };
59
+ props: RiveElementProps;
112
60
  }
113
61
  | {
114
62
  id: string;
115
63
  name?: string;
116
64
  type: "Icon";
117
- props: BaseBoxProps & {
118
- name: string;
119
- size?: number;
120
- color?: string;
121
- strokeWidth?: number;
122
- };
65
+ props: IconElementProps;
123
66
  }
124
67
  | {
125
68
  id: string;
126
69
  name?: string;
127
70
  type: "Video";
128
- props: BaseBoxProps & {
129
- url: string;
130
- autoPlay?: boolean;
131
- loop?: boolean;
132
- muted?: boolean;
133
- controls?: boolean;
134
- };
71
+ props: VideoElementProps;
135
72
  }
136
73
  | {
137
74
  id: string;
138
75
  name?: string;
139
76
  type: "Input";
140
- props: BaseBoxProps & {
141
- variableName?: string;
142
- placeholder?: string;
143
- defaultValue?: string;
144
- keyboardType?: "default" | "email-address" | "numeric" | "phone-pad" | "decimal-pad" | "url" | "number-pad" | "ascii-capable" | "numbers-and-punctuation" | "name-phone-pad" | "twitter" | "web-search" | "visible-password";
145
- returnKeyType?: "done" | "next" | "go" | "search" | "send" | "default" | "emergency-call" | "google" | "join" | "route" | "yahoo" | "none" | "previous";
146
- autoCapitalize?: "none" | "sentences" | "words" | "characters";
147
- secureTextEntry?: boolean;
148
- maxLength?: number;
149
- multiline?: boolean;
150
- numberOfLines?: number;
151
- editable?: boolean;
152
- color?: string;
153
- backgroundColor?: string;
154
- fontSize?: number;
155
- fontWeight?: string;
156
- textAlign?: "left" | "center" | "right";
157
- placeholderColor?: string;
158
- };
77
+ props: InputElementProps;
78
+ }
79
+ | {
80
+ id: string;
81
+ name?: string;
82
+ type: "Button";
83
+ props: ButtonElementProps;
84
+ }
85
+ | {
86
+ id: string;
87
+ name?: string;
88
+ type: "RadioGroup";
89
+ props: RadioGroupElementProps;
159
90
  };
160
91
 
161
- const BaseBoxPropsSchema = z.object({
162
- width: z.number().optional(),
163
- height: z.number().optional(),
164
- opacity: z.number().min(0).max(1).optional(),
165
- margin: z.number().optional(),
166
- marginHorizontal: z.number().optional(),
167
- marginVertical: z.number().optional(),
168
- padding: z.number().optional(),
169
- paddingHorizontal: z.number().optional(),
170
- paddingVertical: z.number().optional(),
171
- borderWidth: z.number().optional(),
172
- borderRadius: z.number().optional(),
173
- borderColor: z.string().optional(),
174
- });
175
-
176
- const StackElementPropsSchema = z.object({
177
- gap: z.number().optional(),
178
- padding: z.number().optional(),
179
- paddingHorizontal: z.number().optional(),
180
- paddingVertical: z.number().optional(),
181
- margin: z.number().optional(),
182
- marginHorizontal: z.number().optional(),
183
- marginVertical: z.number().optional(),
184
- flex: z.number().optional(),
185
- width: z.number().optional(),
186
- height: z.number().optional(),
187
- minWidth: z.number().optional(),
188
- maxWidth: z.number().optional(),
189
- minHeight: z.number().optional(),
190
- maxHeight: z.number().optional(),
191
- alignItems: z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
192
- justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
193
- backgroundColor: z.string().optional(),
194
- flexWrap: z.enum(["wrap", "nowrap"]).optional(),
195
- flexShrink: z.number().optional(),
196
- borderWidth: z.number().optional(),
197
- borderRadius: z.number().optional(),
198
- borderColor: z.string().optional(),
199
- overflow: z.enum(["hidden", "visible", "scroll"]).optional(),
200
- opacity: z.number().min(0).max(1).optional(),
201
- });
202
-
203
- const TextElementPropsSchema = z.object({
204
- content: z.string(),
205
- mode: z.enum(["plain", "expression"]).optional(),
206
- fontSize: z.number().optional(),
207
- fontWeight: z.string().optional(),
208
- fontFamily: z.string().optional(),
209
- color: z.string().optional(),
210
- textAlign: z.enum(["left", "center", "right"]).optional(),
211
- letterSpacing: z.number().optional(),
212
- lineHeight: z.number().optional(),
213
- backgroundColor: z.string().optional(),
214
- padding: z.number().optional(),
215
- paddingHorizontal: z.number().optional(),
216
- paddingVertical: z.number().optional(),
217
- margin: z.number().optional(),
218
- marginHorizontal: z.number().optional(),
219
- marginVertical: z.number().optional(),
220
- borderWidth: z.number().optional(),
221
- borderRadius: z.number().optional(),
222
- borderColor: z.string().optional(),
223
- opacity: z.number().min(0).max(1).optional(),
224
- });
225
-
226
- const ImageElementPropsSchema = BaseBoxPropsSchema.extend({
227
- url: z.string(),
228
- aspectRatio: z.number().optional(),
229
- resizeMode: z.enum(["cover", "contain", "stretch", "center"]).optional(),
230
- });
231
-
232
- const LottieElementPropsSchema = BaseBoxPropsSchema.extend({
233
- source: z.string(),
234
- autoPlay: z.boolean().optional(),
235
- loop: z.boolean().optional(),
236
- speed: z.number().optional(),
237
- });
238
-
239
- const RiveElementPropsSchema = BaseBoxPropsSchema.extend({
240
- url: z.string(),
241
- autoplay: z.boolean().optional(),
242
- fit: z.enum(["Contain", "Cover", "Fill", "FitWidth", "FitHeight", "None", "ScaleDown", "Layout"]).optional(),
243
- alignment: z.enum(["TopLeft", "TopCenter", "TopRight", "CenterLeft", "Center", "CenterRight", "BottomLeft", "BottomCenter", "BottomRight"]).optional(),
244
- artboardName: z.string().optional(),
245
- stateMachineName: z.string().optional(),
246
- });
247
-
248
- const IconElementPropsSchema = BaseBoxPropsSchema.extend({
249
- name: z.string(),
250
- size: z.number().optional(),
251
- color: z.string().optional(),
252
- strokeWidth: z.number().optional(),
253
- });
254
-
255
- const VideoElementPropsSchema = BaseBoxPropsSchema.extend({
256
- url: z.string(),
257
- autoPlay: z.boolean().optional(),
258
- loop: z.boolean().optional(),
259
- muted: z.boolean().optional(),
260
- controls: z.boolean().optional(),
261
- });
262
-
263
- const InputElementPropsSchema = BaseBoxPropsSchema.extend({
264
- variableName: z.string().optional(),
265
- placeholder: z.string().optional(),
266
- defaultValue: z.string().optional(),
267
- keyboardType: z.enum(["default", "email-address", "numeric", "phone-pad", "decimal-pad", "url", "number-pad", "ascii-capable", "numbers-and-punctuation", "name-phone-pad", "twitter", "web-search", "visible-password"]).optional(),
268
- returnKeyType: z.enum(["done", "next", "go", "search", "send", "default", "emergency-call", "google", "join", "route", "yahoo", "none", "previous"]).optional(),
269
- autoCapitalize: z.enum(["none", "sentences", "words", "characters"]).optional(),
270
- secureTextEntry: z.boolean().optional(),
271
- maxLength: z.number().int().nonnegative().optional(),
272
- multiline: z.boolean().optional(),
273
- numberOfLines: z.number().int().nonnegative().optional(),
274
- editable: z.boolean().optional(),
275
- color: z.string().optional(),
276
- backgroundColor: z.string().optional(),
277
- fontSize: z.number().optional(),
278
- fontWeight: z.string().optional(),
279
- textAlign: z.enum(["left", "center", "right"]).optional(),
280
- placeholderColor: z.string().optional(),
281
- });
282
-
283
92
  const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
284
93
  z.union([
285
94
  z.object({
@@ -331,6 +140,18 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
331
140
  type: z.literal("Input"),
332
141
  props: InputElementPropsSchema,
333
142
  }),
143
+ z.object({
144
+ id: z.string(),
145
+ name: z.string().optional(),
146
+ type: z.literal("Button"),
147
+ props: ButtonElementPropsSchema,
148
+ }),
149
+ z.object({
150
+ id: z.string(),
151
+ name: z.string().optional(),
152
+ type: z.literal("RadioGroup"),
153
+ props: RadioGroupElementPropsSchema,
154
+ }),
334
155
  ])
335
156
  );
336
157