@rocapine/react-native-onboarding-ui 1.10.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.
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +26 -4
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +11 -2
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +22 -10
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js +3 -3
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts +79 -0
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js +133 -0
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts +16 -3
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js +3 -2
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +16 -3
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js +3 -2
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +14 -2
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.js +12 -2
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +15 -2
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js +15 -7
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +20 -2
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.js +17 -2
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +15 -2
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js +12 -2
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +15 -2
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js +3 -2
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +17 -4
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.js +25 -14
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +28 -47
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.js +30 -47
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +35 -23
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +35 -35
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +15 -2
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js +12 -2
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.js +4 -0
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/shared.d.ts +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/shared.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/shared.js +4 -1
- package/dist/UI/Pages/ComposableScreen/elements/shared.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/types.d.ts +8 -0
- package/dist/UI/Pages/ComposableScreen/types.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/types.js +8 -0
- package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
- package/package.json +6 -4
- package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +22 -4
- package/src/UI/Pages/ComposableScreen/elements/ButtonElement.tsx +3 -5
- package/src/UI/Pages/ComposableScreen/elements/CarouselElement.tsx +152 -0
- package/src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx +3 -3
- package/src/UI/Pages/ComposableScreen/elements/DatePickerElement.tsx +3 -3
- package/src/UI/Pages/ComposableScreen/elements/IconElement.tsx +12 -3
- package/src/UI/Pages/ComposableScreen/elements/ImageElement.tsx +16 -8
- package/src/UI/Pages/ComposableScreen/elements/InputElement.tsx +20 -3
- package/src/UI/Pages/ComposableScreen/elements/LottieElement.tsx +12 -3
- package/src/UI/Pages/ComposableScreen/elements/RadioGroupElement.tsx +3 -3
- package/src/UI/Pages/ComposableScreen/elements/RiveElement.tsx +26 -16
- package/src/UI/Pages/ComposableScreen/elements/StackElement.tsx +31 -70
- package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +36 -47
- package/src/UI/Pages/ComposableScreen/elements/VideoElement.tsx +12 -3
- package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +5 -0
- package/src/UI/Pages/ComposableScreen/elements/shared.ts +4 -0
- package/src/UI/Pages/ComposableScreen/types.ts +16 -0
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { View, Text, TouchableOpacity } 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
|
|
|
8
8
|
export type RadioGroupElementProps = BaseBoxProps & {
|
|
9
9
|
variableName?: string;
|
|
@@ -92,8 +92,8 @@ export const RadioGroupComponent = ({ element, ctx }: Props): React.ReactElement
|
|
|
92
92
|
flexWrap: isHorizontal ? "wrap" : undefined,
|
|
93
93
|
alignSelf: element.props.alignSelf,
|
|
94
94
|
gap: element.props.gap ?? 8,
|
|
95
|
-
width: element.props.width,
|
|
96
|
-
height: element.props.height,
|
|
95
|
+
width: dim(element.props.width),
|
|
96
|
+
height: dim(element.props.height),
|
|
97
97
|
margin: element.props.margin,
|
|
98
98
|
marginHorizontal: element.props.marginHorizontal,
|
|
99
99
|
marginVertical: element.props.marginVertical,
|
|
@@ -3,12 +3,12 @@ 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 RiveElementProps = BaseBoxProps & {
|
|
10
10
|
url: string;
|
|
11
|
-
|
|
11
|
+
autoPlay?: boolean;
|
|
12
12
|
fit?: "Contain" | "Cover" | "Fill" | "FitWidth" | "FitHeight" | "None" | "ScaleDown" | "Layout";
|
|
13
13
|
alignment?: "TopLeft" | "TopCenter" | "TopRight" | "CenterLeft" | "Center" | "CenterRight" | "BottomLeft" | "BottomCenter" | "BottomRight";
|
|
14
14
|
artboardName?: string;
|
|
@@ -17,7 +17,7 @@ export type RiveElementProps = BaseBoxProps & {
|
|
|
17
17
|
|
|
18
18
|
export const RiveElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
19
19
|
url: z.string().min(1, "url must not be empty"),
|
|
20
|
-
|
|
20
|
+
autoPlay: z.boolean().optional(),
|
|
21
21
|
fit: z.enum(["Contain", "Cover", "Fill", "FitWidth", "FitHeight", "None", "ScaleDown", "Layout"]).optional(),
|
|
22
22
|
alignment: z.enum(["TopLeft", "TopCenter", "TopRight", "CenterLeft", "Center", "CenterRight", "BottomLeft", "BottomCenter", "BottomRight"]).optional(),
|
|
23
23
|
artboardName: z.string().optional(),
|
|
@@ -35,7 +35,7 @@ try {
|
|
|
35
35
|
return (
|
|
36
36
|
<Rive
|
|
37
37
|
url={element.props.url}
|
|
38
|
-
autoplay={element.props.
|
|
38
|
+
autoplay={element.props.autoPlay ?? true}
|
|
39
39
|
fit={element.props.fit ? Fit[element.props.fit] : Fit.Contain}
|
|
40
40
|
alignment={element.props.alignment ? Alignment[element.props.alignment] : Alignment.Center}
|
|
41
41
|
artboardName={element.props.artboardName}
|
|
@@ -56,19 +56,29 @@ type Props = {
|
|
|
56
56
|
|
|
57
57
|
export const RiveElementRenderer = ({ element, ctx }: Props): React.ReactElement => {
|
|
58
58
|
const { theme } = ctx;
|
|
59
|
+
const p = element.props;
|
|
59
60
|
const wrapperStyle = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
flex: p.flex,
|
|
62
|
+
flexShrink: p.flexShrink,
|
|
63
|
+
flexGrow: p.flexGrow,
|
|
64
|
+
alignSelf: p.alignSelf,
|
|
65
|
+
width: dim(p.width) ?? ("100%" as `${number}%`),
|
|
66
|
+
height: dim(p.height ?? 200),
|
|
67
|
+
minWidth: p.minWidth,
|
|
68
|
+
maxWidth: p.maxWidth,
|
|
69
|
+
minHeight: p.minHeight,
|
|
70
|
+
maxHeight: p.maxHeight,
|
|
71
|
+
opacity: p.opacity,
|
|
72
|
+
backgroundColor: p.backgroundColor,
|
|
73
|
+
margin: p.margin,
|
|
74
|
+
marginHorizontal: p.marginHorizontal,
|
|
75
|
+
marginVertical: p.marginVertical,
|
|
76
|
+
padding: p.padding,
|
|
77
|
+
paddingHorizontal: p.paddingHorizontal,
|
|
78
|
+
paddingVertical: p.paddingVertical,
|
|
79
|
+
borderWidth: p.borderWidth,
|
|
80
|
+
borderRadius: p.borderRadius,
|
|
81
|
+
borderColor: p.borderColor,
|
|
72
82
|
overflow: "hidden" as const,
|
|
73
83
|
};
|
|
74
84
|
|
|
@@ -1,63 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { View } from "react-native";
|
|
4
|
+
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
4
5
|
import { UIElement } from "../types";
|
|
5
|
-
import { RenderContext } from "./shared";
|
|
6
|
+
import { RenderContext, dim } from "./shared";
|
|
6
7
|
|
|
7
|
-
export type StackElementProps = {
|
|
8
|
+
export type StackElementProps = BaseBoxProps & {
|
|
8
9
|
gap?: number;
|
|
9
|
-
padding?: number;
|
|
10
|
-
paddingHorizontal?: number;
|
|
11
|
-
paddingVertical?: number;
|
|
12
|
-
margin?: number;
|
|
13
|
-
marginHorizontal?: number;
|
|
14
|
-
marginVertical?: number;
|
|
15
|
-
flex?: number;
|
|
16
|
-
width?: number;
|
|
17
|
-
height?: number;
|
|
18
|
-
minWidth?: number;
|
|
19
|
-
maxWidth?: number;
|
|
20
|
-
minHeight?: number;
|
|
21
|
-
maxHeight?: number;
|
|
22
10
|
alignItems?: "flex-start" | "center" | "flex-end" | "stretch";
|
|
23
|
-
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
|
|
24
11
|
justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
|
|
25
|
-
backgroundColor?: string;
|
|
26
12
|
flexWrap?: "wrap" | "nowrap";
|
|
27
|
-
flexShrink?: number;
|
|
28
|
-
borderWidth?: number;
|
|
29
|
-
borderRadius?: number;
|
|
30
|
-
borderColor?: string;
|
|
31
|
-
overflow?: "hidden" | "visible" | "scroll";
|
|
32
|
-
opacity?: number;
|
|
33
13
|
};
|
|
34
14
|
|
|
35
|
-
export const StackElementPropsSchema =
|
|
15
|
+
export const StackElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
36
16
|
gap: z.number().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
|
-
flex: z.number().optional(),
|
|
44
|
-
width: z.number().optional(),
|
|
45
|
-
height: z.number().optional(),
|
|
46
|
-
minWidth: z.number().optional(),
|
|
47
|
-
maxWidth: z.number().optional(),
|
|
48
|
-
minHeight: z.number().optional(),
|
|
49
|
-
maxHeight: z.number().optional(),
|
|
50
17
|
alignItems: z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
|
|
51
|
-
alignSelf: z.enum(["auto", "flex-start", "flex-end", "center", "stretch", "baseline"]).optional(),
|
|
52
18
|
justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
|
|
53
|
-
backgroundColor: z.string().optional(),
|
|
54
19
|
flexWrap: z.enum(["wrap", "nowrap"]).optional(),
|
|
55
|
-
flexShrink: z.number().optional(),
|
|
56
|
-
borderWidth: z.number().optional(),
|
|
57
|
-
borderRadius: z.number().optional(),
|
|
58
|
-
borderColor: z.string().optional(),
|
|
59
|
-
overflow: z.enum(["hidden", "visible", "scroll"]).optional(),
|
|
60
|
-
opacity: z.number().min(0).max(1).optional(),
|
|
61
20
|
});
|
|
62
21
|
|
|
63
22
|
type StackUIElement = Extract<UIElement, { type: "YStack" | "XStack" }>;
|
|
@@ -69,35 +28,37 @@ type Props = {
|
|
|
69
28
|
};
|
|
70
29
|
|
|
71
30
|
export const StackElementComponent = ({ element, ctx, parentType }: Props): React.ReactElement => {
|
|
31
|
+
const p = element.props;
|
|
72
32
|
return (
|
|
73
33
|
<View
|
|
74
34
|
style={{
|
|
75
35
|
flexDirection: element.type === "XStack" ? "row" : "column",
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
36
|
+
gap: p.gap,
|
|
37
|
+
flex: p.flex,
|
|
38
|
+
flexShrink: p.flexShrink ?? (parentType === "XStack" ? 1 : undefined),
|
|
39
|
+
flexGrow: p.flexGrow,
|
|
40
|
+
flexWrap: p.flexWrap,
|
|
41
|
+
alignSelf: p.alignSelf,
|
|
42
|
+
alignItems: p.alignItems,
|
|
43
|
+
justifyContent: p.justifyContent,
|
|
44
|
+
width: dim(p.width),
|
|
45
|
+
height: dim(p.height),
|
|
46
|
+
minWidth: p.minWidth,
|
|
47
|
+
maxWidth: p.maxWidth,
|
|
48
|
+
minHeight: p.minHeight,
|
|
49
|
+
maxHeight: p.maxHeight,
|
|
50
|
+
padding: p.padding,
|
|
51
|
+
paddingHorizontal: p.paddingHorizontal,
|
|
52
|
+
paddingVertical: p.paddingVertical,
|
|
53
|
+
margin: p.margin,
|
|
54
|
+
marginHorizontal: p.marginHorizontal,
|
|
55
|
+
marginVertical: p.marginVertical,
|
|
56
|
+
backgroundColor: p.backgroundColor,
|
|
57
|
+
borderWidth: p.borderWidth,
|
|
58
|
+
borderRadius: p.borderRadius,
|
|
59
|
+
borderColor: p.borderColor,
|
|
60
|
+
overflow: p.overflow,
|
|
61
|
+
opacity: p.opacity,
|
|
101
62
|
}}
|
|
102
63
|
>
|
|
103
64
|
{ctx.renderChildren(element.children, element.type)}
|
|
@@ -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 =
|
|
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
|
-
|
|
65
|
-
? interpolate(
|
|
66
|
-
:
|
|
44
|
+
p.mode === "expression"
|
|
45
|
+
? interpolate(p.content, variables)
|
|
46
|
+
: p.content;
|
|
67
47
|
|
|
68
48
|
return (
|
|
69
49
|
<Text
|
|
70
50
|
style={{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
69
|
-
|
|
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,
|
|
@@ -13,6 +13,7 @@ import { RadioGroupComponent } from "./RadioGroupElement";
|
|
|
13
13
|
import { CheckboxGroupComponent } from "./CheckboxGroupElement";
|
|
14
14
|
import { ButtonElementComponent } from "./ButtonElement";
|
|
15
15
|
import { DatePickerElementComponent } from "./DatePickerElement";
|
|
16
|
+
import { CarouselElementComponent } from "./CarouselElement";
|
|
16
17
|
|
|
17
18
|
export const renderElement = (
|
|
18
19
|
element: UIElement,
|
|
@@ -67,5 +68,9 @@ export const renderElement = (
|
|
|
67
68
|
return <DatePickerElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
if (element.type === "Carousel") {
|
|
72
|
+
return <CarouselElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
73
|
+
}
|
|
74
|
+
|
|
70
75
|
return null;
|
|
71
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;
|
|
@@ -12,6 +12,7 @@ import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/Bu
|
|
|
12
12
|
import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
|
|
13
13
|
import { type CheckboxGroupElementProps, CheckboxGroupElementPropsSchema } from "./elements/CheckboxGroupElement";
|
|
14
14
|
import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./elements/DatePickerElement";
|
|
15
|
+
import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
|
|
15
16
|
|
|
16
17
|
export type { BaseBoxProps } from "./elements/BaseBoxProps";
|
|
17
18
|
export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
|
|
@@ -27,6 +28,7 @@ export type { ButtonElementProps } from "./elements/ButtonElement";
|
|
|
27
28
|
export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
|
|
28
29
|
export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
|
|
29
30
|
export type { DatePickerElementProps } from "./elements/DatePickerElement";
|
|
31
|
+
export type { CarouselElementProps } from "./elements/CarouselElement";
|
|
30
32
|
|
|
31
33
|
// UIElement union — must live here (not in elements/) to avoid circular deps
|
|
32
34
|
// because the Stack variant's children: UIElement[] references itself.
|
|
@@ -103,6 +105,13 @@ export type UIElement =
|
|
|
103
105
|
name?: string;
|
|
104
106
|
type: "DatePicker";
|
|
105
107
|
props: DatePickerElementProps;
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
id: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
type: "Carousel";
|
|
113
|
+
props: CarouselElementProps;
|
|
114
|
+
children: UIElement[];
|
|
106
115
|
};
|
|
107
116
|
|
|
108
117
|
export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
@@ -180,6 +189,13 @@ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
180
189
|
type: z.literal("DatePicker"),
|
|
181
190
|
props: DatePickerElementPropsSchema,
|
|
182
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
|
+
}),
|
|
183
199
|
])
|
|
184
200
|
);
|
|
185
201
|
|