@rocapine/react-native-onboarding-ui 1.29.0 → 1.31.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/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.d.ts +127 -0
- package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.js +190 -0
- package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +47 -2
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +46 -6
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.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/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 +1 -1
- package/src/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.tsx +258 -0
- package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +75 -5
- package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +5 -0
- package/src/UI/Pages/ComposableScreen/types.ts +19 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseBoxProps } from "./BaseBoxProps";
|
|
4
|
+
import { UIElement } from "../types";
|
|
5
|
+
import { RenderContext } from "./shared";
|
|
6
|
+
export type ProgressEasing = "linear" | "ease-in" | "ease-out" | "ease-in-out";
|
|
7
|
+
export type ProgressIndicatorElementProps = BaseBoxProps & {
|
|
8
|
+
variant?: "linear" | "circular";
|
|
9
|
+
variableName?: string;
|
|
10
|
+
value?: number;
|
|
11
|
+
autoplay?: boolean;
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
initialValue?: number;
|
|
14
|
+
duration?: number;
|
|
15
|
+
delay?: number;
|
|
16
|
+
easing?: ProgressEasing;
|
|
17
|
+
color?: string;
|
|
18
|
+
trackColor?: string;
|
|
19
|
+
thickness?: number;
|
|
20
|
+
size?: number;
|
|
21
|
+
showLabel?: boolean;
|
|
22
|
+
labelColor?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const ProgressIndicatorElementPropsSchema: z.ZodObject<{
|
|
25
|
+
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
26
|
+
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
27
|
+
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
flex: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
flexShrink: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
flexGrow: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
auto: "auto";
|
|
37
|
+
center: "center";
|
|
38
|
+
"flex-start": "flex-start";
|
|
39
|
+
"flex-end": "flex-end";
|
|
40
|
+
stretch: "stretch";
|
|
41
|
+
baseline: "baseline";
|
|
42
|
+
}>>;
|
|
43
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
45
|
+
backgroundGradient: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"linear">;
|
|
47
|
+
from: z.ZodEnum<{
|
|
48
|
+
left: "left";
|
|
49
|
+
right: "right";
|
|
50
|
+
top: "top";
|
|
51
|
+
bottom: "bottom";
|
|
52
|
+
topLeft: "topLeft";
|
|
53
|
+
topRight: "topRight";
|
|
54
|
+
bottomLeft: "bottomLeft";
|
|
55
|
+
bottomRight: "bottomRight";
|
|
56
|
+
}>;
|
|
57
|
+
to: z.ZodEnum<{
|
|
58
|
+
left: "left";
|
|
59
|
+
right: "right";
|
|
60
|
+
top: "top";
|
|
61
|
+
bottom: "bottom";
|
|
62
|
+
topLeft: "topLeft";
|
|
63
|
+
topRight: "topRight";
|
|
64
|
+
bottomLeft: "bottomLeft";
|
|
65
|
+
bottomRight: "bottomRight";
|
|
66
|
+
}>;
|
|
67
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
68
|
+
color: z.ZodString;
|
|
69
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
}, z.core.$strip>], "type">>;
|
|
72
|
+
overflow: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
visible: "visible";
|
|
74
|
+
hidden: "hidden";
|
|
75
|
+
scroll: "scroll";
|
|
76
|
+
}>>;
|
|
77
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
marginHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
marginVertical: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
paddingHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
paddingVertical: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
borderWidth: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
86
|
+
shadowColor: z.ZodOptional<z.ZodString>;
|
|
87
|
+
shadowOffset: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
width: z.ZodNumber;
|
|
89
|
+
height: z.ZodNumber;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
shadowOpacity: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
shadowRadius: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
elevation: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
circular: "circular";
|
|
96
|
+
linear: "linear";
|
|
97
|
+
}>>;
|
|
98
|
+
variableName: z.ZodOptional<z.ZodString>;
|
|
99
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
autoplay: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
loop: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
initialValue: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
easing: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
linear: "linear";
|
|
107
|
+
"ease-in": "ease-in";
|
|
108
|
+
"ease-out": "ease-out";
|
|
109
|
+
"ease-in-out": "ease-in-out";
|
|
110
|
+
}>>;
|
|
111
|
+
color: z.ZodOptional<z.ZodString>;
|
|
112
|
+
trackColor: z.ZodOptional<z.ZodString>;
|
|
113
|
+
thickness: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
showLabel: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
labelColor: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
type ProgressUIElement = Extract<UIElement, {
|
|
119
|
+
type: "ProgressIndicator";
|
|
120
|
+
}>;
|
|
121
|
+
type Props = {
|
|
122
|
+
element: ProgressUIElement;
|
|
123
|
+
ctx: RenderContext;
|
|
124
|
+
};
|
|
125
|
+
export declare const ProgressIndicatorElementComponent: ({ element, ctx }: Props) => React.ReactElement;
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=ProgressIndicatorElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicatorElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAO,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AAE/E,MAAM,MAAM,6BAA6B,GAAG,YAAY,GAAG;IACzD,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAIF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgB9C,CAAC;AAcH,KAAK,iBAAiB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAAC;AAE3E,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,aAAa,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,kBAAkB,KAAK,KAAG,KAAK,CAAC,YAkLjF,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ProgressIndicatorElementComponent = exports.ProgressIndicatorElementPropsSchema = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = require("react");
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
const zod_1 = require("zod");
|
|
41
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
42
|
+
const react_native_svg_1 = __importStar(require("react-native-svg"));
|
|
43
|
+
const BaseBoxProps_1 = require("./BaseBoxProps");
|
|
44
|
+
const shared_1 = require("./shared");
|
|
45
|
+
const ProgressEasingSchema = zod_1.z.enum(["linear", "ease-in", "ease-out", "ease-in-out"]);
|
|
46
|
+
exports.ProgressIndicatorElementPropsSchema = BaseBoxProps_1.BaseBoxPropsSchema.extend({
|
|
47
|
+
variant: zod_1.z.enum(["linear", "circular"]).optional(),
|
|
48
|
+
variableName: zod_1.z.string().min(1).optional(),
|
|
49
|
+
value: zod_1.z.number().min(0).max(100).optional(),
|
|
50
|
+
autoplay: zod_1.z.boolean().optional(),
|
|
51
|
+
loop: zod_1.z.boolean().optional(),
|
|
52
|
+
initialValue: zod_1.z.number().min(0).max(100).optional(),
|
|
53
|
+
duration: zod_1.z.number().min(0).optional(),
|
|
54
|
+
delay: zod_1.z.number().min(0).optional(),
|
|
55
|
+
easing: ProgressEasingSchema.optional(),
|
|
56
|
+
color: zod_1.z.string().optional(),
|
|
57
|
+
trackColor: zod_1.z.string().optional(),
|
|
58
|
+
thickness: zod_1.z.number().min(0).optional(),
|
|
59
|
+
size: zod_1.z.number().min(0).optional(),
|
|
60
|
+
showLabel: zod_1.z.boolean().optional(),
|
|
61
|
+
labelColor: zod_1.z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
const AnimatedCircle = react_native_reanimated_1.default.createAnimatedComponent(react_native_svg_1.Circle);
|
|
64
|
+
// CSS-style cubic-bezier curves matching the selectable easing names.
|
|
65
|
+
const EASING_MAP = {
|
|
66
|
+
linear: react_native_reanimated_1.Easing.linear,
|
|
67
|
+
"ease-in": react_native_reanimated_1.Easing.bezier(0.42, 0, 1, 1),
|
|
68
|
+
"ease-out": react_native_reanimated_1.Easing.bezier(0, 0, 0.58, 1),
|
|
69
|
+
"ease-in-out": react_native_reanimated_1.Easing.bezier(0.42, 0, 0.58, 1),
|
|
70
|
+
};
|
|
71
|
+
const clamp = (n) => Math.max(0, Math.min(100, n));
|
|
72
|
+
const ProgressIndicatorElementComponent = ({ element, ctx }) => {
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
74
|
+
const { theme, variables, setVariable } = ctx;
|
|
75
|
+
const { props } = element;
|
|
76
|
+
const variant = (_a = props.variant) !== null && _a !== void 0 ? _a : "linear";
|
|
77
|
+
const initialValue = clamp((_b = props.initialValue) !== null && _b !== void 0 ? _b : 0);
|
|
78
|
+
const duration = (_c = props.duration) !== null && _c !== void 0 ? _c : 1000;
|
|
79
|
+
const delay = (_d = props.delay) !== null && _d !== void 0 ? _d : 0;
|
|
80
|
+
const easing = EASING_MAP[(_e = props.easing) !== null && _e !== void 0 ? _e : "ease-in-out"];
|
|
81
|
+
const autoplay = (_f = props.autoplay) !== null && _f !== void 0 ? _f : false;
|
|
82
|
+
const loop = (_g = props.loop) !== null && _g !== void 0 ? _g : false;
|
|
83
|
+
const color = (_h = props.color) !== null && _h !== void 0 ? _h : theme.colors.primary;
|
|
84
|
+
const trackColor = (_j = props.trackColor) !== null && _j !== void 0 ? _j : theme.colors.neutral.lower;
|
|
85
|
+
const labelColor = (_k = props.labelColor) !== null && _k !== void 0 ? _k : theme.colors.text.primary;
|
|
86
|
+
// Bound variable value (input mode, non-autoplay) or static value.
|
|
87
|
+
const boundRaw = props.variableName ? (_l = variables[props.variableName]) === null || _l === void 0 ? void 0 : _l.value : undefined;
|
|
88
|
+
const boundValue = boundRaw !== undefined ? clamp(Number(boundRaw) || 0) : undefined;
|
|
89
|
+
const target = autoplay ? 100 : clamp((_m = boundValue !== null && boundValue !== void 0 ? boundValue : props.value) !== null && _m !== void 0 ? _m : initialValue);
|
|
90
|
+
const progress = (0, react_native_reanimated_1.useSharedValue)(initialValue);
|
|
91
|
+
const [percentage, setPercentage] = (0, react_1.useState)(Math.round(initialValue));
|
|
92
|
+
// Mirror the animated value into a label + (autoplay) the bound variable.
|
|
93
|
+
// Reaction input is the *rounded* percent, so the JS callback fires only when
|
|
94
|
+
// the integer changes (≤100 hops/sweep) rather than every frame — avoids a
|
|
95
|
+
// per-frame context write storm (setVariable re-renders all variable consumers).
|
|
96
|
+
const showLabel = (_o = props.showLabel) !== null && _o !== void 0 ? _o : false;
|
|
97
|
+
const variableName = props.variableName;
|
|
98
|
+
const writeVariable = (v) => {
|
|
99
|
+
if (autoplay && variableName) {
|
|
100
|
+
setVariable(variableName, { value: String(v), kind: "int" });
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const writesVariable = autoplay && !!variableName;
|
|
104
|
+
(0, react_native_reanimated_1.useAnimatedReaction)(() => Math.round(progress.value), (rounded, prev) => {
|
|
105
|
+
if (rounded === prev)
|
|
106
|
+
return;
|
|
107
|
+
if (showLabel)
|
|
108
|
+
(0, react_native_reanimated_1.runOnJS)(setPercentage)(rounded);
|
|
109
|
+
if (writesVariable)
|
|
110
|
+
(0, react_native_reanimated_1.runOnJS)(writeVariable)(rounded);
|
|
111
|
+
});
|
|
112
|
+
// Autoplay: animate initialValue -> 100, optionally looping, after `delay`.
|
|
113
|
+
(0, react_1.useEffect)(() => {
|
|
114
|
+
if (!autoplay)
|
|
115
|
+
return;
|
|
116
|
+
progress.value = initialValue;
|
|
117
|
+
const anim = (0, react_native_reanimated_1.withTiming)(100, { duration, easing });
|
|
118
|
+
const looped = loop ? (0, react_native_reanimated_1.withRepeat)(anim, -1, false) : anim;
|
|
119
|
+
progress.value = delay > 0 ? (0, react_native_reanimated_1.withDelay)(delay, looped) : looped;
|
|
120
|
+
return () => (0, react_native_reanimated_1.cancelAnimation)(progress);
|
|
121
|
+
}, [autoplay, loop, duration, delay, easing, initialValue]);
|
|
122
|
+
// Bound / static (non-autoplay): animate toward the current target after `delay`.
|
|
123
|
+
(0, react_1.useEffect)(() => {
|
|
124
|
+
if (autoplay)
|
|
125
|
+
return;
|
|
126
|
+
const anim = (0, react_native_reanimated_1.withTiming)(target, { duration, easing });
|
|
127
|
+
progress.value = delay > 0 ? (0, react_native_reanimated_1.withDelay)(delay, anim) : anim;
|
|
128
|
+
return () => (0, react_native_reanimated_1.cancelAnimation)(progress);
|
|
129
|
+
}, [autoplay, target, duration, delay, easing]);
|
|
130
|
+
// Circular geometry (computed unconditionally so hooks below stay unconditional).
|
|
131
|
+
const size = (_p = props.size) !== null && _p !== void 0 ? _p : 120;
|
|
132
|
+
const strokeWidth = (_q = props.thickness) !== null && _q !== void 0 ? _q : 10;
|
|
133
|
+
const radius = (size - strokeWidth) / 2;
|
|
134
|
+
const circumference = 2 * Math.PI * radius;
|
|
135
|
+
const animatedCircleProps = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
|
|
136
|
+
strokeDashoffset: circumference * (1 - progress.value / 100),
|
|
137
|
+
}));
|
|
138
|
+
const animatedFillStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
139
|
+
width: `${progress.value}%`,
|
|
140
|
+
}));
|
|
141
|
+
const containerStyle = {
|
|
142
|
+
alignSelf: props.alignSelf,
|
|
143
|
+
flex: props.flex,
|
|
144
|
+
flexShrink: props.flexShrink,
|
|
145
|
+
flexGrow: props.flexGrow,
|
|
146
|
+
width: (0, shared_1.dim)(props.width),
|
|
147
|
+
height: (0, shared_1.dim)(props.height),
|
|
148
|
+
minWidth: props.minWidth,
|
|
149
|
+
maxWidth: props.maxWidth,
|
|
150
|
+
minHeight: props.minHeight,
|
|
151
|
+
maxHeight: props.maxHeight,
|
|
152
|
+
opacity: props.opacity,
|
|
153
|
+
margin: props.margin,
|
|
154
|
+
marginHorizontal: props.marginHorizontal,
|
|
155
|
+
marginVertical: props.marginVertical,
|
|
156
|
+
padding: props.padding,
|
|
157
|
+
paddingHorizontal: props.paddingHorizontal,
|
|
158
|
+
paddingVertical: props.paddingVertical,
|
|
159
|
+
};
|
|
160
|
+
if (variant === "circular") {
|
|
161
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [containerStyle, { width: size, height: size, alignItems: "center", justifyContent: "center" }], children: [(0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { width: size, height: size, children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: size / 2, cy: size / 2, r: radius, stroke: trackColor, strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)(AnimatedCircle, { cx: size / 2, cy: size / 2, r: radius, stroke: color, strokeWidth: strokeWidth, fill: "none", strokeDasharray: circumference, animatedProps: animatedCircleProps, strokeLinecap: "round", rotation: "-90", origin: `${size / 2}, ${size / 2}` })] }), props.showLabel ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { position: "absolute", alignItems: "center", justifyContent: "center" }, children: (0, jsx_runtime_1.jsxs)(react_native_1.Text, { style: {
|
|
162
|
+
color: labelColor,
|
|
163
|
+
fontSize: theme.typography.textStyles.heading2.fontSize,
|
|
164
|
+
fontWeight: theme.typography.fontWeight.bold,
|
|
165
|
+
fontFamily: theme.typography.textStyles.heading2.fontFamily,
|
|
166
|
+
}, children: [percentage, "%"] }) })) : null] }));
|
|
167
|
+
}
|
|
168
|
+
// Linear variant
|
|
169
|
+
const barHeight = (_r = props.thickness) !== null && _r !== void 0 ? _r : 8;
|
|
170
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [containerStyle, { width: (_s = (0, shared_1.dim)(props.width)) !== null && _s !== void 0 ? _s : "100%", flexDirection: "row", alignItems: "center" }], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
171
|
+
flex: 1,
|
|
172
|
+
height: barHeight,
|
|
173
|
+
backgroundColor: trackColor,
|
|
174
|
+
borderRadius: (_t = props.borderRadius) !== null && _t !== void 0 ? _t : barHeight / 2,
|
|
175
|
+
overflow: "hidden",
|
|
176
|
+
}, children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [
|
|
177
|
+
{ height: "100%", backgroundColor: color, borderRadius: (_u = props.borderRadius) !== null && _u !== void 0 ? _u : barHeight / 2 },
|
|
178
|
+
animatedFillStyle,
|
|
179
|
+
] }) }), props.showLabel ? ((0, jsx_runtime_1.jsxs)(react_native_1.Text, { style: {
|
|
180
|
+
marginLeft: 12,
|
|
181
|
+
color: labelColor,
|
|
182
|
+
fontSize: theme.typography.textStyles.label.fontSize,
|
|
183
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
184
|
+
fontFamily: theme.typography.textStyles.label.fontFamily,
|
|
185
|
+
minWidth: 44,
|
|
186
|
+
textAlign: "right",
|
|
187
|
+
}, children: [percentage, "%"] })) : null] }));
|
|
188
|
+
};
|
|
189
|
+
exports.ProgressIndicatorElementComponent = ProgressIndicatorElementComponent;
|
|
190
|
+
//# sourceMappingURL=ProgressIndicatorElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicatorElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.tsx"],"names":[],"mappings":";;;;;;;;;;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"./BaseBoxProps";
|
|
4
4
|
import { UIElement } from "../types";
|
|
5
5
|
import { RenderContext } from "./shared";
|
|
6
|
+
export type TextSpan = {
|
|
7
|
+
text: string;
|
|
8
|
+
fontWeight?: string;
|
|
9
|
+
fontStyle?: "normal" | "italic";
|
|
10
|
+
fontFamily?: string | "inherit";
|
|
11
|
+
fontSize?: number;
|
|
12
|
+
letterSpacing?: number;
|
|
13
|
+
color?: string;
|
|
14
|
+
textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through";
|
|
15
|
+
};
|
|
16
|
+
export declare const TextSpanSchema: z.ZodObject<{
|
|
17
|
+
text: z.ZodString;
|
|
18
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
19
|
+
fontStyle: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
normal: "normal";
|
|
21
|
+
italic: "italic";
|
|
22
|
+
}>>;
|
|
23
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
24
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
color: z.ZodOptional<z.ZodString>;
|
|
27
|
+
textDecorationLine: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
none: "none";
|
|
29
|
+
underline: "underline";
|
|
30
|
+
"line-through": "line-through";
|
|
31
|
+
"underline line-through": "underline line-through";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
6
34
|
export type TextElementProps = BaseBoxProps & {
|
|
7
|
-
content: string;
|
|
35
|
+
content: string | TextSpan[];
|
|
8
36
|
mode?: "plain" | "expression";
|
|
9
37
|
fontSize?: number;
|
|
10
38
|
fontWeight?: string;
|
|
@@ -85,7 +113,24 @@ export declare const TextElementPropsSchema: z.ZodObject<{
|
|
|
85
113
|
shadowOpacity: z.ZodOptional<z.ZodNumber>;
|
|
86
114
|
shadowRadius: z.ZodOptional<z.ZodNumber>;
|
|
87
115
|
elevation: z.ZodOptional<z.ZodNumber>;
|
|
88
|
-
content: z.ZodString
|
|
116
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
117
|
+
text: z.ZodString;
|
|
118
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
119
|
+
fontStyle: z.ZodOptional<z.ZodEnum<{
|
|
120
|
+
normal: "normal";
|
|
121
|
+
italic: "italic";
|
|
122
|
+
}>>;
|
|
123
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
124
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
letterSpacing: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
color: z.ZodOptional<z.ZodString>;
|
|
127
|
+
textDecorationLine: z.ZodOptional<z.ZodEnum<{
|
|
128
|
+
none: "none";
|
|
129
|
+
underline: "underline";
|
|
130
|
+
"line-through": "line-through";
|
|
131
|
+
"underline line-through": "underline line-through";
|
|
132
|
+
}>>;
|
|
133
|
+
}, z.core.$strip>>]>;
|
|
89
134
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
90
135
|
plain: "plain";
|
|
91
136
|
expression: "expression";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/TextElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAgD,MAAM,UAAU,CAAC;AAGvF,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAC5C,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TextElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/TextElement.tsx"],"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWjC,CAAC;AAoCH,KAAK,aAAa,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1D,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,aAAa,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,8BAA8B,KAAK,KAAG,KAAK,CAAC,YA6FhF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextElementComponent = exports.TextElementPropsSchema = void 0;
|
|
3
|
+
exports.TextElementComponent = exports.TextElementPropsSchema = exports.TextSpanSchema = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
@@ -8,8 +8,20 @@ const react_native_onboarding_1 = require("@rocapine/react-native-onboarding");
|
|
|
8
8
|
const BaseBoxProps_1 = require("./BaseBoxProps");
|
|
9
9
|
const shared_1 = require("./shared");
|
|
10
10
|
const GradientBox_1 = require("./GradientBox");
|
|
11
|
+
exports.TextSpanSchema = zod_1.z.object({
|
|
12
|
+
text: zod_1.z.string(),
|
|
13
|
+
fontWeight: zod_1.z.string().optional(),
|
|
14
|
+
fontStyle: zod_1.z.enum(["normal", "italic"]).optional(),
|
|
15
|
+
fontFamily: zod_1.z.string().optional(),
|
|
16
|
+
fontSize: zod_1.z.number().optional(),
|
|
17
|
+
letterSpacing: zod_1.z.number().optional(),
|
|
18
|
+
color: zod_1.z.string().optional(),
|
|
19
|
+
textDecorationLine: zod_1.z
|
|
20
|
+
.enum(["none", "underline", "line-through", "underline line-through"])
|
|
21
|
+
.optional(),
|
|
22
|
+
});
|
|
11
23
|
exports.TextElementPropsSchema = BaseBoxProps_1.BaseBoxPropsSchema.extend({
|
|
12
|
-
content: zod_1.z.string(),
|
|
24
|
+
content: zod_1.z.union([zod_1.z.string(), zod_1.z.array(exports.TextSpanSchema)]),
|
|
13
25
|
mode: zod_1.z.enum(["plain", "expression"]).optional(),
|
|
14
26
|
fontSize: zod_1.z.number().optional(),
|
|
15
27
|
fontWeight: zod_1.z.string().optional(),
|
|
@@ -20,13 +32,39 @@ exports.TextElementPropsSchema = BaseBoxProps_1.BaseBoxPropsSchema.extend({
|
|
|
20
32
|
letterSpacing: zod_1.z.number().optional(),
|
|
21
33
|
lineHeight: zod_1.z.number().optional(),
|
|
22
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* Renders one inline span. Isolated as its own component so the
|
|
37
|
+
* `useResolvedFontStyle` hook is called once per stable component instance —
|
|
38
|
+
* calling the hook in a `.map` loop inside the parent would break rules of
|
|
39
|
+
* hooks when the span count changes.
|
|
40
|
+
*/
|
|
41
|
+
const RichTextSpan = ({ span, baseFontFamily, }) => {
|
|
42
|
+
const fontFamily = (0, shared_1.resolveInheritedFontFamily)(span.fontFamily, baseFontFamily);
|
|
43
|
+
const resolved = (0, react_native_onboarding_1.useResolvedFontStyle)(fontFamily, span.fontWeight);
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
45
|
+
fontFamily: resolved.fontFamily,
|
|
46
|
+
fontWeight: resolved.resolvedToVariant
|
|
47
|
+
? undefined
|
|
48
|
+
: span.fontWeight,
|
|
49
|
+
fontStyle: span.fontStyle,
|
|
50
|
+
fontSize: span.fontSize,
|
|
51
|
+
letterSpacing: span.letterSpacing,
|
|
52
|
+
color: span.color,
|
|
53
|
+
textDecorationLine: span.textDecorationLine,
|
|
54
|
+
}, children: span.text }));
|
|
55
|
+
};
|
|
23
56
|
const TextElementComponent = ({ element, ctx, parentType }) => {
|
|
24
57
|
var _a, _b, _c;
|
|
25
58
|
const { theme, variables } = ctx;
|
|
26
59
|
const p = element.props;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
60
|
+
const isExpression = p.mode === "expression";
|
|
61
|
+
const content = Array.isArray(p.content)
|
|
62
|
+
? isExpression
|
|
63
|
+
? p.content.map((s) => (Object.assign(Object.assign({}, s), { text: (0, shared_1.interpolate)(s.text, variables) })))
|
|
64
|
+
: p.content
|
|
65
|
+
: isExpression
|
|
66
|
+
? (0, shared_1.interpolate)(p.content, variables)
|
|
67
|
+
: p.content;
|
|
30
68
|
const inheritedFontFamily = (0, shared_1.resolveInheritedFontFamily)(p.fontFamily, theme.typography.defaultFontFamily);
|
|
31
69
|
const resolvedFont = (0, react_native_onboarding_1.useResolvedFontStyle)(inheritedFontFamily, p.fontWeight);
|
|
32
70
|
const textNode = ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
@@ -59,7 +97,9 @@ const TextElementComponent = ({ element, ctx, parentType }) => {
|
|
|
59
97
|
borderRadius: p.backgroundGradient ? undefined : p.borderRadius,
|
|
60
98
|
borderColor: p.backgroundGradient ? undefined : p.borderColor,
|
|
61
99
|
opacity: p.backgroundGradient ? undefined : p.opacity,
|
|
62
|
-
}, children: content
|
|
100
|
+
}, children: typeof content === "string"
|
|
101
|
+
? content
|
|
102
|
+
: content.map((s, i) => ((0, jsx_runtime_1.jsx)(RichTextSpan, { span: s, baseFontFamily: inheritedFontFamily }, i))) }));
|
|
63
103
|
if (p.backgroundGradient) {
|
|
64
104
|
return ((0, jsx_runtime_1.jsx)(GradientBox_1.GradientBox, { gradient: p.backgroundGradient, style: {
|
|
65
105
|
flex: p.flex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/TextElement.tsx"],"names":[],"mappings":";;;;AACA,6BAAwB;AACxB,+CAAoC;AACpC,+EAAyE;AACzE,iDAAkE;AAElE,qCAAuF;AACvF,+CAA4C;
|
|
1
|
+
{"version":3,"file":"TextElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/TextElement.tsx"],"names":[],"mappings":";;;;AACA,6BAAwB;AACxB,+CAAoC;AACpC,+EAAyE;AACzE,iDAAkE;AAElE,qCAAuF;AACvF,+CAA4C;AAiB/B,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,kBAAkB,EAAE,OAAC;SAClB,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,wBAAwB,CAAC,CAAC;SACrE,QAAQ,EAAE;CACd,CAAC,CAAC;AAeU,QAAA,sBAAsB,GAAG,iCAAkB,CAAC,MAAM,CAAC;IAC9D,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,sBAAc,CAAC,CAAC,CAAC;IACvD,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE;IAChD,QAAQ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C;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA7FW,QAAA,oBAAoB,wBA6F/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"renderElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAqBzC,eAAO,MAAM,aAAa,GACxB,SAAS,SAAS,EAClB,KAAK,aAAa,EAClB,aAAa,QAAQ,GAAG,QAAQ,GAAG,QAAQ,KAC1C,KAAK,CAAC,SAqFR,CAAC"}
|
|
@@ -21,6 +21,7 @@ const ZStackElement_1 = require("./ZStackElement");
|
|
|
21
21
|
const SafeAreaViewElement_1 = require("./SafeAreaViewElement");
|
|
22
22
|
const ScrollViewElement_1 = require("./ScrollViewElement");
|
|
23
23
|
const KeyboardAvoidingViewElement_1 = require("./KeyboardAvoidingViewElement");
|
|
24
|
+
const ProgressIndicatorElement_1 = require("./ProgressIndicatorElement");
|
|
24
25
|
const renderElement = (element, ctx, parentType) => {
|
|
25
26
|
if (element.renderWhen) {
|
|
26
27
|
const flatVars = Object.fromEntries(Object.entries(ctx.variables).map(([k, v]) => [k, v === null || v === void 0 ? void 0 : v.value]));
|
|
@@ -81,6 +82,9 @@ const renderElement = (element, ctx, parentType) => {
|
|
|
81
82
|
if (element.type === "KeyboardAvoidingView") {
|
|
82
83
|
return (0, jsx_runtime_1.jsx)(KeyboardAvoidingViewElement_1.KeyboardAvoidingViewElementComponent, { element: element, ctx: ctx }, element.id);
|
|
83
84
|
}
|
|
85
|
+
if (element.type === "ProgressIndicator") {
|
|
86
|
+
return (0, jsx_runtime_1.jsx)(ProgressIndicatorElement_1.ProgressIndicatorElementComponent, { element: element, ctx: ctx }, element.id);
|
|
87
|
+
}
|
|
84
88
|
return null;
|
|
85
89
|
};
|
|
86
90
|
exports.renderElement = renderElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":";;;;AACA,+EAAsE;AAGtE,iDAAuD;AACvD,+CAAqD;AACrD,iDAAuD;AACvD,mDAAyD;AACzD,+CAAoD;AACpD,+CAAqD;AACrD,iDAAsD;AACtD,iDAAuD;AACvD,2DAA0D;AAC1D,iEAAgE;AAChE,mDAAyD;AACzD,2DAAiE;AACjE,6DAAmE;AACnE,uDAA6D;AAC7D,mDAAyD;AACzD,+DAAqE;AACrE,2DAAiE;AACjE,+EAAqF;
|
|
1
|
+
{"version":3,"file":"renderElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":";;;;AACA,+EAAsE;AAGtE,iDAAuD;AACvD,+CAAqD;AACrD,iDAAuD;AACvD,mDAAyD;AACzD,+CAAoD;AACpD,+CAAqD;AACrD,iDAAsD;AACtD,iDAAuD;AACvD,2DAA0D;AAC1D,iEAAgE;AAChE,mDAAyD;AACzD,2DAAiE;AACjE,6DAAmE;AACnE,uDAA6D;AAC7D,mDAAyD;AACzD,+DAAqE;AACrE,2DAAiE;AACjE,+EAAqF;AACrF,yEAA+E;AAExE,MAAM,aAAa,GAAG,CAC3B,OAAkB,EAClB,GAAkB,EAClB,UAA2C,EAC1B,EAAE;IACnB,IAAI,OAAO,CAAC,UAAU,EAAE,C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AC,EAAE,CAAgC,CAAC;IAC/F,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACzC,OAAO,uBAAC,4DAAiC,IAAkB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAtC,OAAO,CAAC,EAAE,CAAgC,CAAC;IAC5F,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAzFW,QAAA,aAAa,iBAyFxB"}
|
|
@@ -17,6 +17,7 @@ import { type ZStackElementProps } from "./elements/ZStackElement";
|
|
|
17
17
|
import { type SafeAreaViewElementProps } from "./elements/SafeAreaViewElement";
|
|
18
18
|
import { type ScrollViewElementProps } from "./elements/ScrollViewElement";
|
|
19
19
|
import { type KeyboardAvoidingViewElementProps } from "./elements/KeyboardAvoidingViewElement";
|
|
20
|
+
import { type ProgressIndicatorElementProps } from "./elements/ProgressIndicatorElement";
|
|
20
21
|
export type { BaseBoxProps } from "./elements/BaseBoxProps";
|
|
21
22
|
export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
|
|
22
23
|
export type { StackElementProps } from "./elements/StackElement";
|
|
@@ -37,6 +38,7 @@ export type { ZStackElementProps } from "./elements/ZStackElement";
|
|
|
37
38
|
export type { SafeAreaViewElementProps, SafeAreaEdge, SafeAreaEdgeMode } from "./elements/SafeAreaViewElement";
|
|
38
39
|
export type { ScrollViewElementProps, ScrollViewContentInset } from "./elements/ScrollViewElement";
|
|
39
40
|
export type { KeyboardAvoidingViewElementProps, KeyboardAvoidingBehavior, } from "./elements/KeyboardAvoidingViewElement";
|
|
41
|
+
export type { ProgressIndicatorElementProps, ProgressEasing } from "./elements/ProgressIndicatorElement";
|
|
40
42
|
export type UIElement = {
|
|
41
43
|
id: string;
|
|
42
44
|
name?: string;
|
|
@@ -151,6 +153,12 @@ export type UIElement = {
|
|
|
151
153
|
type: "KeyboardAvoidingView";
|
|
152
154
|
props: KeyboardAvoidingViewElementProps;
|
|
153
155
|
children: UIElement[];
|
|
156
|
+
} | {
|
|
157
|
+
id: string;
|
|
158
|
+
name?: string;
|
|
159
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
160
|
+
type: "ProgressIndicator";
|
|
161
|
+
props: ProgressIndicatorElementProps;
|
|
154
162
|
};
|
|
155
163
|
export declare const UIElementSchema: z.ZodType<UIElement>;
|
|
156
164
|
export declare const ComposableScreenStepPayloadSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAI7B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,KAAK,sBAAsB,EAAgC,MAAM,8BAA8B,CAAC;AACzG,OAAO,EAAE,KAAK,yBAAyB,EAAmC,MAAM,iCAAiC,CAAC;AAClH,OAAO,EAAE,KAAK,sBAAsB,EAAgC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AE,sBAAsB,CAAC;IAC9B,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;IAC5C,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,gCAAgC,CAAC;IACxC,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;IAC5C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,6BAA6B,CAAC;CACtC,CAAC;AAEN,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CA8IhD,CAAC;AA4BF,eAAO,MAAM,iCAAiC;;iBAc1C,CAAC;AAEL,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBASzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -21,6 +21,7 @@ const ZStackElement_1 = require("./elements/ZStackElement");
|
|
|
21
21
|
const SafeAreaViewElement_1 = require("./elements/SafeAreaViewElement");
|
|
22
22
|
const ScrollViewElement_1 = require("./elements/ScrollViewElement");
|
|
23
23
|
const KeyboardAvoidingViewElement_1 = require("./elements/KeyboardAvoidingViewElement");
|
|
24
|
+
const ProgressIndicatorElement_1 = require("./elements/ProgressIndicatorElement");
|
|
24
25
|
var BaseBoxProps_1 = require("./elements/BaseBoxProps");
|
|
25
26
|
Object.defineProperty(exports, "BaseBoxPropsSchema", { enumerable: true, get: function () { return BaseBoxProps_1.BaseBoxPropsSchema; } });
|
|
26
27
|
exports.UIElementSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
@@ -156,6 +157,13 @@ exports.UIElementSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
|
156
157
|
props: KeyboardAvoidingViewElement_1.KeyboardAvoidingViewElementPropsSchema,
|
|
157
158
|
children: zod_1.z.array(exports.UIElementSchema),
|
|
158
159
|
}),
|
|
160
|
+
zod_1.z.object({
|
|
161
|
+
id: zod_1.z.string(),
|
|
162
|
+
name: zod_1.z.string().optional(),
|
|
163
|
+
renderWhen: zod_1.z.union([react_native_onboarding_1.LeafConditionSchema, react_native_onboarding_1.ConditionGroupSchema]).optional(),
|
|
164
|
+
type: zod_1.z.literal("ProgressIndicator"),
|
|
165
|
+
props: ProgressIndicatorElement_1.ProgressIndicatorElementPropsSchema,
|
|
166
|
+
}),
|
|
159
167
|
]));
|
|
160
168
|
// See packages/onboarding for the canonical comment; mirror nesting guard here because
|
|
161
169
|
// the UI re-parses the step with `ComposableScreenStepTypeSchema.parse(step)` in Renderer.tsx.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+EAO2C;AAC3C,oCAA+C;AAC/C,0DAA0F;AAC1F,wDAAuF;AACvF,0DAA0F;AAC1F,4DAA6F;AAC7F,wDAAuF;AACvF,wDAAuF;AACvF,0DAA0F;AAC1F,0DAA0F;AAC1F,4DAA6F;AAC7F,oEAAyG;AACzG,0EAAkH;AAClH,oEAAyG;AACzG,gEAAmG;AACnG,4DAA6F;AAC7F,wEAA+G;AAC/G,oEAAyG;AACzG,wFAGgD;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+EAO2C;AAC3C,oCAA+C;AAC/C,0DAA0F;AAC1F,wDAAuF;AACvF,0DAA0F;AAC1F,4DAA6F;AAC7F,wDAAuF;AACvF,wDAAuF;AACvF,0DAA0F;AAC1F,0D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CAAC,OAAO,CAAC,UAAU,CAAC;IAC9D,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CAC/B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocapine/react-native-onboarding-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "UI components and renderers for Rocapine Onboarding Studio - Built on top of the headless SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { View, Text } from "react-native";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import Animated, {
|
|
5
|
+
useSharedValue,
|
|
6
|
+
useAnimatedProps,
|
|
7
|
+
useAnimatedStyle,
|
|
8
|
+
useAnimatedReaction,
|
|
9
|
+
withTiming,
|
|
10
|
+
withRepeat,
|
|
11
|
+
withDelay,
|
|
12
|
+
runOnJS,
|
|
13
|
+
Easing,
|
|
14
|
+
cancelAnimation,
|
|
15
|
+
} from "react-native-reanimated";
|
|
16
|
+
import Svg, { Circle } from "react-native-svg";
|
|
17
|
+
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
18
|
+
import { UIElement } from "../types";
|
|
19
|
+
import { RenderContext, dim } from "./shared";
|
|
20
|
+
|
|
21
|
+
export type ProgressEasing = "linear" | "ease-in" | "ease-out" | "ease-in-out";
|
|
22
|
+
|
|
23
|
+
export type ProgressIndicatorElementProps = BaseBoxProps & {
|
|
24
|
+
variant?: "linear" | "circular";
|
|
25
|
+
variableName?: string;
|
|
26
|
+
value?: number;
|
|
27
|
+
autoplay?: boolean;
|
|
28
|
+
loop?: boolean;
|
|
29
|
+
initialValue?: number;
|
|
30
|
+
duration?: number;
|
|
31
|
+
delay?: number;
|
|
32
|
+
easing?: ProgressEasing;
|
|
33
|
+
color?: string;
|
|
34
|
+
trackColor?: string;
|
|
35
|
+
thickness?: number;
|
|
36
|
+
size?: number;
|
|
37
|
+
showLabel?: boolean;
|
|
38
|
+
labelColor?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const ProgressEasingSchema = z.enum(["linear", "ease-in", "ease-out", "ease-in-out"]);
|
|
42
|
+
|
|
43
|
+
export const ProgressIndicatorElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
44
|
+
variant: z.enum(["linear", "circular"]).optional(),
|
|
45
|
+
variableName: z.string().min(1).optional(),
|
|
46
|
+
value: z.number().min(0).max(100).optional(),
|
|
47
|
+
autoplay: z.boolean().optional(),
|
|
48
|
+
loop: z.boolean().optional(),
|
|
49
|
+
initialValue: z.number().min(0).max(100).optional(),
|
|
50
|
+
duration: z.number().min(0).optional(),
|
|
51
|
+
delay: z.number().min(0).optional(),
|
|
52
|
+
easing: ProgressEasingSchema.optional(),
|
|
53
|
+
color: z.string().optional(),
|
|
54
|
+
trackColor: z.string().optional(),
|
|
55
|
+
thickness: z.number().min(0).optional(),
|
|
56
|
+
size: z.number().min(0).optional(),
|
|
57
|
+
showLabel: z.boolean().optional(),
|
|
58
|
+
labelColor: z.string().optional(),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
62
|
+
|
|
63
|
+
// CSS-style cubic-bezier curves matching the selectable easing names.
|
|
64
|
+
const EASING_MAP: Record<ProgressEasing, ReturnType<typeof Easing.bezier> | typeof Easing.linear> = {
|
|
65
|
+
linear: Easing.linear,
|
|
66
|
+
"ease-in": Easing.bezier(0.42, 0, 1, 1),
|
|
67
|
+
"ease-out": Easing.bezier(0, 0, 0.58, 1),
|
|
68
|
+
"ease-in-out": Easing.bezier(0.42, 0, 0.58, 1),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const clamp = (n: number): number => Math.max(0, Math.min(100, n));
|
|
72
|
+
|
|
73
|
+
type ProgressUIElement = Extract<UIElement, { type: "ProgressIndicator" }>;
|
|
74
|
+
|
|
75
|
+
type Props = {
|
|
76
|
+
element: ProgressUIElement;
|
|
77
|
+
ctx: RenderContext;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const ProgressIndicatorElementComponent = ({ element, ctx }: Props): React.ReactElement => {
|
|
81
|
+
const { theme, variables, setVariable } = ctx;
|
|
82
|
+
const { props } = element;
|
|
83
|
+
|
|
84
|
+
const variant = props.variant ?? "linear";
|
|
85
|
+
const initialValue = clamp(props.initialValue ?? 0);
|
|
86
|
+
const duration = props.duration ?? 1000;
|
|
87
|
+
const delay = props.delay ?? 0;
|
|
88
|
+
const easing = EASING_MAP[props.easing ?? "ease-in-out"];
|
|
89
|
+
const autoplay = props.autoplay ?? false;
|
|
90
|
+
const loop = props.loop ?? false;
|
|
91
|
+
|
|
92
|
+
const color = props.color ?? theme.colors.primary;
|
|
93
|
+
const trackColor = props.trackColor ?? theme.colors.neutral.lower;
|
|
94
|
+
const labelColor = props.labelColor ?? theme.colors.text.primary;
|
|
95
|
+
|
|
96
|
+
// Bound variable value (input mode, non-autoplay) or static value.
|
|
97
|
+
const boundRaw = props.variableName ? variables[props.variableName]?.value : undefined;
|
|
98
|
+
const boundValue = boundRaw !== undefined ? clamp(Number(boundRaw) || 0) : undefined;
|
|
99
|
+
const target = autoplay ? 100 : clamp(boundValue ?? props.value ?? initialValue);
|
|
100
|
+
|
|
101
|
+
const progress = useSharedValue(initialValue);
|
|
102
|
+
const [percentage, setPercentage] = useState(Math.round(initialValue));
|
|
103
|
+
|
|
104
|
+
// Mirror the animated value into a label + (autoplay) the bound variable.
|
|
105
|
+
// Reaction input is the *rounded* percent, so the JS callback fires only when
|
|
106
|
+
// the integer changes (≤100 hops/sweep) rather than every frame — avoids a
|
|
107
|
+
// per-frame context write storm (setVariable re-renders all variable consumers).
|
|
108
|
+
const showLabel = props.showLabel ?? false;
|
|
109
|
+
const variableName = props.variableName;
|
|
110
|
+
const writeVariable = (v: number) => {
|
|
111
|
+
if (autoplay && variableName) {
|
|
112
|
+
setVariable(variableName, { value: String(v), kind: "int" });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const writesVariable = autoplay && !!variableName;
|
|
116
|
+
useAnimatedReaction(
|
|
117
|
+
() => Math.round(progress.value),
|
|
118
|
+
(rounded, prev) => {
|
|
119
|
+
if (rounded === prev) return;
|
|
120
|
+
if (showLabel) runOnJS(setPercentage)(rounded);
|
|
121
|
+
if (writesVariable) runOnJS(writeVariable)(rounded);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// Autoplay: animate initialValue -> 100, optionally looping, after `delay`.
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!autoplay) return;
|
|
128
|
+
progress.value = initialValue;
|
|
129
|
+
const anim = withTiming(100, { duration, easing });
|
|
130
|
+
const looped = loop ? withRepeat(anim, -1, false) : anim;
|
|
131
|
+
progress.value = delay > 0 ? withDelay(delay, looped) : looped;
|
|
132
|
+
return () => cancelAnimation(progress);
|
|
133
|
+
}, [autoplay, loop, duration, delay, easing, initialValue]);
|
|
134
|
+
|
|
135
|
+
// Bound / static (non-autoplay): animate toward the current target after `delay`.
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (autoplay) return;
|
|
138
|
+
const anim = withTiming(target, { duration, easing });
|
|
139
|
+
progress.value = delay > 0 ? withDelay(delay, anim) : anim;
|
|
140
|
+
return () => cancelAnimation(progress);
|
|
141
|
+
}, [autoplay, target, duration, delay, easing]);
|
|
142
|
+
|
|
143
|
+
// Circular geometry (computed unconditionally so hooks below stay unconditional).
|
|
144
|
+
const size = props.size ?? 120;
|
|
145
|
+
const strokeWidth = props.thickness ?? 10;
|
|
146
|
+
const radius = (size - strokeWidth) / 2;
|
|
147
|
+
const circumference = 2 * Math.PI * radius;
|
|
148
|
+
|
|
149
|
+
const animatedCircleProps = useAnimatedProps(() => ({
|
|
150
|
+
strokeDashoffset: circumference * (1 - progress.value / 100),
|
|
151
|
+
}));
|
|
152
|
+
const animatedFillStyle = useAnimatedStyle(() => ({
|
|
153
|
+
width: `${progress.value}%`,
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
const containerStyle = {
|
|
157
|
+
alignSelf: props.alignSelf,
|
|
158
|
+
flex: props.flex,
|
|
159
|
+
flexShrink: props.flexShrink,
|
|
160
|
+
flexGrow: props.flexGrow,
|
|
161
|
+
width: dim(props.width),
|
|
162
|
+
height: dim(props.height),
|
|
163
|
+
minWidth: props.minWidth,
|
|
164
|
+
maxWidth: props.maxWidth,
|
|
165
|
+
minHeight: props.minHeight,
|
|
166
|
+
maxHeight: props.maxHeight,
|
|
167
|
+
opacity: props.opacity,
|
|
168
|
+
margin: props.margin,
|
|
169
|
+
marginHorizontal: props.marginHorizontal,
|
|
170
|
+
marginVertical: props.marginVertical,
|
|
171
|
+
padding: props.padding,
|
|
172
|
+
paddingHorizontal: props.paddingHorizontal,
|
|
173
|
+
paddingVertical: props.paddingVertical,
|
|
174
|
+
} as const;
|
|
175
|
+
|
|
176
|
+
if (variant === "circular") {
|
|
177
|
+
return (
|
|
178
|
+
<View style={[containerStyle, { width: size, height: size, alignItems: "center", justifyContent: "center" }]}>
|
|
179
|
+
<Svg width={size} height={size}>
|
|
180
|
+
<Circle
|
|
181
|
+
cx={size / 2}
|
|
182
|
+
cy={size / 2}
|
|
183
|
+
r={radius}
|
|
184
|
+
stroke={trackColor}
|
|
185
|
+
strokeWidth={strokeWidth}
|
|
186
|
+
fill="none"
|
|
187
|
+
/>
|
|
188
|
+
<AnimatedCircle
|
|
189
|
+
cx={size / 2}
|
|
190
|
+
cy={size / 2}
|
|
191
|
+
r={radius}
|
|
192
|
+
stroke={color}
|
|
193
|
+
strokeWidth={strokeWidth}
|
|
194
|
+
fill="none"
|
|
195
|
+
strokeDasharray={circumference}
|
|
196
|
+
animatedProps={animatedCircleProps}
|
|
197
|
+
strokeLinecap="round"
|
|
198
|
+
rotation="-90"
|
|
199
|
+
origin={`${size / 2}, ${size / 2}`}
|
|
200
|
+
/>
|
|
201
|
+
</Svg>
|
|
202
|
+
{props.showLabel ? (
|
|
203
|
+
<View style={{ position: "absolute", alignItems: "center", justifyContent: "center" }}>
|
|
204
|
+
<Text
|
|
205
|
+
style={{
|
|
206
|
+
color: labelColor,
|
|
207
|
+
fontSize: theme.typography.textStyles.heading2.fontSize,
|
|
208
|
+
fontWeight: theme.typography.fontWeight.bold,
|
|
209
|
+
fontFamily: theme.typography.textStyles.heading2.fontFamily,
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
{percentage}%
|
|
213
|
+
</Text>
|
|
214
|
+
</View>
|
|
215
|
+
) : null}
|
|
216
|
+
</View>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Linear variant
|
|
221
|
+
const barHeight = props.thickness ?? 8;
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<View style={[containerStyle, { width: dim(props.width) ?? "100%", flexDirection: "row", alignItems: "center" }]}>
|
|
225
|
+
<View
|
|
226
|
+
style={{
|
|
227
|
+
flex: 1,
|
|
228
|
+
height: barHeight,
|
|
229
|
+
backgroundColor: trackColor,
|
|
230
|
+
borderRadius: props.borderRadius ?? barHeight / 2,
|
|
231
|
+
overflow: "hidden",
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
<Animated.View
|
|
235
|
+
style={[
|
|
236
|
+
{ height: "100%", backgroundColor: color, borderRadius: props.borderRadius ?? barHeight / 2 },
|
|
237
|
+
animatedFillStyle,
|
|
238
|
+
]}
|
|
239
|
+
/>
|
|
240
|
+
</View>
|
|
241
|
+
{props.showLabel ? (
|
|
242
|
+
<Text
|
|
243
|
+
style={{
|
|
244
|
+
marginLeft: 12,
|
|
245
|
+
color: labelColor,
|
|
246
|
+
fontSize: theme.typography.textStyles.label.fontSize,
|
|
247
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
248
|
+
fontFamily: theme.typography.textStyles.label.fontFamily,
|
|
249
|
+
minWidth: 44,
|
|
250
|
+
textAlign: "right",
|
|
251
|
+
}}
|
|
252
|
+
>
|
|
253
|
+
{percentage}%
|
|
254
|
+
</Text>
|
|
255
|
+
) : null}
|
|
256
|
+
</View>
|
|
257
|
+
);
|
|
258
|
+
};
|
|
@@ -7,8 +7,36 @@ import { UIElement } from "../types";
|
|
|
7
7
|
import { RenderContext, interpolate, dim, resolveInheritedFontFamily } from "./shared";
|
|
8
8
|
import { GradientBox } from "./GradientBox";
|
|
9
9
|
|
|
10
|
+
export type TextSpan = {
|
|
11
|
+
text: string;
|
|
12
|
+
fontWeight?: string;
|
|
13
|
+
fontStyle?: "normal" | "italic";
|
|
14
|
+
fontFamily?: string | "inherit";
|
|
15
|
+
fontSize?: number;
|
|
16
|
+
letterSpacing?: number;
|
|
17
|
+
color?: string;
|
|
18
|
+
textDecorationLine?:
|
|
19
|
+
| "none"
|
|
20
|
+
| "underline"
|
|
21
|
+
| "line-through"
|
|
22
|
+
| "underline line-through";
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const TextSpanSchema = z.object({
|
|
26
|
+
text: z.string(),
|
|
27
|
+
fontWeight: z.string().optional(),
|
|
28
|
+
fontStyle: z.enum(["normal", "italic"]).optional(),
|
|
29
|
+
fontFamily: z.string().optional(),
|
|
30
|
+
fontSize: z.number().optional(),
|
|
31
|
+
letterSpacing: z.number().optional(),
|
|
32
|
+
color: z.string().optional(),
|
|
33
|
+
textDecorationLine: z
|
|
34
|
+
.enum(["none", "underline", "line-through", "underline line-through"])
|
|
35
|
+
.optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
10
38
|
export type TextElementProps = BaseBoxProps & {
|
|
11
|
-
content: string;
|
|
39
|
+
content: string | TextSpan[];
|
|
12
40
|
mode?: "plain" | "expression";
|
|
13
41
|
fontSize?: number;
|
|
14
42
|
fontWeight?: string;
|
|
@@ -21,7 +49,7 @@ export type TextElementProps = BaseBoxProps & {
|
|
|
21
49
|
};
|
|
22
50
|
|
|
23
51
|
export const TextElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
24
|
-
content: z.string(),
|
|
52
|
+
content: z.union([z.string(), z.array(TextSpanSchema)]),
|
|
25
53
|
mode: z.enum(["plain", "expression"]).optional(),
|
|
26
54
|
fontSize: z.number().optional(),
|
|
27
55
|
fontWeight: z.string().optional(),
|
|
@@ -33,6 +61,40 @@ export const TextElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
|
33
61
|
lineHeight: z.number().optional(),
|
|
34
62
|
});
|
|
35
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Renders one inline span. Isolated as its own component so the
|
|
66
|
+
* `useResolvedFontStyle` hook is called once per stable component instance —
|
|
67
|
+
* calling the hook in a `.map` loop inside the parent would break rules of
|
|
68
|
+
* hooks when the span count changes.
|
|
69
|
+
*/
|
|
70
|
+
const RichTextSpan = ({
|
|
71
|
+
span,
|
|
72
|
+
baseFontFamily,
|
|
73
|
+
}: {
|
|
74
|
+
span: TextSpan;
|
|
75
|
+
baseFontFamily: string | undefined;
|
|
76
|
+
}): React.ReactElement => {
|
|
77
|
+
const fontFamily = resolveInheritedFontFamily(span.fontFamily, baseFontFamily);
|
|
78
|
+
const resolved = useResolvedFontStyle(fontFamily, span.fontWeight);
|
|
79
|
+
return (
|
|
80
|
+
<Text
|
|
81
|
+
style={{
|
|
82
|
+
fontFamily: resolved.fontFamily,
|
|
83
|
+
fontWeight: resolved.resolvedToVariant
|
|
84
|
+
? undefined
|
|
85
|
+
: (span.fontWeight as any),
|
|
86
|
+
fontStyle: span.fontStyle,
|
|
87
|
+
fontSize: span.fontSize,
|
|
88
|
+
letterSpacing: span.letterSpacing,
|
|
89
|
+
color: span.color,
|
|
90
|
+
textDecorationLine: span.textDecorationLine,
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
{span.text}
|
|
94
|
+
</Text>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
36
98
|
type TextUIElement = Extract<UIElement, { type: "Text" }>;
|
|
37
99
|
|
|
38
100
|
type Props = {
|
|
@@ -44,8 +106,12 @@ type Props = {
|
|
|
44
106
|
export const TextElementComponent = ({ element, ctx, parentType }: Props): React.ReactElement => {
|
|
45
107
|
const { theme, variables } = ctx;
|
|
46
108
|
const p = element.props;
|
|
47
|
-
const
|
|
48
|
-
|
|
109
|
+
const isExpression = p.mode === "expression";
|
|
110
|
+
const content: string | TextSpan[] = Array.isArray(p.content)
|
|
111
|
+
? isExpression
|
|
112
|
+
? p.content.map((s) => ({ ...s, text: interpolate(s.text, variables) }))
|
|
113
|
+
: p.content
|
|
114
|
+
: isExpression
|
|
49
115
|
? interpolate(p.content, variables)
|
|
50
116
|
: p.content;
|
|
51
117
|
const inheritedFontFamily = resolveInheritedFontFamily(
|
|
@@ -88,7 +154,11 @@ export const TextElementComponent = ({ element, ctx, parentType }: Props): React
|
|
|
88
154
|
opacity: p.backgroundGradient ? undefined : p.opacity,
|
|
89
155
|
}}
|
|
90
156
|
>
|
|
91
|
-
{content
|
|
157
|
+
{typeof content === "string"
|
|
158
|
+
? content
|
|
159
|
+
: content.map((s, i) => (
|
|
160
|
+
<RichTextSpan key={i} span={s} baseFontFamily={inheritedFontFamily} />
|
|
161
|
+
))}
|
|
92
162
|
</Text>
|
|
93
163
|
);
|
|
94
164
|
|
|
@@ -20,6 +20,7 @@ import { ZStackElementComponent } from "./ZStackElement";
|
|
|
20
20
|
import { SafeAreaViewElementComponent } from "./SafeAreaViewElement";
|
|
21
21
|
import { ScrollViewElementComponent } from "./ScrollViewElement";
|
|
22
22
|
import { KeyboardAvoidingViewElementComponent } from "./KeyboardAvoidingViewElement";
|
|
23
|
+
import { ProgressIndicatorElementComponent } from "./ProgressIndicatorElement";
|
|
23
24
|
|
|
24
25
|
export const renderElement = (
|
|
25
26
|
element: UIElement,
|
|
@@ -105,5 +106,9 @@ export const renderElement = (
|
|
|
105
106
|
return <KeyboardAvoidingViewElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
if (element.type === "ProgressIndicator") {
|
|
110
|
+
return <ProgressIndicatorElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
111
|
+
}
|
|
112
|
+
|
|
108
113
|
return null;
|
|
109
114
|
};
|
|
@@ -28,6 +28,10 @@ import {
|
|
|
28
28
|
type KeyboardAvoidingViewElementProps,
|
|
29
29
|
KeyboardAvoidingViewElementPropsSchema,
|
|
30
30
|
} from "./elements/KeyboardAvoidingViewElement";
|
|
31
|
+
import {
|
|
32
|
+
type ProgressIndicatorElementProps,
|
|
33
|
+
ProgressIndicatorElementPropsSchema,
|
|
34
|
+
} from "./elements/ProgressIndicatorElement";
|
|
31
35
|
|
|
32
36
|
export type { BaseBoxProps } from "./elements/BaseBoxProps";
|
|
33
37
|
export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
|
|
@@ -52,6 +56,7 @@ export type {
|
|
|
52
56
|
KeyboardAvoidingViewElementProps,
|
|
53
57
|
KeyboardAvoidingBehavior,
|
|
54
58
|
} from "./elements/KeyboardAvoidingViewElement";
|
|
59
|
+
export type { ProgressIndicatorElementProps, ProgressEasing } from "./elements/ProgressIndicatorElement";
|
|
55
60
|
|
|
56
61
|
// UIElement union — must live here (not in elements/) to avoid circular deps
|
|
57
62
|
// because the Stack variant's children: UIElement[] references itself.
|
|
@@ -187,6 +192,13 @@ export type UIElement =
|
|
|
187
192
|
type: "KeyboardAvoidingView";
|
|
188
193
|
props: KeyboardAvoidingViewElementProps;
|
|
189
194
|
children: UIElement[];
|
|
195
|
+
}
|
|
196
|
+
| {
|
|
197
|
+
id: string;
|
|
198
|
+
name?: string;
|
|
199
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
200
|
+
type: "ProgressIndicator";
|
|
201
|
+
props: ProgressIndicatorElementProps;
|
|
190
202
|
};
|
|
191
203
|
|
|
192
204
|
export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
@@ -323,6 +335,13 @@ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
323
335
|
props: KeyboardAvoidingViewElementPropsSchema,
|
|
324
336
|
children: z.array(UIElementSchema),
|
|
325
337
|
}),
|
|
338
|
+
z.object({
|
|
339
|
+
id: z.string(),
|
|
340
|
+
name: z.string().optional(),
|
|
341
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
342
|
+
type: z.literal("ProgressIndicator"),
|
|
343
|
+
props: ProgressIndicatorElementPropsSchema,
|
|
344
|
+
}),
|
|
326
345
|
])
|
|
327
346
|
);
|
|
328
347
|
|