@rocapine/react-native-onboarding 1.20.0 → 1.23.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.
@@ -1,5 +1,11 @@
1
1
  import { z } from "zod";
2
- import { BaseStepTypeSchema } from "../common.types";
2
+ import {
3
+ BaseStepTypeSchema,
4
+ type LeafCondition,
5
+ type ConditionGroup,
6
+ LeafConditionSchema,
7
+ ConditionGroupSchema,
8
+ } from "../common.types";
3
9
  import { type StackElementProps, StackElementPropsSchema } from "./elements/StackElement";
4
10
  import { type TextElementProps, TextElementPropsSchema } from "./elements/TextElement";
5
11
  import { type ImageElementProps, ImageElementPropsSchema } from "./elements/ImageElement";
@@ -35,11 +41,22 @@ export type { CarouselElementProps } from "./elements/CarouselElement";
35
41
  export type { ZStackElementProps } from "./elements/ZStackElement";
36
42
  export type { SafeAreaViewElementProps, SafeAreaEdge, SafeAreaEdgeMode } from "./elements/SafeAreaViewElement";
37
43
 
44
+ /**
45
+ * Type tag for a ComposableScreen variable. Drives expression-mode coercion
46
+ * in `setVariable` action evaluation (int/float math vs string concat).
47
+ */
48
+ export type ComposableVariableKind = "int" | "float" | "string";
49
+
38
50
  /**
39
51
  * A variable entry stored in the ComposableScreen variables map.
40
- * `value` is the canonical value (string), `label` is an optional display label.
52
+ * `value` is the canonical value (always a string), `label` is an optional
53
+ * display label, `kind` optionally tags the underlying type.
41
54
  */
42
- export type ComposableVariableEntry = { value: string; label?: string };
55
+ export type ComposableVariableEntry = {
56
+ value: string;
57
+ label?: string;
58
+ kind?: ComposableVariableKind;
59
+ };
43
60
 
44
61
  // UIElement union — must live here (not in elements/) to avoid circular deps
45
62
  // because the Stack variant's children: UIElement[] references itself.
@@ -47,6 +64,7 @@ type UIElement =
47
64
  | {
48
65
  id: string;
49
66
  name?: string;
67
+ renderWhen?: LeafCondition | ConditionGroup;
50
68
  type: "YStack" | "XStack";
51
69
  props: StackElementProps;
52
70
  children: UIElement[];
@@ -54,72 +72,84 @@ type UIElement =
54
72
  | {
55
73
  id: string;
56
74
  name?: string;
75
+ renderWhen?: LeafCondition | ConditionGroup;
57
76
  type: "Text";
58
77
  props: TextElementProps;
59
78
  }
60
79
  | {
61
80
  id: string;
62
81
  name?: string;
82
+ renderWhen?: LeafCondition | ConditionGroup;
63
83
  type: "Image";
64
84
  props: ImageElementProps;
65
85
  }
66
86
  | {
67
87
  id: string;
68
88
  name?: string;
89
+ renderWhen?: LeafCondition | ConditionGroup;
69
90
  type: "Lottie";
70
91
  props: LottieElementProps;
71
92
  }
72
93
  | {
73
94
  id: string;
74
95
  name?: string;
96
+ renderWhen?: LeafCondition | ConditionGroup;
75
97
  type: "Rive";
76
98
  props: RiveElementProps;
77
99
  }
78
100
  | {
79
101
  id: string;
80
102
  name?: string;
103
+ renderWhen?: LeafCondition | ConditionGroup;
81
104
  type: "Icon";
82
105
  props: IconElementProps;
83
106
  }
84
107
  | {
85
108
  id: string;
86
109
  name?: string;
110
+ renderWhen?: LeafCondition | ConditionGroup;
87
111
  type: "Video";
88
112
  props: VideoElementProps;
89
113
  }
90
114
  | {
91
115
  id: string;
92
116
  name?: string;
117
+ renderWhen?: LeafCondition | ConditionGroup;
93
118
  type: "Input";
94
119
  props: InputElementProps;
95
120
  }
96
121
  | {
97
122
  id: string;
98
123
  name?: string;
124
+ renderWhen?: LeafCondition | ConditionGroup;
99
125
  type: "Button";
100
126
  props: ButtonElementProps;
101
127
  }
102
128
  | {
103
129
  id: string;
104
130
  name?: string;
131
+ renderWhen?: LeafCondition | ConditionGroup;
105
132
  type: "RadioGroup";
106
133
  props: RadioGroupElementProps;
107
134
  }
108
135
  | {
109
136
  id: string;
110
137
  name?: string;
138
+ renderWhen?: LeafCondition | ConditionGroup;
111
139
  type: "CheckboxGroup";
112
140
  props: CheckboxGroupElementProps;
113
141
  }
114
142
  | {
115
143
  id: string;
116
144
  name?: string;
145
+ renderWhen?: LeafCondition | ConditionGroup;
117
146
  type: "DatePicker";
118
147
  props: DatePickerElementProps;
119
148
  }
120
149
  | {
121
150
  id: string;
122
151
  name?: string;
152
+ renderWhen?: LeafCondition | ConditionGroup;
123
153
  type: "Carousel";
124
154
  props: CarouselElementProps;
125
155
  children: UIElement[];
@@ -127,6 +157,7 @@ type UIElement =
127
157
  | {
128
158
  id: string;
129
159
  name?: string;
160
+ renderWhen?: LeafCondition | ConditionGroup;
130
161
  type: "ZStack";
131
162
  props: ZStackElementProps;
132
163
  children: UIElement[];
@@ -134,6 +165,7 @@ type UIElement =
134
165
  | {
135
166
  id: string;
136
167
  name?: string;
168
+ renderWhen?: LeafCondition | ConditionGroup;
137
169
  type: "SafeAreaView";
138
170
  props: SafeAreaViewElementProps;
139
171
  children: UIElement[];
@@ -144,6 +176,7 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
144
176
  z.object({
145
177
  id: z.string(),
146
178
  name: z.string().optional(),
179
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
147
180
  type: z.union([z.literal("YStack"), z.literal("XStack")]),
148
181
  props: StackElementPropsSchema,
149
182
  children: z.array(UIElementSchema),
@@ -151,72 +184,84 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
151
184
  z.object({
152
185
  id: z.string(),
153
186
  name: z.string().optional(),
187
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
154
188
  type: z.literal("Text"),
155
189
  props: TextElementPropsSchema,
156
190
  }),
157
191
  z.object({
158
192
  id: z.string(),
159
193
  name: z.string().optional(),
194
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
160
195
  type: z.literal("Image"),
161
196
  props: ImageElementPropsSchema,
162
197
  }),
163
198
  z.object({
164
199
  id: z.string(),
165
200
  name: z.string().optional(),
201
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
166
202
  type: z.literal("Lottie"),
167
203
  props: LottieElementPropsSchema,
168
204
  }),
169
205
  z.object({
170
206
  id: z.string(),
171
207
  name: z.string().optional(),
208
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
172
209
  type: z.literal("Rive"),
173
210
  props: RiveElementPropsSchema,
174
211
  }),
175
212
  z.object({
176
213
  id: z.string(),
177
214
  name: z.string().optional(),
215
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
178
216
  type: z.literal("Icon"),
179
217
  props: IconElementPropsSchema,
180
218
  }),
181
219
  z.object({
182
220
  id: z.string(),
183
221
  name: z.string().optional(),
222
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
184
223
  type: z.literal("Video"),
185
224
  props: VideoElementPropsSchema,
186
225
  }),
187
226
  z.object({
188
227
  id: z.string(),
189
228
  name: z.string().optional(),
229
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
190
230
  type: z.literal("Input"),
191
231
  props: InputElementPropsSchema,
192
232
  }),
193
233
  z.object({
194
234
  id: z.string(),
195
235
  name: z.string().optional(),
236
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
196
237
  type: z.literal("Button"),
197
238
  props: ButtonElementPropsSchema,
198
239
  }),
199
240
  z.object({
200
241
  id: z.string(),
201
242
  name: z.string().optional(),
243
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
202
244
  type: z.literal("RadioGroup"),
203
245
  props: RadioGroupElementPropsSchema,
204
246
  }),
205
247
  z.object({
206
248
  id: z.string(),
207
249
  name: z.string().optional(),
250
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
208
251
  type: z.literal("CheckboxGroup"),
209
252
  props: CheckboxGroupElementPropsSchema,
210
253
  }),
211
254
  z.object({
212
255
  id: z.string(),
213
256
  name: z.string().optional(),
257
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
214
258
  type: z.literal("DatePicker"),
215
259
  props: DatePickerElementPropsSchema,
216
260
  }),
217
261
  z.object({
218
262
  id: z.string(),
219
263
  name: z.string().optional(),
264
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
220
265
  type: z.literal("Carousel"),
221
266
  props: CarouselElementPropsSchema,
222
267
  children: z.array(UIElementSchema),
@@ -224,6 +269,7 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
224
269
  z.object({
225
270
  id: z.string(),
226
271
  name: z.string().optional(),
272
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
227
273
  type: z.literal("ZStack"),
228
274
  props: ZStackElementPropsSchema,
229
275
  children: z.array(UIElementSchema),
@@ -231,6 +277,7 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
231
277
  z.object({
232
278
  id: z.string(),
233
279
  name: z.string().optional(),
280
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
234
281
  type: z.literal("SafeAreaView"),
235
282
  props: SafeAreaViewElementPropsSchema,
236
283
  children: z.array(UIElementSchema),