@rocapine/react-native-onboarding-ui 1.9.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 +81 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js +121 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js.map +1 -0
- 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 +8 -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 +15 -0
- package/dist/UI/Pages/ComposableScreen/types.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/types.js +15 -0
- package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
- package/package.json +11 -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 +172 -0
- 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 +10 -0
- package/src/UI/Pages/ComposableScreen/elements/shared.ts +4 -0
- package/src/UI/Pages/ComposableScreen/types.ts +30 -0
|
@@ -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,
|
|
@@ -12,6 +12,8 @@ import { InputElementComponent } from "./InputElement";
|
|
|
12
12
|
import { RadioGroupComponent } from "./RadioGroupElement";
|
|
13
13
|
import { CheckboxGroupComponent } from "./CheckboxGroupElement";
|
|
14
14
|
import { ButtonElementComponent } from "./ButtonElement";
|
|
15
|
+
import { DatePickerElementComponent } from "./DatePickerElement";
|
|
16
|
+
import { CarouselElementComponent } from "./CarouselElement";
|
|
15
17
|
|
|
16
18
|
export const renderElement = (
|
|
17
19
|
element: UIElement,
|
|
@@ -62,5 +64,13 @@ export const renderElement = (
|
|
|
62
64
|
return <ButtonElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
if (element.type === "DatePicker") {
|
|
68
|
+
return <DatePickerElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (element.type === "Carousel") {
|
|
72
|
+
return <CarouselElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
73
|
+
}
|
|
74
|
+
|
|
65
75
|
return null;
|
|
66
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;
|
|
@@ -11,6 +11,8 @@ import { type InputElementProps, InputElementPropsSchema } from "./elements/Inpu
|
|
|
11
11
|
import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/ButtonElement";
|
|
12
12
|
import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
|
|
13
13
|
import { type CheckboxGroupElementProps, CheckboxGroupElementPropsSchema } from "./elements/CheckboxGroupElement";
|
|
14
|
+
import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./elements/DatePickerElement";
|
|
15
|
+
import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
|
|
14
16
|
|
|
15
17
|
export type { BaseBoxProps } from "./elements/BaseBoxProps";
|
|
16
18
|
export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
|
|
@@ -25,6 +27,8 @@ export type { InputElementProps } from "./elements/InputElement";
|
|
|
25
27
|
export type { ButtonElementProps } from "./elements/ButtonElement";
|
|
26
28
|
export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
|
|
27
29
|
export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
|
|
30
|
+
export type { DatePickerElementProps } from "./elements/DatePickerElement";
|
|
31
|
+
export type { CarouselElementProps } from "./elements/CarouselElement";
|
|
28
32
|
|
|
29
33
|
// UIElement union — must live here (not in elements/) to avoid circular deps
|
|
30
34
|
// because the Stack variant's children: UIElement[] references itself.
|
|
@@ -95,6 +99,19 @@ export type UIElement =
|
|
|
95
99
|
name?: string;
|
|
96
100
|
type: "CheckboxGroup";
|
|
97
101
|
props: CheckboxGroupElementProps;
|
|
102
|
+
}
|
|
103
|
+
| {
|
|
104
|
+
id: string;
|
|
105
|
+
name?: string;
|
|
106
|
+
type: "DatePicker";
|
|
107
|
+
props: DatePickerElementProps;
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
id: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
type: "Carousel";
|
|
113
|
+
props: CarouselElementProps;
|
|
114
|
+
children: UIElement[];
|
|
98
115
|
};
|
|
99
116
|
|
|
100
117
|
export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
@@ -166,6 +183,19 @@ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
166
183
|
type: z.literal("CheckboxGroup"),
|
|
167
184
|
props: CheckboxGroupElementPropsSchema,
|
|
168
185
|
}),
|
|
186
|
+
z.object({
|
|
187
|
+
id: z.string(),
|
|
188
|
+
name: z.string().optional(),
|
|
189
|
+
type: z.literal("DatePicker"),
|
|
190
|
+
props: DatePickerElementPropsSchema,
|
|
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
|
+
}),
|
|
169
199
|
])
|
|
170
200
|
);
|
|
171
201
|
|