@rocapine/react-native-onboarding 1.22.0 → 1.24.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.
- package/dist/onboarding-example.d.ts +577 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +93 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +21 -0
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +10 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +294 -2
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js +14 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/IconElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/StackElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts +8 -0
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +17 -1
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.js +15 -0
- package/dist/steps/ComposableScreen/types.js.map +1 -1
- package/package.json +1 -1
- package/src/onboarding-example.ts +93 -0
- package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +20 -0
- package/src/steps/ComposableScreen/elements/ButtonElement.ts +36 -2
- package/src/steps/ComposableScreen/types.ts +37 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/steps/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/steps/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,kDAMyB;AACzB,0DAA0F;AAC1F,wDAAuF;AACvF,0DAA0F;AAC1F,4DAA6F;AAC7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EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,kCAAmB,EAAE,mCAAoB,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC3E,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,KAAK,EAAE,wCAAwB;QAC/B,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,eAAe,CAAC;KACnC,CAAC;IACF,OAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,kCAAmB,EAAE,mCAAoB,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC3E,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/B,KAAK,EAAE,oDAA8B;QACrC,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,eAAe,CAAC;KACnC,CAAC;CACH,CAAC,CACH,CAAC;AAEW,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,eAAe,CAAC;CACnC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,iCAAkB,CAAC,MAAM,CAAC;IACtE,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACnC,OAAO,EAAE,yCAAiC;CAC3C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocapine/react-native-onboarding",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Headless React Native SDK for Rocapine Onboarding Studio - Data fetching, state management, and hooks",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -274,6 +274,22 @@ export const onboardingExample = {
|
|
|
274
274
|
marginVertical: 4,
|
|
275
275
|
},
|
|
276
276
|
},
|
|
277
|
+
{
|
|
278
|
+
id: "lifetime-badge",
|
|
279
|
+
renderWhen: {
|
|
280
|
+
variable: "plan",
|
|
281
|
+
operator: "eq",
|
|
282
|
+
value: "lifetime",
|
|
283
|
+
},
|
|
284
|
+
type: "Text",
|
|
285
|
+
props: {
|
|
286
|
+
content: "🎉 Best value — lifetime access!",
|
|
287
|
+
fontSize: 14,
|
|
288
|
+
fontWeight: "600",
|
|
289
|
+
textAlign: "center",
|
|
290
|
+
marginVertical: 4,
|
|
291
|
+
},
|
|
292
|
+
},
|
|
277
293
|
{
|
|
278
294
|
id: "hero-checkbox",
|
|
279
295
|
type: "CheckboxGroup",
|
|
@@ -529,6 +545,67 @@ export const onboardingExample = {
|
|
|
529
545
|
},
|
|
530
546
|
},
|
|
531
547
|
},
|
|
548
|
+
{
|
|
549
|
+
id: "states-heading",
|
|
550
|
+
type: "Text",
|
|
551
|
+
props: {
|
|
552
|
+
content: "Button states & shadow",
|
|
553
|
+
fontSize: 13,
|
|
554
|
+
fontWeight: "700",
|
|
555
|
+
marginVertical: 4,
|
|
556
|
+
opacity: 0.5,
|
|
557
|
+
},
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: "btn-shadow",
|
|
561
|
+
type: "Button",
|
|
562
|
+
props: {
|
|
563
|
+
label: "Elevated (shadow)",
|
|
564
|
+
variant: "filled",
|
|
565
|
+
marginVertical: 4,
|
|
566
|
+
backgroundColor: "#6C63FF",
|
|
567
|
+
shadowColor: "#6C63FF",
|
|
568
|
+
shadowOffset: { width: 0, height: 6 },
|
|
569
|
+
shadowOpacity: 0.4,
|
|
570
|
+
shadowRadius: 12,
|
|
571
|
+
elevation: 8,
|
|
572
|
+
},
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
id: "btn-pressed",
|
|
576
|
+
type: "Button",
|
|
577
|
+
props: {
|
|
578
|
+
label: "Press me (hold)",
|
|
579
|
+
variant: "filled",
|
|
580
|
+
marginVertical: 4,
|
|
581
|
+
backgroundColor: "#10b981",
|
|
582
|
+
transitionDurationMs: 300,
|
|
583
|
+
pressedStyle: {
|
|
584
|
+
opacity: 0.6,
|
|
585
|
+
backgroundColor: "#065f46",
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
id: "btn-disabled",
|
|
591
|
+
type: "Button",
|
|
592
|
+
props: {
|
|
593
|
+
label: "Always disabled",
|
|
594
|
+
variant: "filled",
|
|
595
|
+
marginVertical: 4,
|
|
596
|
+
actions: ["continue"],
|
|
597
|
+
disabledWhen: {
|
|
598
|
+
variable: "never_enabled",
|
|
599
|
+
operator: "neq",
|
|
600
|
+
value: "yes",
|
|
601
|
+
},
|
|
602
|
+
disabledStyle: {
|
|
603
|
+
backgroundColor: "#fee2e2",
|
|
604
|
+
color: "#b91c1c",
|
|
605
|
+
borderRadius: 12,
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
},
|
|
532
609
|
{
|
|
533
610
|
id: "consent-toggle",
|
|
534
611
|
type: "Button",
|
|
@@ -554,6 +631,22 @@ export const onboardingExample = {
|
|
|
554
631
|
operator: "neq",
|
|
555
632
|
value: "yes",
|
|
556
633
|
},
|
|
634
|
+
transitionDurationMs: 180,
|
|
635
|
+
shadowColor: "#000",
|
|
636
|
+
shadowOffset: { width: 0, height: 4 },
|
|
637
|
+
shadowOpacity: 0.18,
|
|
638
|
+
shadowRadius: 8,
|
|
639
|
+
elevation: 4,
|
|
640
|
+
pressedStyle: {
|
|
641
|
+
opacity: 0.7,
|
|
642
|
+
backgroundColor: "#4f46e5",
|
|
643
|
+
},
|
|
644
|
+
disabledStyle: {
|
|
645
|
+
backgroundColor: "#d1d5db",
|
|
646
|
+
color: "#6b7280",
|
|
647
|
+
shadowOpacity: 0,
|
|
648
|
+
elevation: 0,
|
|
649
|
+
},
|
|
557
650
|
},
|
|
558
651
|
},
|
|
559
652
|
],
|
|
@@ -40,6 +40,16 @@ export const GradientBackgroundSchema = z.discriminatedUnion("type", [
|
|
|
40
40
|
}),
|
|
41
41
|
]);
|
|
42
42
|
|
|
43
|
+
export type ShadowOffset = {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const ShadowOffsetSchema = z.object({
|
|
49
|
+
width: z.number(),
|
|
50
|
+
height: z.number(),
|
|
51
|
+
});
|
|
52
|
+
|
|
43
53
|
export type BaseBoxProps = {
|
|
44
54
|
width?: number | string;
|
|
45
55
|
height?: number | string;
|
|
@@ -64,6 +74,11 @@ export type BaseBoxProps = {
|
|
|
64
74
|
borderWidth?: number;
|
|
65
75
|
borderRadius?: number;
|
|
66
76
|
borderColor?: string;
|
|
77
|
+
shadowColor?: string;
|
|
78
|
+
shadowOffset?: ShadowOffset;
|
|
79
|
+
shadowOpacity?: number;
|
|
80
|
+
shadowRadius?: number;
|
|
81
|
+
elevation?: number;
|
|
67
82
|
};
|
|
68
83
|
|
|
69
84
|
export const BaseBoxPropsSchema = z.object({
|
|
@@ -90,4 +105,9 @@ export const BaseBoxPropsSchema = z.object({
|
|
|
90
105
|
borderWidth: z.number().min(0).optional(),
|
|
91
106
|
borderRadius: z.number().min(0).optional(),
|
|
92
107
|
borderColor: z.string().optional(),
|
|
108
|
+
shadowColor: z.string().optional(),
|
|
109
|
+
shadowOffset: ShadowOffsetSchema.optional(),
|
|
110
|
+
shadowOpacity: z.number().min(0).max(1).optional(),
|
|
111
|
+
shadowRadius: z.number().min(0).optional(),
|
|
112
|
+
elevation: z.number().min(0).optional(),
|
|
93
113
|
});
|
|
@@ -26,6 +26,20 @@ export const ButtonActionSchema = z.union([
|
|
|
26
26
|
CustomButtonActionSchema,
|
|
27
27
|
]);
|
|
28
28
|
|
|
29
|
+
type ButtonOverridableProps = BaseBoxProps & {
|
|
30
|
+
variant?: "filled" | "outlined" | "ghost";
|
|
31
|
+
backgroundColor?: string;
|
|
32
|
+
color?: string;
|
|
33
|
+
fontSize?: number;
|
|
34
|
+
fontWeight?: string;
|
|
35
|
+
fontFamily?: string | "inherit";
|
|
36
|
+
fontStyle?: "normal" | "italic";
|
|
37
|
+
textAlign?: "left" | "center" | "right";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Subset of ButtonElementProps that can be overridden per-state. */
|
|
41
|
+
export type ButtonStyleOverride = Partial<ButtonOverridableProps>;
|
|
42
|
+
|
|
29
43
|
export type ButtonElementProps = BaseBoxProps & {
|
|
30
44
|
label: string;
|
|
31
45
|
/**
|
|
@@ -56,12 +70,29 @@ export type ButtonElementProps = BaseBoxProps & {
|
|
|
56
70
|
* the same condition schema as `Branch.condition`.
|
|
57
71
|
*/
|
|
58
72
|
disabledWhen?: LeafCondition | ConditionGroup;
|
|
59
|
-
/**
|
|
73
|
+
/** @deprecated Use `disabledStyle.backgroundColor`. Falls back when `disabledStyle` omitted. */
|
|
60
74
|
disabledBackgroundColor?: string;
|
|
61
|
-
/**
|
|
75
|
+
/** @deprecated Use `disabledStyle.color`. Falls back when `disabledStyle` omitted. */
|
|
62
76
|
disabledColor?: string;
|
|
77
|
+
/** Style overrides merged on top of base props while pressed. */
|
|
78
|
+
pressedStyle?: ButtonStyleOverride;
|
|
79
|
+
/** Style overrides merged on top of base props while disabled. Wins over deprecated `disabled*` fields. */
|
|
80
|
+
disabledStyle?: ButtonStyleOverride;
|
|
81
|
+
/** Animation duration (ms) between rest/pressed/disabled. Default 150. */
|
|
82
|
+
transitionDurationMs?: number;
|
|
63
83
|
};
|
|
64
84
|
|
|
85
|
+
export const ButtonStyleOverrideSchema = BaseBoxPropsSchema.extend({
|
|
86
|
+
variant: z.enum(["filled", "outlined", "ghost"]).optional(),
|
|
87
|
+
backgroundColor: z.string().optional(),
|
|
88
|
+
color: z.string().optional(),
|
|
89
|
+
fontSize: z.number().optional(),
|
|
90
|
+
fontWeight: z.string().optional(),
|
|
91
|
+
fontFamily: z.string().optional(),
|
|
92
|
+
fontStyle: z.enum(["normal", "italic"]).optional(),
|
|
93
|
+
textAlign: z.enum(["left", "center", "right"]).optional(),
|
|
94
|
+
}).partial();
|
|
95
|
+
|
|
65
96
|
export const ButtonElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
66
97
|
label: z.string().min(1, "label must not be empty"),
|
|
67
98
|
actions: z.array(ButtonActionSchema).optional(),
|
|
@@ -77,4 +108,7 @@ export const ButtonElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
|
77
108
|
disabledWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
78
109
|
disabledBackgroundColor: z.string().optional(),
|
|
79
110
|
disabledColor: z.string().optional(),
|
|
111
|
+
pressedStyle: ButtonStyleOverrideSchema.optional(),
|
|
112
|
+
disabledStyle: ButtonStyleOverrideSchema.optional(),
|
|
113
|
+
transitionDurationMs: z.number().min(0).optional(),
|
|
80
114
|
});
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
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";
|
|
@@ -58,6 +64,7 @@ type UIElement =
|
|
|
58
64
|
| {
|
|
59
65
|
id: string;
|
|
60
66
|
name?: string;
|
|
67
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
61
68
|
type: "YStack" | "XStack";
|
|
62
69
|
props: StackElementProps;
|
|
63
70
|
children: UIElement[];
|
|
@@ -65,72 +72,84 @@ type UIElement =
|
|
|
65
72
|
| {
|
|
66
73
|
id: string;
|
|
67
74
|
name?: string;
|
|
75
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
68
76
|
type: "Text";
|
|
69
77
|
props: TextElementProps;
|
|
70
78
|
}
|
|
71
79
|
| {
|
|
72
80
|
id: string;
|
|
73
81
|
name?: string;
|
|
82
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
74
83
|
type: "Image";
|
|
75
84
|
props: ImageElementProps;
|
|
76
85
|
}
|
|
77
86
|
| {
|
|
78
87
|
id: string;
|
|
79
88
|
name?: string;
|
|
89
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
80
90
|
type: "Lottie";
|
|
81
91
|
props: LottieElementProps;
|
|
82
92
|
}
|
|
83
93
|
| {
|
|
84
94
|
id: string;
|
|
85
95
|
name?: string;
|
|
96
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
86
97
|
type: "Rive";
|
|
87
98
|
props: RiveElementProps;
|
|
88
99
|
}
|
|
89
100
|
| {
|
|
90
101
|
id: string;
|
|
91
102
|
name?: string;
|
|
103
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
92
104
|
type: "Icon";
|
|
93
105
|
props: IconElementProps;
|
|
94
106
|
}
|
|
95
107
|
| {
|
|
96
108
|
id: string;
|
|
97
109
|
name?: string;
|
|
110
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
98
111
|
type: "Video";
|
|
99
112
|
props: VideoElementProps;
|
|
100
113
|
}
|
|
101
114
|
| {
|
|
102
115
|
id: string;
|
|
103
116
|
name?: string;
|
|
117
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
104
118
|
type: "Input";
|
|
105
119
|
props: InputElementProps;
|
|
106
120
|
}
|
|
107
121
|
| {
|
|
108
122
|
id: string;
|
|
109
123
|
name?: string;
|
|
124
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
110
125
|
type: "Button";
|
|
111
126
|
props: ButtonElementProps;
|
|
112
127
|
}
|
|
113
128
|
| {
|
|
114
129
|
id: string;
|
|
115
130
|
name?: string;
|
|
131
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
116
132
|
type: "RadioGroup";
|
|
117
133
|
props: RadioGroupElementProps;
|
|
118
134
|
}
|
|
119
135
|
| {
|
|
120
136
|
id: string;
|
|
121
137
|
name?: string;
|
|
138
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
122
139
|
type: "CheckboxGroup";
|
|
123
140
|
props: CheckboxGroupElementProps;
|
|
124
141
|
}
|
|
125
142
|
| {
|
|
126
143
|
id: string;
|
|
127
144
|
name?: string;
|
|
145
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
128
146
|
type: "DatePicker";
|
|
129
147
|
props: DatePickerElementProps;
|
|
130
148
|
}
|
|
131
149
|
| {
|
|
132
150
|
id: string;
|
|
133
151
|
name?: string;
|
|
152
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
134
153
|
type: "Carousel";
|
|
135
154
|
props: CarouselElementProps;
|
|
136
155
|
children: UIElement[];
|
|
@@ -138,6 +157,7 @@ type UIElement =
|
|
|
138
157
|
| {
|
|
139
158
|
id: string;
|
|
140
159
|
name?: string;
|
|
160
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
141
161
|
type: "ZStack";
|
|
142
162
|
props: ZStackElementProps;
|
|
143
163
|
children: UIElement[];
|
|
@@ -145,6 +165,7 @@ type UIElement =
|
|
|
145
165
|
| {
|
|
146
166
|
id: string;
|
|
147
167
|
name?: string;
|
|
168
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
148
169
|
type: "SafeAreaView";
|
|
149
170
|
props: SafeAreaViewElementProps;
|
|
150
171
|
children: UIElement[];
|
|
@@ -155,6 +176,7 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
155
176
|
z.object({
|
|
156
177
|
id: z.string(),
|
|
157
178
|
name: z.string().optional(),
|
|
179
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
158
180
|
type: z.union([z.literal("YStack"), z.literal("XStack")]),
|
|
159
181
|
props: StackElementPropsSchema,
|
|
160
182
|
children: z.array(UIElementSchema),
|
|
@@ -162,72 +184,84 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
162
184
|
z.object({
|
|
163
185
|
id: z.string(),
|
|
164
186
|
name: z.string().optional(),
|
|
187
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
165
188
|
type: z.literal("Text"),
|
|
166
189
|
props: TextElementPropsSchema,
|
|
167
190
|
}),
|
|
168
191
|
z.object({
|
|
169
192
|
id: z.string(),
|
|
170
193
|
name: z.string().optional(),
|
|
194
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
171
195
|
type: z.literal("Image"),
|
|
172
196
|
props: ImageElementPropsSchema,
|
|
173
197
|
}),
|
|
174
198
|
z.object({
|
|
175
199
|
id: z.string(),
|
|
176
200
|
name: z.string().optional(),
|
|
201
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
177
202
|
type: z.literal("Lottie"),
|
|
178
203
|
props: LottieElementPropsSchema,
|
|
179
204
|
}),
|
|
180
205
|
z.object({
|
|
181
206
|
id: z.string(),
|
|
182
207
|
name: z.string().optional(),
|
|
208
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
183
209
|
type: z.literal("Rive"),
|
|
184
210
|
props: RiveElementPropsSchema,
|
|
185
211
|
}),
|
|
186
212
|
z.object({
|
|
187
213
|
id: z.string(),
|
|
188
214
|
name: z.string().optional(),
|
|
215
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
189
216
|
type: z.literal("Icon"),
|
|
190
217
|
props: IconElementPropsSchema,
|
|
191
218
|
}),
|
|
192
219
|
z.object({
|
|
193
220
|
id: z.string(),
|
|
194
221
|
name: z.string().optional(),
|
|
222
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
195
223
|
type: z.literal("Video"),
|
|
196
224
|
props: VideoElementPropsSchema,
|
|
197
225
|
}),
|
|
198
226
|
z.object({
|
|
199
227
|
id: z.string(),
|
|
200
228
|
name: z.string().optional(),
|
|
229
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
201
230
|
type: z.literal("Input"),
|
|
202
231
|
props: InputElementPropsSchema,
|
|
203
232
|
}),
|
|
204
233
|
z.object({
|
|
205
234
|
id: z.string(),
|
|
206
235
|
name: z.string().optional(),
|
|
236
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
207
237
|
type: z.literal("Button"),
|
|
208
238
|
props: ButtonElementPropsSchema,
|
|
209
239
|
}),
|
|
210
240
|
z.object({
|
|
211
241
|
id: z.string(),
|
|
212
242
|
name: z.string().optional(),
|
|
243
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
213
244
|
type: z.literal("RadioGroup"),
|
|
214
245
|
props: RadioGroupElementPropsSchema,
|
|
215
246
|
}),
|
|
216
247
|
z.object({
|
|
217
248
|
id: z.string(),
|
|
218
249
|
name: z.string().optional(),
|
|
250
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
219
251
|
type: z.literal("CheckboxGroup"),
|
|
220
252
|
props: CheckboxGroupElementPropsSchema,
|
|
221
253
|
}),
|
|
222
254
|
z.object({
|
|
223
255
|
id: z.string(),
|
|
224
256
|
name: z.string().optional(),
|
|
257
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
225
258
|
type: z.literal("DatePicker"),
|
|
226
259
|
props: DatePickerElementPropsSchema,
|
|
227
260
|
}),
|
|
228
261
|
z.object({
|
|
229
262
|
id: z.string(),
|
|
230
263
|
name: z.string().optional(),
|
|
264
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
231
265
|
type: z.literal("Carousel"),
|
|
232
266
|
props: CarouselElementPropsSchema,
|
|
233
267
|
children: z.array(UIElementSchema),
|
|
@@ -235,6 +269,7 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
235
269
|
z.object({
|
|
236
270
|
id: z.string(),
|
|
237
271
|
name: z.string().optional(),
|
|
272
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
238
273
|
type: z.literal("ZStack"),
|
|
239
274
|
props: ZStackElementPropsSchema,
|
|
240
275
|
children: z.array(UIElementSchema),
|
|
@@ -242,6 +277,7 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
242
277
|
z.object({
|
|
243
278
|
id: z.string(),
|
|
244
279
|
name: z.string().optional(),
|
|
280
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
245
281
|
type: z.literal("SafeAreaView"),
|
|
246
282
|
props: SafeAreaViewElementPropsSchema,
|
|
247
283
|
children: z.array(UIElementSchema),
|