@rocapine/react-native-onboarding 1.34.1 → 1.36.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/onboarding-example.d.ts +332 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +30 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +10 -0
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +4 -4
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +15 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js +1 -0
- package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts +11 -0
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js +2 -0
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts +3 -0
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.js +1 -0
- package/dist/steps/ComposableScreen/elements/ImageElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts +1 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts +319 -0
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts.map +1 -0
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.js +34 -0
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.js.map +1 -0
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts +11 -0
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.js +2 -0
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.js.map +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +8 -0
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.js +8 -0
- package/dist/steps/ComposableScreen/types.js.map +1 -1
- package/dist/steps/common.types.d.ts +9 -0
- package/dist/steps/common.types.d.ts.map +1 -1
- package/dist/steps/common.types.js +13 -1
- package/dist/steps/common.types.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -0
- package/src/onboarding-example.ts +30 -0
- package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +1 -1
- package/src/steps/ComposableScreen/elements/ButtonElement.ts +9 -0
- package/src/steps/ComposableScreen/elements/CheckboxGroupElement.ts +4 -0
- package/src/steps/ComposableScreen/elements/ImageElement.ts +3 -0
- package/src/steps/ComposableScreen/elements/ProgressiveBlurImageElement.ts +87 -0
- package/src/steps/ComposableScreen/elements/RadioGroupElement.ts +4 -0
- package/src/steps/ComposableScreen/types.ts +25 -0
- package/src/steps/common.types.ts +14 -0
package/src/index.ts
CHANGED
|
@@ -13,6 +13,11 @@ export type {
|
|
|
13
13
|
WheelPickerItem,
|
|
14
14
|
WheelPickerRange,
|
|
15
15
|
RichTextElementProps,
|
|
16
|
+
ProgressiveBlurImageElementProps,
|
|
17
|
+
BlurMask,
|
|
18
|
+
LinearBlurMask,
|
|
19
|
+
RadialBlurMask,
|
|
20
|
+
BlurMaskStop,
|
|
16
21
|
ProgressIndicatorElementProps,
|
|
17
22
|
ProgressEasing,
|
|
18
23
|
AnimationEasing,
|
|
@@ -186,6 +186,33 @@ export const onboardingExample = {
|
|
|
186
186
|
resizeMode: "cover",
|
|
187
187
|
borderRadius: 12,
|
|
188
188
|
marginVertical: 8,
|
|
189
|
+
// Uniform blur (Phase 1) — RN/expo-image native blurRadius.
|
|
190
|
+
blurRadius: 8,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: "progressive-blur-demo",
|
|
195
|
+
type: "ProgressiveBlurImage",
|
|
196
|
+
props: {
|
|
197
|
+
url: "https://picsum.photos/800/600?random=88",
|
|
198
|
+
width: "100%",
|
|
199
|
+
aspectRatio: 4 / 3,
|
|
200
|
+
resizeMode: "cover",
|
|
201
|
+
borderRadius: 12,
|
|
202
|
+
marginVertical: 8,
|
|
203
|
+
intensity: 60,
|
|
204
|
+
tint: "dark",
|
|
205
|
+
maxBlurOpacity: 0.8,
|
|
206
|
+
// Sharp at top, progressively blurred toward the bottom.
|
|
207
|
+
mask: {
|
|
208
|
+
from: "top",
|
|
209
|
+
to: "bottom",
|
|
210
|
+
stops: [
|
|
211
|
+
{ position: 0, opacity: 0 },
|
|
212
|
+
{ position: 0.4, opacity: 0 },
|
|
213
|
+
{ position: 1, opacity: 1 },
|
|
214
|
+
],
|
|
215
|
+
},
|
|
189
216
|
},
|
|
190
217
|
},
|
|
191
218
|
{
|
|
@@ -516,6 +543,7 @@ export const onboardingExample = {
|
|
|
516
543
|
props: {
|
|
517
544
|
variableName: "plan",
|
|
518
545
|
defaultValue: "monthly",
|
|
546
|
+
haptic: "light",
|
|
519
547
|
showTick: true,
|
|
520
548
|
gap: 8,
|
|
521
549
|
marginVertical: 8,
|
|
@@ -560,6 +588,7 @@ export const onboardingExample = {
|
|
|
560
588
|
props: {
|
|
561
589
|
variableName: "goals",
|
|
562
590
|
defaultValues: ["health", "fitness"],
|
|
591
|
+
haptic: "light",
|
|
563
592
|
showTick: false,
|
|
564
593
|
gap: 8,
|
|
565
594
|
marginVertical: 8,
|
|
@@ -777,6 +806,7 @@ export const onboardingExample = {
|
|
|
777
806
|
label: "Get Started",
|
|
778
807
|
variant: "filled",
|
|
779
808
|
marginVertical: 8,
|
|
809
|
+
haptic: "medium",
|
|
780
810
|
actions: [
|
|
781
811
|
{ type: "custom", function: "trackCta", variables: ["name", "plan", "goals"] },
|
|
782
812
|
"continue",
|
|
@@ -24,7 +24,7 @@ export type LinearGradientConfig = {
|
|
|
24
24
|
|
|
25
25
|
export type GradientBackground = LinearGradientConfig;
|
|
26
26
|
|
|
27
|
-
const GradientEdgeSchema = z.enum(["top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight"]);
|
|
27
|
+
export const GradientEdgeSchema = z.enum(["top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight"]);
|
|
28
28
|
|
|
29
29
|
const GradientStopSchema = z.object({
|
|
30
30
|
color: z.string(),
|
|
@@ -3,8 +3,10 @@ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
|
3
3
|
import {
|
|
4
4
|
type LeafCondition,
|
|
5
5
|
type ConditionGroup,
|
|
6
|
+
type HapticStyle,
|
|
6
7
|
LeafConditionSchema,
|
|
7
8
|
ConditionGroupSchema,
|
|
9
|
+
HapticStyleSchema,
|
|
8
10
|
} from "../../common.types";
|
|
9
11
|
|
|
10
12
|
export type CustomButtonAction = {
|
|
@@ -106,6 +108,12 @@ export type ButtonElementProps = BaseBoxProps & {
|
|
|
106
108
|
disabledStyle?: ButtonStyleOverride;
|
|
107
109
|
/** Animation duration (ms) between rest/pressed/disabled. Default 150. */
|
|
108
110
|
transitionDurationMs?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Tactile feedback fired on press (before actions run). Maps to expo-haptics
|
|
113
|
+
* ImpactFeedbackStyle. Opt-in — omit or set `"none"` for no feedback.
|
|
114
|
+
* No-op if the optional `expo-haptics` peer dep isn't installed.
|
|
115
|
+
*/
|
|
116
|
+
haptic?: HapticStyle;
|
|
109
117
|
};
|
|
110
118
|
|
|
111
119
|
export const ButtonStyleOverrideSchema = BaseBoxPropsSchema.extend({
|
|
@@ -137,4 +145,5 @@ export const ButtonElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
|
137
145
|
pressedStyle: ButtonStyleOverrideSchema.optional(),
|
|
138
146
|
disabledStyle: ButtonStyleOverrideSchema.optional(),
|
|
139
147
|
transitionDurationMs: z.number().min(0).optional(),
|
|
148
|
+
haptic: HapticStyleSchema.optional(),
|
|
140
149
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
3
|
+
import { type HapticStyle, HapticStyleSchema } from "../../common.types";
|
|
3
4
|
|
|
4
5
|
export type CheckboxGroupElementProps = BaseBoxProps & {
|
|
5
6
|
variableName?: string;
|
|
6
7
|
defaultValues?: string[];
|
|
8
|
+
/** Tactile feedback fired on press, before the toggle commits. Maps to expo-haptics ImpactFeedbackStyle. Opt-in; no-op without expo-haptics. */
|
|
9
|
+
haptic?: HapticStyle;
|
|
7
10
|
gap?: number;
|
|
8
11
|
direction?: "vertical" | "horizontal";
|
|
9
12
|
showTick?: boolean;
|
|
@@ -28,6 +31,7 @@ export type CheckboxGroupElementProps = BaseBoxProps & {
|
|
|
28
31
|
export const CheckboxGroupElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
29
32
|
variableName: z.string().optional(),
|
|
30
33
|
defaultValues: z.array(z.string()).optional(),
|
|
34
|
+
haptic: HapticStyleSchema.optional(),
|
|
31
35
|
gap: z.number().optional(),
|
|
32
36
|
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
33
37
|
showTick: z.boolean().optional(),
|
|
@@ -5,10 +5,13 @@ export type ImageElementProps = BaseBoxProps & {
|
|
|
5
5
|
url: string;
|
|
6
6
|
aspectRatio?: number;
|
|
7
7
|
resizeMode?: "cover" | "contain" | "stretch" | "center";
|
|
8
|
+
/** Uniform Gaussian blur radius (px). 0/undefined = sharp. Ignored for SVGs. */
|
|
9
|
+
blurRadius?: number;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
export const ImageElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
11
13
|
url: z.string().min(1, "url must not be empty"),
|
|
12
14
|
aspectRatio: z.number().optional(),
|
|
13
15
|
resizeMode: z.enum(["cover", "contain", "stretch", "center"]).optional(),
|
|
16
|
+
blurRadius: z.number().min(0).optional(),
|
|
14
17
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
BaseBoxProps,
|
|
4
|
+
BaseBoxPropsSchema,
|
|
5
|
+
GradientEdge,
|
|
6
|
+
GradientEdgeSchema,
|
|
7
|
+
} from "./BaseBoxProps";
|
|
8
|
+
|
|
9
|
+
// A single mask stop: `position` (0..1 along from→to) maps to a blur `opacity`
|
|
10
|
+
// (0 = fully sharp at this stop, 1 = full blur). The masked blur layer fades
|
|
11
|
+
// between stops, producing the progressive (variable) blur.
|
|
12
|
+
export type BlurMaskStop = {
|
|
13
|
+
position: number;
|
|
14
|
+
opacity: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const BlurMaskStopSchema = z.object({
|
|
18
|
+
position: z.number().min(0).max(1),
|
|
19
|
+
opacity: z.number().min(0).max(1),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Linear mask (reuses BaseBoxProps' 8-edge direction vocab). `type` is optional
|
|
23
|
+
// and defaults to "linear" so existing `{ from, to, stops }` payloads stay valid.
|
|
24
|
+
export type LinearBlurMask = {
|
|
25
|
+
type?: "linear";
|
|
26
|
+
from: GradientEdge;
|
|
27
|
+
to: GradientEdge;
|
|
28
|
+
stops: BlurMaskStop[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Radial mask — sharp at the center, blurring outward (matches the Figma hero
|
|
32
|
+
// exactly). `center` is in 0..1 box fractions (default {0.5,0.5}); `radius` is a
|
|
33
|
+
// 0..1 fraction of the box (default ~0.75). Rendered via react-native-svg.
|
|
34
|
+
export type RadialBlurMask = {
|
|
35
|
+
type: "radial";
|
|
36
|
+
center?: { x: number; y: number };
|
|
37
|
+
radius?: number;
|
|
38
|
+
stops: BlurMaskStop[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type BlurMask = LinearBlurMask | RadialBlurMask;
|
|
42
|
+
|
|
43
|
+
const LinearBlurMaskSchema = z.object({
|
|
44
|
+
type: z.literal("linear").optional(),
|
|
45
|
+
from: GradientEdgeSchema,
|
|
46
|
+
to: GradientEdgeSchema,
|
|
47
|
+
stops: z.array(BlurMaskStopSchema).min(2, "blur mask requires at least 2 stops"),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const RadialBlurMaskSchema = z.object({
|
|
51
|
+
type: z.literal("radial"),
|
|
52
|
+
center: z.object({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) }).optional(),
|
|
53
|
+
radius: z.number().positive().optional(),
|
|
54
|
+
stops: z.array(BlurMaskStopSchema).min(2, "blur mask requires at least 2 stops"),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Linear first: a `{ from, to, stops }` payload (no `type`) matches it directly;
|
|
58
|
+
// a `{ type: "radial", … }` payload fails linear (no from/to) and falls to radial.
|
|
59
|
+
const BlurMaskSchema = z.union([LinearBlurMaskSchema, RadialBlurMaskSchema]);
|
|
60
|
+
|
|
61
|
+
// A full-bleed image with a gradient-masked Gaussian blur baked in: sharp where
|
|
62
|
+
// the mask is transparent, progressively blurred where it's opaque. Self-
|
|
63
|
+
// contained (owns the image + the blur) so it composes predictably as the
|
|
64
|
+
// bottom layer of a ZStack with sharp foreground content above it.
|
|
65
|
+
export type ProgressiveBlurImageElementProps = BaseBoxProps & {
|
|
66
|
+
url: string;
|
|
67
|
+
aspectRatio?: number;
|
|
68
|
+
resizeMode?: "cover" | "contain" | "stretch" | "center";
|
|
69
|
+
/** expo-blur intensity, 0..100. */
|
|
70
|
+
intensity: number;
|
|
71
|
+
/** expo-blur tint. Defaults to "default". */
|
|
72
|
+
tint?: "light" | "dark" | "default";
|
|
73
|
+
/** Gradient that drives where the blur is strong. */
|
|
74
|
+
mask: BlurMask;
|
|
75
|
+
/** Clamp on the masked blur layer's max opacity (Figma ≈ 0.8). Default 1. */
|
|
76
|
+
maxBlurOpacity?: number;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const ProgressiveBlurImageElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
80
|
+
url: z.string().min(1, "url must not be empty"),
|
|
81
|
+
aspectRatio: z.number().optional(),
|
|
82
|
+
resizeMode: z.enum(["cover", "contain", "stretch", "center"]).optional(),
|
|
83
|
+
intensity: z.number().min(0).max(100),
|
|
84
|
+
tint: z.enum(["light", "dark", "default"]).optional(),
|
|
85
|
+
mask: BlurMaskSchema,
|
|
86
|
+
maxBlurOpacity: z.number().min(0).max(1).optional(),
|
|
87
|
+
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
3
|
+
import { type HapticStyle, HapticStyleSchema } from "../../common.types";
|
|
3
4
|
|
|
4
5
|
export type RadioGroupElementProps = BaseBoxProps & {
|
|
5
6
|
variableName?: string;
|
|
6
7
|
defaultValue?: string;
|
|
8
|
+
/** Tactile feedback fired on press, before the selection commits. Maps to expo-haptics ImpactFeedbackStyle. Opt-in; no-op without expo-haptics. */
|
|
9
|
+
haptic?: HapticStyle;
|
|
7
10
|
gap?: number;
|
|
8
11
|
direction?: "vertical" | "horizontal";
|
|
9
12
|
showTick?: boolean;
|
|
@@ -28,6 +31,7 @@ export type RadioGroupElementProps = BaseBoxProps & {
|
|
|
28
31
|
export const RadioGroupElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
29
32
|
variableName: z.string().optional(),
|
|
30
33
|
defaultValue: z.string().optional(),
|
|
34
|
+
haptic: HapticStyleSchema.optional(),
|
|
31
35
|
gap: z.number().optional(),
|
|
32
36
|
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
33
37
|
showTick: z.boolean().optional(),
|
|
@@ -10,6 +10,10 @@ import { type StackElementProps, StackElementPropsSchema } from "./elements/Stac
|
|
|
10
10
|
import { type TextElementProps, TextElementPropsSchema } from "./elements/TextElement";
|
|
11
11
|
import { type RichTextElementProps, RichTextElementPropsSchema } from "./elements/RichTextElement";
|
|
12
12
|
import { type ImageElementProps, ImageElementPropsSchema } from "./elements/ImageElement";
|
|
13
|
+
import {
|
|
14
|
+
type ProgressiveBlurImageElementProps,
|
|
15
|
+
ProgressiveBlurImageElementPropsSchema,
|
|
16
|
+
} from "./elements/ProgressiveBlurImageElement";
|
|
13
17
|
import { type LottieElementProps, LottieElementPropsSchema } from "./elements/LottieElement";
|
|
14
18
|
import { type RiveElementProps, RiveElementPropsSchema } from "./elements/RiveElement";
|
|
15
19
|
import { type IconElementProps, IconElementPropsSchema } from "./elements/IconElement";
|
|
@@ -51,6 +55,13 @@ export type { TextElementProps, TextSpan } from "./elements/TextElement";
|
|
|
51
55
|
export { TextSpanSchema } from "./elements/TextElement";
|
|
52
56
|
export type { RichTextElementProps } from "./elements/RichTextElement";
|
|
53
57
|
export type { ImageElementProps } from "./elements/ImageElement";
|
|
58
|
+
export type {
|
|
59
|
+
ProgressiveBlurImageElementProps,
|
|
60
|
+
BlurMask,
|
|
61
|
+
LinearBlurMask,
|
|
62
|
+
RadialBlurMask,
|
|
63
|
+
BlurMaskStop,
|
|
64
|
+
} from "./elements/ProgressiveBlurImageElement";
|
|
54
65
|
export type { LottieElementProps } from "./elements/LottieElement";
|
|
55
66
|
export type { RiveElementProps } from "./elements/RiveElement";
|
|
56
67
|
export type { IconElementProps } from "./elements/IconElement";
|
|
@@ -123,6 +134,13 @@ type UIElement =
|
|
|
123
134
|
type: "Image";
|
|
124
135
|
props: ImageElementProps;
|
|
125
136
|
}
|
|
137
|
+
| {
|
|
138
|
+
id: string;
|
|
139
|
+
name?: string;
|
|
140
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
141
|
+
type: "ProgressiveBlurImage";
|
|
142
|
+
props: ProgressiveBlurImageElementProps;
|
|
143
|
+
}
|
|
126
144
|
| {
|
|
127
145
|
id: string;
|
|
128
146
|
name?: string;
|
|
@@ -278,6 +296,13 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
278
296
|
type: z.literal("Image"),
|
|
279
297
|
props: ImageElementPropsSchema,
|
|
280
298
|
}),
|
|
299
|
+
z.object({
|
|
300
|
+
id: z.string(),
|
|
301
|
+
name: z.string().optional(),
|
|
302
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
303
|
+
type: z.literal("ProgressiveBlurImage"),
|
|
304
|
+
props: ProgressiveBlurImageElementPropsSchema,
|
|
305
|
+
}),
|
|
281
306
|
z.object({
|
|
282
307
|
id: z.string(),
|
|
283
308
|
name: z.string().optional(),
|
|
@@ -29,6 +29,20 @@ export const ButtonSectionSchema = z.object({
|
|
|
29
29
|
icon: z.string().nullish(),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
// ── Haptics ───────────────────────────────────────────────────────────────────
|
|
33
|
+
// Tactile feedback style for clickable elements. Mirrors expo-haptics
|
|
34
|
+
// ImpactFeedbackStyle (Light/Medium/Heavy/Soft/Rigid); "none" disables feedback.
|
|
35
|
+
// Opt-in: absent prop or "none" → no haptic. Requires optional peer dep expo-haptics.
|
|
36
|
+
export const HapticStyleSchema = z.enum([
|
|
37
|
+
"none",
|
|
38
|
+
"light",
|
|
39
|
+
"medium",
|
|
40
|
+
"heavy",
|
|
41
|
+
"soft",
|
|
42
|
+
"rigid",
|
|
43
|
+
]);
|
|
44
|
+
export type HapticStyle = z.infer<typeof HapticStyleSchema>;
|
|
45
|
+
|
|
32
46
|
// ── Branching / nextStep schemas ─────────────────────────────────────────────
|
|
33
47
|
|
|
34
48
|
export const ConditionOperatorSchema = z.enum([
|