@rocapine/react-native-onboarding 1.6.0 → 1.8.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/onboarding-example.d.ts +171 -0
  2. package/dist/onboarding-example.d.ts.map +1 -1
  3. package/dist/onboarding-example.js +37 -0
  4. package/dist/onboarding-example.js.map +1 -1
  5. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +30 -0
  6. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -0
  7. package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +19 -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 +29 -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 +30 -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 +90 -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 +27 -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 +66 -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 +50 -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 +72 -0
  38. package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +1 -0
  39. package/dist/steps/ComposableScreen/elements/StackElement.js +31 -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 +29 -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 -113
  50. package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
  51. package/dist/steps/ComposableScreen/types.js +33 -121
  52. package/dist/steps/ComposableScreen/types.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/onboarding-example.ts +37 -0
  55. package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +31 -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 +55 -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 -233
@@ -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,55 @@
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
+ justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
20
+ backgroundColor?: string;
21
+ flexWrap?: "wrap" | "nowrap";
22
+ flexShrink?: number;
23
+ borderWidth?: number;
24
+ borderRadius?: number;
25
+ borderColor?: string;
26
+ overflow?: "hidden" | "visible" | "scroll";
27
+ opacity?: number;
28
+ };
29
+
30
+ export const StackElementPropsSchema = z.object({
31
+ gap: z.number().optional(),
32
+ padding: z.number().optional(),
33
+ paddingHorizontal: z.number().optional(),
34
+ paddingVertical: z.number().optional(),
35
+ margin: z.number().optional(),
36
+ marginHorizontal: z.number().optional(),
37
+ marginVertical: z.number().optional(),
38
+ flex: z.number().optional(),
39
+ width: z.number().optional(),
40
+ height: z.number().optional(),
41
+ minWidth: z.number().optional(),
42
+ maxWidth: z.number().optional(),
43
+ minHeight: z.number().optional(),
44
+ maxHeight: z.number().optional(),
45
+ alignItems: z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
46
+ justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
47
+ backgroundColor: z.string().optional(),
48
+ flexWrap: z.enum(["wrap", "nowrap"]).optional(),
49
+ flexShrink: z.number().optional(),
50
+ borderWidth: z.number().optional(),
51
+ borderRadius: z.number().optional(),
52
+ borderColor: z.string().optional(),
53
+ overflow: z.enum(["hidden", "visible", "scroll"]).optional(),
54
+ opacity: z.number().min(0).max(1).optional(),
55
+ });
@@ -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,283 +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
- color?: string;
62
- textAlign?: "left" | "center" | "right";
63
- letterSpacing?: number;
64
- lineHeight?: number;
65
- backgroundColor?: string;
66
- padding?: number;
67
- paddingHorizontal?: number;
68
- paddingVertical?: number;
69
- margin?: number;
70
- marginHorizontal?: number;
71
- marginVertical?: number;
72
- borderWidth?: number;
73
- borderRadius?: number;
74
- borderColor?: string;
75
- opacity?: number;
76
- };
41
+ props: TextElementProps;
77
42
  }
78
43
  | {
79
44
  id: string;
80
45
  name?: string;
81
46
  type: "Image";
82
- props: BaseBoxProps & {
83
- url: string;
84
- aspectRatio?: number;
85
- resizeMode?: "cover" | "contain" | "stretch" | "center";
86
- };
47
+ props: ImageElementProps;
87
48
  }
88
49
  | {
89
50
  id: string;
90
51
  name?: string;
91
52
  type: "Lottie";
92
- props: BaseBoxProps & {
93
- source: string;
94
- autoPlay?: boolean;
95
- loop?: boolean;
96
- speed?: number;
97
- };
53
+ props: LottieElementProps;
98
54
  }
99
55
  | {
100
56
  id: string;
101
57
  name?: string;
102
58
  type: "Rive";
103
- props: BaseBoxProps & {
104
- url: string;
105
- autoplay?: boolean;
106
- fit?: "Contain" | "Cover" | "Fill" | "FitWidth" | "FitHeight" | "None" | "ScaleDown" | "Layout";
107
- alignment?: "TopLeft" | "TopCenter" | "TopRight" | "CenterLeft" | "Center" | "CenterRight" | "BottomLeft" | "BottomCenter" | "BottomRight";
108
- artboardName?: string;
109
- stateMachineName?: string;
110
- };
59
+ props: RiveElementProps;
111
60
  }
112
61
  | {
113
62
  id: string;
114
63
  name?: string;
115
64
  type: "Icon";
116
- props: BaseBoxProps & {
117
- name: string;
118
- size?: number;
119
- color?: string;
120
- strokeWidth?: number;
121
- };
65
+ props: IconElementProps;
122
66
  }
123
67
  | {
124
68
  id: string;
125
69
  name?: string;
126
70
  type: "Video";
127
- props: BaseBoxProps & {
128
- url: string;
129
- autoPlay?: boolean;
130
- loop?: boolean;
131
- muted?: boolean;
132
- controls?: boolean;
133
- };
71
+ props: VideoElementProps;
134
72
  }
135
73
  | {
136
74
  id: string;
137
75
  name?: string;
138
76
  type: "Input";
139
- props: BaseBoxProps & {
140
- variableName?: string;
141
- placeholder?: string;
142
- defaultValue?: string;
143
- 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";
144
- returnKeyType?: "done" | "next" | "go" | "search" | "send" | "default" | "emergency-call" | "google" | "join" | "route" | "yahoo" | "none" | "previous";
145
- autoCapitalize?: "none" | "sentences" | "words" | "characters";
146
- secureTextEntry?: boolean;
147
- maxLength?: number;
148
- multiline?: boolean;
149
- numberOfLines?: number;
150
- editable?: boolean;
151
- color?: string;
152
- backgroundColor?: string;
153
- fontSize?: number;
154
- fontWeight?: string;
155
- textAlign?: "left" | "center" | "right";
156
- placeholderColor?: string;
157
- };
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;
158
90
  };
159
91
 
160
- const BaseBoxPropsSchema = z.object({
161
- width: z.number().optional(),
162
- height: z.number().optional(),
163
- opacity: z.number().min(0).max(1).optional(),
164
- margin: z.number().optional(),
165
- marginHorizontal: z.number().optional(),
166
- marginVertical: z.number().optional(),
167
- padding: z.number().optional(),
168
- paddingHorizontal: z.number().optional(),
169
- paddingVertical: z.number().optional(),
170
- borderWidth: z.number().optional(),
171
- borderRadius: z.number().optional(),
172
- borderColor: z.string().optional(),
173
- });
174
-
175
- const StackElementPropsSchema = z.object({
176
- gap: z.number().optional(),
177
- padding: z.number().optional(),
178
- paddingHorizontal: z.number().optional(),
179
- paddingVertical: z.number().optional(),
180
- margin: z.number().optional(),
181
- marginHorizontal: z.number().optional(),
182
- marginVertical: z.number().optional(),
183
- flex: z.number().optional(),
184
- width: z.number().optional(),
185
- height: z.number().optional(),
186
- minWidth: z.number().optional(),
187
- maxWidth: z.number().optional(),
188
- minHeight: z.number().optional(),
189
- maxHeight: z.number().optional(),
190
- alignItems: z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
191
- justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
192
- backgroundColor: z.string().optional(),
193
- flexWrap: z.enum(["wrap", "nowrap"]).optional(),
194
- flexShrink: z.number().optional(),
195
- borderWidth: z.number().optional(),
196
- borderRadius: z.number().optional(),
197
- borderColor: z.string().optional(),
198
- overflow: z.enum(["hidden", "visible", "scroll"]).optional(),
199
- opacity: z.number().min(0).max(1).optional(),
200
- });
201
-
202
- const TextElementPropsSchema = z.object({
203
- content: z.string(),
204
- mode: z.enum(["plain", "expression"]).optional(),
205
- fontSize: z.number().optional(),
206
- fontWeight: z.string().optional(),
207
- color: z.string().optional(),
208
- textAlign: z.enum(["left", "center", "right"]).optional(),
209
- letterSpacing: z.number().optional(),
210
- lineHeight: z.number().optional(),
211
- backgroundColor: z.string().optional(),
212
- padding: z.number().optional(),
213
- paddingHorizontal: z.number().optional(),
214
- paddingVertical: z.number().optional(),
215
- margin: z.number().optional(),
216
- marginHorizontal: z.number().optional(),
217
- marginVertical: z.number().optional(),
218
- borderWidth: z.number().optional(),
219
- borderRadius: z.number().optional(),
220
- borderColor: z.string().optional(),
221
- opacity: z.number().min(0).max(1).optional(),
222
- });
223
-
224
- const ImageElementPropsSchema = BaseBoxPropsSchema.extend({
225
- url: z.string(),
226
- aspectRatio: z.number().optional(),
227
- resizeMode: z.enum(["cover", "contain", "stretch", "center"]).optional(),
228
- });
229
-
230
- const LottieElementPropsSchema = BaseBoxPropsSchema.extend({
231
- source: z.string(),
232
- autoPlay: z.boolean().optional(),
233
- loop: z.boolean().optional(),
234
- speed: z.number().optional(),
235
- });
236
-
237
- const RiveElementPropsSchema = BaseBoxPropsSchema.extend({
238
- url: z.string(),
239
- autoplay: z.boolean().optional(),
240
- fit: z.enum(["Contain", "Cover", "Fill", "FitWidth", "FitHeight", "None", "ScaleDown", "Layout"]).optional(),
241
- alignment: z.enum(["TopLeft", "TopCenter", "TopRight", "CenterLeft", "Center", "CenterRight", "BottomLeft", "BottomCenter", "BottomRight"]).optional(),
242
- artboardName: z.string().optional(),
243
- stateMachineName: z.string().optional(),
244
- });
245
-
246
- const IconElementPropsSchema = BaseBoxPropsSchema.extend({
247
- name: z.string(),
248
- size: z.number().optional(),
249
- color: z.string().optional(),
250
- strokeWidth: z.number().optional(),
251
- });
252
-
253
- const VideoElementPropsSchema = BaseBoxPropsSchema.extend({
254
- url: z.string(),
255
- autoPlay: z.boolean().optional(),
256
- loop: z.boolean().optional(),
257
- muted: z.boolean().optional(),
258
- controls: z.boolean().optional(),
259
- });
260
-
261
- const InputElementPropsSchema = BaseBoxPropsSchema.extend({
262
- variableName: z.string().optional(),
263
- placeholder: z.string().optional(),
264
- defaultValue: z.string().optional(),
265
- 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(),
266
- returnKeyType: z.enum(["done", "next", "go", "search", "send", "default", "emergency-call", "google", "join", "route", "yahoo", "none", "previous"]).optional(),
267
- autoCapitalize: z.enum(["none", "sentences", "words", "characters"]).optional(),
268
- secureTextEntry: z.boolean().optional(),
269
- maxLength: z.number().int().nonnegative().optional(),
270
- multiline: z.boolean().optional(),
271
- numberOfLines: z.number().int().nonnegative().optional(),
272
- editable: z.boolean().optional(),
273
- color: z.string().optional(),
274
- backgroundColor: z.string().optional(),
275
- fontSize: z.number().optional(),
276
- fontWeight: z.string().optional(),
277
- textAlign: z.enum(["left", "center", "right"]).optional(),
278
- placeholderColor: z.string().optional(),
279
- });
280
-
281
92
  const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
282
93
  z.union([
283
94
  z.object({
@@ -329,6 +140,18 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
329
140
  type: z.literal("Input"),
330
141
  props: InputElementPropsSchema,
331
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
+ }),
332
155
  ])
333
156
  );
334
157