@rocapine/react-native-onboarding-ui 1.8.1 → 1.10.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/CheckboxGroupElement.d.ts +86 -0
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js +143 -0
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +68 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js +120 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js.map +1 -0
- 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/types.d.ts +14 -0
- package/dist/UI/Pages/ComposableScreen/types.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/types.js +14 -0
- package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
- package/package.json +7 -2
- package/src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx +200 -0
- package/src/UI/Pages/ComposableScreen/elements/DatePickerElement.tsx +172 -0
- package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +10 -0
- package/src/UI/Pages/ComposableScreen/types.ts +28 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseBoxProps } from "./BaseBoxProps";
|
|
4
|
+
import type { UIElement } from "../types";
|
|
5
|
+
import type { RenderContext } from "./shared";
|
|
6
|
+
export type CheckboxGroupElementProps = BaseBoxProps & {
|
|
7
|
+
variableName?: string;
|
|
8
|
+
defaultValues?: string[];
|
|
9
|
+
gap?: number;
|
|
10
|
+
direction?: "vertical" | "horizontal";
|
|
11
|
+
items: Array<{
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}>;
|
|
15
|
+
itemBackgroundColor?: string;
|
|
16
|
+
itemSelectedBackgroundColor?: string;
|
|
17
|
+
itemBorderColor?: string;
|
|
18
|
+
itemSelectedBorderColor?: string;
|
|
19
|
+
itemBorderRadius?: number;
|
|
20
|
+
itemBorderWidth?: number;
|
|
21
|
+
itemColor?: string;
|
|
22
|
+
itemSelectedColor?: string;
|
|
23
|
+
itemFontSize?: number;
|
|
24
|
+
itemFontWeight?: string;
|
|
25
|
+
itemFontFamily?: string;
|
|
26
|
+
itemPadding?: number;
|
|
27
|
+
itemPaddingHorizontal?: number;
|
|
28
|
+
itemPaddingVertical?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const CheckboxGroupElementPropsSchema: z.ZodObject<{
|
|
31
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
auto: "auto";
|
|
35
|
+
center: "center";
|
|
36
|
+
"flex-start": "flex-start";
|
|
37
|
+
"flex-end": "flex-end";
|
|
38
|
+
stretch: "stretch";
|
|
39
|
+
baseline: "baseline";
|
|
40
|
+
}>>;
|
|
41
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
marginHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
marginVertical: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
paddingHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
paddingVertical: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
borderWidth: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
51
|
+
variableName: z.ZodOptional<z.ZodString>;
|
|
52
|
+
defaultValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
gap: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
horizontal: "horizontal";
|
|
56
|
+
vertical: "vertical";
|
|
57
|
+
}>>;
|
|
58
|
+
items: z.ZodArray<z.ZodObject<{
|
|
59
|
+
label: z.ZodString;
|
|
60
|
+
value: z.ZodString;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
itemBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
63
|
+
itemSelectedBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
64
|
+
itemBorderColor: z.ZodOptional<z.ZodString>;
|
|
65
|
+
itemSelectedBorderColor: z.ZodOptional<z.ZodString>;
|
|
66
|
+
itemBorderRadius: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
itemBorderWidth: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
itemColor: z.ZodOptional<z.ZodString>;
|
|
69
|
+
itemSelectedColor: z.ZodOptional<z.ZodString>;
|
|
70
|
+
itemFontSize: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
itemFontWeight: z.ZodOptional<z.ZodString>;
|
|
72
|
+
itemFontFamily: z.ZodOptional<z.ZodString>;
|
|
73
|
+
itemPadding: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
itemPaddingHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
itemPaddingVertical: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
type CheckboxGroupUIElement = Extract<UIElement, {
|
|
78
|
+
type: "CheckboxGroup";
|
|
79
|
+
}>;
|
|
80
|
+
type Props = {
|
|
81
|
+
element: CheckboxGroupUIElement;
|
|
82
|
+
ctx: RenderContext;
|
|
83
|
+
};
|
|
84
|
+
export declare const CheckboxGroupComponent: ({ element, ctx }: Props) => React.ReactElement;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=CheckboxGroupElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxGroupElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC1C,CAAC;AAEH,KAAK,sBAAsB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC,CAAC;AAE5E,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,sBAAsB,CAAC;IAChC,GAAG,EAAE,aAAa,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,KAAK,KAAG,KAAK,CAAC,YAgItE,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckboxGroupComponent = exports.CheckboxGroupElementPropsSchema = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const BaseBoxProps_1 = require("./BaseBoxProps");
|
|
9
|
+
exports.CheckboxGroupElementPropsSchema = BaseBoxProps_1.BaseBoxPropsSchema.extend({
|
|
10
|
+
variableName: zod_1.z.string().optional(),
|
|
11
|
+
defaultValues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
12
|
+
gap: zod_1.z.number().optional(),
|
|
13
|
+
direction: zod_1.z.enum(["vertical", "horizontal"]).optional(),
|
|
14
|
+
items: zod_1.z.array(zod_1.z.object({ label: zod_1.z.string().trim().min(1, "item label must not be empty"), value: zod_1.z.string().trim().min(1, "item value must not be empty") })).min(1, "items must not be empty"),
|
|
15
|
+
itemBackgroundColor: zod_1.z.string().optional(),
|
|
16
|
+
itemSelectedBackgroundColor: zod_1.z.string().optional(),
|
|
17
|
+
itemBorderColor: zod_1.z.string().optional(),
|
|
18
|
+
itemSelectedBorderColor: zod_1.z.string().optional(),
|
|
19
|
+
itemBorderRadius: zod_1.z.number().optional(),
|
|
20
|
+
itemBorderWidth: zod_1.z.number().optional(),
|
|
21
|
+
itemColor: zod_1.z.string().optional(),
|
|
22
|
+
itemSelectedColor: zod_1.z.string().optional(),
|
|
23
|
+
itemFontSize: zod_1.z.number().optional(),
|
|
24
|
+
itemFontWeight: zod_1.z.string().optional(),
|
|
25
|
+
itemFontFamily: zod_1.z.string().optional(),
|
|
26
|
+
itemPadding: zod_1.z.number().optional(),
|
|
27
|
+
itemPaddingHorizontal: zod_1.z.number().optional(),
|
|
28
|
+
itemPaddingVertical: zod_1.z.number().optional(),
|
|
29
|
+
}).superRefine((data, ctx) => {
|
|
30
|
+
const values = data.items.map((i) => i.value);
|
|
31
|
+
const unique = new Set(values);
|
|
32
|
+
if (unique.size !== values.length) {
|
|
33
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: "item values must be unique", path: ["items"] });
|
|
34
|
+
}
|
|
35
|
+
if (data.defaultValues !== undefined) {
|
|
36
|
+
data.defaultValues.forEach((dv, i) => {
|
|
37
|
+
if (!unique.has(dv)) {
|
|
38
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: `defaultValues entry "${dv}" must match one of the item values`, path: ["defaultValues", i] });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const CheckboxGroupComponent = ({ element, ctx }) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const { theme, variables, setVariable } = ctx;
|
|
46
|
+
// The variable stores a JSON-serialised string[] to stay compatible with the string-based variable system.
|
|
47
|
+
const rawValue = element.props.variableName ? (_a = variables[element.props.variableName]) === null || _a === void 0 ? void 0 : _a.value : undefined;
|
|
48
|
+
const selectedValues = (() => {
|
|
49
|
+
if (typeof rawValue !== "string")
|
|
50
|
+
return undefined;
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(rawValue);
|
|
53
|
+
}
|
|
54
|
+
catch (_a) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
(0, react_1.useEffect)(() => {
|
|
59
|
+
if (element.props.variableName && element.props.defaultValues && selectedValues === undefined) {
|
|
60
|
+
const defaultLabels = element.props.defaultValues.map((dv) => { var _a, _b; return (_b = (_a = element.props.items.find((i) => i.value === dv)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : dv; });
|
|
61
|
+
setVariable(element.props.variableName, {
|
|
62
|
+
value: JSON.stringify(element.props.defaultValues),
|
|
63
|
+
label: defaultLabels.join(", "),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, [element.props.variableName, element.props.defaultValues, element.props.items, selectedValues]);
|
|
67
|
+
const handleToggle = (value, label) => {
|
|
68
|
+
if (!element.props.variableName)
|
|
69
|
+
return;
|
|
70
|
+
const current = selectedValues !== null && selectedValues !== void 0 ? selectedValues : [];
|
|
71
|
+
const next = current.includes(value) ? current.filter((v) => v !== value) : [...current, value];
|
|
72
|
+
const nextLabels = next.map((v) => { var _a, _b; return (_b = (_a = element.props.items.find((i) => i.value === v)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : v; });
|
|
73
|
+
setVariable(element.props.variableName, {
|
|
74
|
+
value: JSON.stringify(next),
|
|
75
|
+
label: nextLabels.join(", "),
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const isHorizontal = element.props.direction === "horizontal";
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityRole: "list", style: {
|
|
80
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
81
|
+
flexWrap: isHorizontal ? "wrap" : undefined,
|
|
82
|
+
alignSelf: element.props.alignSelf,
|
|
83
|
+
gap: (_b = element.props.gap) !== null && _b !== void 0 ? _b : 8,
|
|
84
|
+
width: element.props.width,
|
|
85
|
+
height: element.props.height,
|
|
86
|
+
margin: element.props.margin,
|
|
87
|
+
marginHorizontal: element.props.marginHorizontal,
|
|
88
|
+
marginVertical: element.props.marginVertical,
|
|
89
|
+
padding: element.props.padding,
|
|
90
|
+
paddingHorizontal: element.props.paddingHorizontal,
|
|
91
|
+
paddingVertical: element.props.paddingVertical,
|
|
92
|
+
borderWidth: element.props.borderWidth,
|
|
93
|
+
borderRadius: element.props.borderRadius,
|
|
94
|
+
borderColor: element.props.borderColor,
|
|
95
|
+
opacity: element.props.opacity,
|
|
96
|
+
}, children: element.props.items.map((item) => {
|
|
97
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
98
|
+
const isSelected = (selectedValues !== null && selectedValues !== void 0 ? selectedValues : []).includes(item.value);
|
|
99
|
+
const bgColor = isSelected
|
|
100
|
+
? ((_a = element.props.itemSelectedBackgroundColor) !== null && _a !== void 0 ? _a : (theme.colors.primary.startsWith("#") ? theme.colors.primary + "1A" : theme.colors.primary))
|
|
101
|
+
: ((_b = element.props.itemBackgroundColor) !== null && _b !== void 0 ? _b : "transparent");
|
|
102
|
+
const textColor = isSelected
|
|
103
|
+
? ((_c = element.props.itemSelectedColor) !== null && _c !== void 0 ? _c : theme.colors.primary)
|
|
104
|
+
: ((_d = element.props.itemColor) !== null && _d !== void 0 ? _d : theme.colors.text.primary);
|
|
105
|
+
const borderColor = isSelected
|
|
106
|
+
? ((_e = element.props.itemSelectedBorderColor) !== null && _e !== void 0 ? _e : theme.colors.primary)
|
|
107
|
+
: ((_f = element.props.itemBorderColor) !== null && _f !== void 0 ? _f : theme.colors.neutral.low);
|
|
108
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.TouchableOpacity, { activeOpacity: 0.7, onPress: () => handleToggle(item.value, item.label), accessibilityRole: "checkbox", accessibilityState: { checked: isSelected }, accessibilityLabel: item.label, style: {
|
|
109
|
+
flexDirection: "row",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
gap: 12,
|
|
112
|
+
backgroundColor: bgColor,
|
|
113
|
+
borderRadius: (_g = element.props.itemBorderRadius) !== null && _g !== void 0 ? _g : 8,
|
|
114
|
+
borderWidth: (_h = element.props.itemBorderWidth) !== null && _h !== void 0 ? _h : 1,
|
|
115
|
+
borderColor: borderColor,
|
|
116
|
+
padding: (_j = element.props.itemPadding) !== null && _j !== void 0 ? _j : (element.props.itemPaddingHorizontal === undefined && element.props.itemPaddingVertical === undefined ? 12 : undefined),
|
|
117
|
+
paddingHorizontal: element.props.itemPaddingHorizontal,
|
|
118
|
+
paddingVertical: element.props.itemPaddingVertical,
|
|
119
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
120
|
+
width: 20,
|
|
121
|
+
height: 20,
|
|
122
|
+
borderRadius: 4,
|
|
123
|
+
borderWidth: 2,
|
|
124
|
+
borderColor: isSelected ? theme.colors.primary : theme.colors.neutral.medium,
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
justifyContent: "center",
|
|
127
|
+
backgroundColor: isSelected ? theme.colors.primary : "transparent",
|
|
128
|
+
}, children: isSelected && ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
129
|
+
color: "#fff",
|
|
130
|
+
fontSize: 12,
|
|
131
|
+
fontWeight: "700",
|
|
132
|
+
lineHeight: 14,
|
|
133
|
+
}, children: "\u2713" })) }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
134
|
+
flexShrink: 1,
|
|
135
|
+
color: textColor,
|
|
136
|
+
fontSize: (_k = element.props.itemFontSize) !== null && _k !== void 0 ? _k : theme.typography.textStyles.body.fontSize,
|
|
137
|
+
fontWeight: (_l = element.props.itemFontWeight) !== null && _l !== void 0 ? _l : theme.typography.textStyles.body.fontWeight,
|
|
138
|
+
fontFamily: element.props.itemFontFamily,
|
|
139
|
+
}, children: item.label })] }, item.value));
|
|
140
|
+
}) }));
|
|
141
|
+
};
|
|
142
|
+
exports.CheckboxGroupComponent = CheckboxGroupComponent;
|
|
143
|
+
//# sourceMappingURL=CheckboxGroupElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxGroupElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx"],"names":[],"mappings":";;;;AAAA,iCAAyC;AACzC,6BAAwB;AACxB,+CAA4D;AAC5D,iDAAkE;AA0BrD,QAAA,+BAA+B,GAAG,iCAAkB,CAAC,MAAM,CAAC;IACvE,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,aAAa,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC7C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxD,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,8BAA8B,CAAC,EAAE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,8BAA8B,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC;IAChM,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,2BAA2B,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClD,eAAe,EAA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AC,CAAC,aAAa;yBACnE,YAEA,UAAU,IAAI,CACb,uBAAC,mBAAI,IACH,KAAK,EAAE;gCACL,KAAK,EAAE,MAAM;gCACb,QAAQ,EAAE,EAAE;gCACZ,UAAU,EAAE,KAAK;gCACjB,UAAU,EAAE,EAAE;6BACf,uBAGI,CACR,GACI,EACP,uBAAC,mBAAI,IACH,KAAK,EAAE;4BACL,UAAU,EAAE,CAAC;4BACb,KAAK,EAAE,SAAS;4BAChB,QAAQ,EAAE,MAAA,OAAO,CAAC,KAAK,CAAC,YAAY,mCAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;4BACjF,UAAU,EAAE,MAAC,OAAO,CAAC,KAAK,CAAC,cAAsB,mCAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU;4BAChG,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc;yBACzC,YAEA,IAAI,CAAC,KAAK,GACN,KAtDF,IAAI,CAAC,KAAK,CAuDE,CACpB,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAhIW,QAAA,sBAAsB,0BAgIjC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BaseBoxProps } from "./BaseBoxProps";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { UIElement } from "../types";
|
|
5
|
+
import type { RenderContext } from "./shared";
|
|
6
|
+
export type DatePickerElementProps = BaseBoxProps & {
|
|
7
|
+
variableName?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
minimumDate?: string;
|
|
10
|
+
maximumDate?: string;
|
|
11
|
+
mode?: "date" | "time" | "datetime";
|
|
12
|
+
display?: "default" | "spinner" | "calendar" | "clock" | "compact" | "inline";
|
|
13
|
+
textColor?: string;
|
|
14
|
+
accentColor?: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const DatePickerElementPropsSchema: z.ZodObject<{
|
|
18
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
auto: "auto";
|
|
22
|
+
center: "center";
|
|
23
|
+
"flex-start": "flex-start";
|
|
24
|
+
"flex-end": "flex-end";
|
|
25
|
+
stretch: "stretch";
|
|
26
|
+
baseline: "baseline";
|
|
27
|
+
}>>;
|
|
28
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
marginHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
marginVertical: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
paddingHorizontal: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
paddingVertical: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
borderWidth: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
38
|
+
variableName: z.ZodOptional<z.ZodString>;
|
|
39
|
+
defaultValue: z.ZodOptional<z.ZodString>;
|
|
40
|
+
minimumDate: z.ZodOptional<z.ZodString>;
|
|
41
|
+
maximumDate: z.ZodOptional<z.ZodString>;
|
|
42
|
+
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
date: "date";
|
|
44
|
+
time: "time";
|
|
45
|
+
datetime: "datetime";
|
|
46
|
+
}>>>;
|
|
47
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
default: "default";
|
|
49
|
+
spinner: "spinner";
|
|
50
|
+
calendar: "calendar";
|
|
51
|
+
clock: "clock";
|
|
52
|
+
compact: "compact";
|
|
53
|
+
inline: "inline";
|
|
54
|
+
}>>;
|
|
55
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
56
|
+
accentColor: z.ZodOptional<z.ZodString>;
|
|
57
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
type DatePickerUIElement = Extract<UIElement, {
|
|
60
|
+
type: "DatePicker";
|
|
61
|
+
}>;
|
|
62
|
+
type Props = {
|
|
63
|
+
element: DatePickerUIElement;
|
|
64
|
+
ctx: RenderContext;
|
|
65
|
+
};
|
|
66
|
+
export declare const DatePickerElementComponent: ({ element, ctx }: Props) => React.ReactElement;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=DatePickerElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerElement.d.ts","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/DatePickerElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUvC,CAAC;AAEH,KAAK,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;AAEtE,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,mBAAmB,CAAC;IAC7B,GAAG,EAAE,aAAa,CAAC;CACpB,CAAC;AAYF,eAAO,MAAM,0BAA0B,GAAI,kBAAkB,KAAK,KAAG,KAAK,CAAC,YA0H1E,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DatePickerElementComponent = exports.DatePickerElementPropsSchema = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_native_1 = require("react-native");
|
|
10
|
+
const datetimepicker_1 = __importDefault(require("@react-native-community/datetimepicker"));
|
|
11
|
+
const BaseBoxProps_1 = require("./BaseBoxProps");
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
exports.DatePickerElementPropsSchema = BaseBoxProps_1.BaseBoxPropsSchema.extend({
|
|
14
|
+
variableName: zod_1.z.string().min(1).optional(),
|
|
15
|
+
defaultValue: zod_1.z.string().refine((s) => !isNaN(Date.parse(s)), { message: "Invalid date string" }).optional(),
|
|
16
|
+
minimumDate: zod_1.z.string().refine((s) => !isNaN(Date.parse(s)), { message: "Invalid date string" }).optional(),
|
|
17
|
+
maximumDate: zod_1.z.string().refine((s) => !isNaN(Date.parse(s)), { message: "Invalid date string" }).optional(),
|
|
18
|
+
mode: zod_1.z.enum(["date", "time", "datetime"]).optional().default("date"),
|
|
19
|
+
display: zod_1.z.enum(["default", "spinner", "calendar", "clock", "compact", "inline"]).optional(),
|
|
20
|
+
textColor: zod_1.z.string().optional(),
|
|
21
|
+
accentColor: zod_1.z.string().optional(),
|
|
22
|
+
locale: zod_1.z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
function formatDate(date, mode) {
|
|
25
|
+
if (mode === "time") {
|
|
26
|
+
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
27
|
+
}
|
|
28
|
+
if (mode === "datetime") {
|
|
29
|
+
return date.toLocaleString([], { dateStyle: "medium", timeStyle: "short" });
|
|
30
|
+
}
|
|
31
|
+
return date.toLocaleDateString([], { dateStyle: "medium" });
|
|
32
|
+
}
|
|
33
|
+
const DatePickerElementComponent = ({ element, ctx }) => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
35
|
+
const { theme, variables, setVariable } = ctx;
|
|
36
|
+
const { props } = element;
|
|
37
|
+
const persistedValue = props.variableName ? (_a = variables[props.variableName]) === null || _a === void 0 ? void 0 : _a.value : undefined;
|
|
38
|
+
const initialDate = persistedValue
|
|
39
|
+
? new Date(persistedValue)
|
|
40
|
+
: props.defaultValue
|
|
41
|
+
? new Date(props.defaultValue)
|
|
42
|
+
: new Date();
|
|
43
|
+
const [date, setDate] = (0, react_1.useState)(initialDate);
|
|
44
|
+
const [isPickerVisible, setPickerVisible] = (0, react_1.useState)(false);
|
|
45
|
+
const mode = (_b = props.mode) !== null && _b !== void 0 ? _b : "date";
|
|
46
|
+
// Tracks which variableName has been seeded so re-renders don't clobber a
|
|
47
|
+
// persisted value that arrived after the first render.
|
|
48
|
+
const seededVariableRef = (0, react_1.useRef)(undefined);
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
if (props.variableName &&
|
|
51
|
+
persistedValue === undefined &&
|
|
52
|
+
seededVariableRef.current !== props.variableName) {
|
|
53
|
+
seededVariableRef.current = props.variableName;
|
|
54
|
+
setVariable(props.variableName, {
|
|
55
|
+
value: initialDate.toISOString(),
|
|
56
|
+
label: formatDate(initialDate, mode),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}, [props.variableName, persistedValue, initialDate, mode, setVariable]);
|
|
60
|
+
const handleChange = (_event, selected) => {
|
|
61
|
+
if (!selected)
|
|
62
|
+
return;
|
|
63
|
+
setDate(selected);
|
|
64
|
+
if (props.variableName) {
|
|
65
|
+
setVariable(props.variableName, {
|
|
66
|
+
value: selected.toISOString(),
|
|
67
|
+
label: formatDate(selected, mode),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const containerStyle = {
|
|
72
|
+
alignSelf: props.alignSelf,
|
|
73
|
+
width: props.width,
|
|
74
|
+
height: props.height,
|
|
75
|
+
margin: props.margin,
|
|
76
|
+
marginHorizontal: props.marginHorizontal,
|
|
77
|
+
marginVertical: props.marginVertical,
|
|
78
|
+
padding: props.padding,
|
|
79
|
+
paddingHorizontal: props.paddingHorizontal,
|
|
80
|
+
paddingVertical: props.paddingVertical,
|
|
81
|
+
opacity: props.opacity,
|
|
82
|
+
borderWidth: props.borderWidth,
|
|
83
|
+
borderRadius: props.borderRadius,
|
|
84
|
+
borderColor: props.borderColor,
|
|
85
|
+
overflow: "hidden",
|
|
86
|
+
};
|
|
87
|
+
const pickerProps = {
|
|
88
|
+
value: date,
|
|
89
|
+
mode,
|
|
90
|
+
onChange: handleChange,
|
|
91
|
+
minimumDate: props.minimumDate ? new Date(props.minimumDate) : undefined,
|
|
92
|
+
maximumDate: props.maximumDate ? new Date(props.maximumDate) : undefined,
|
|
93
|
+
// Fall back to theme tokens when CMS props are not provided.
|
|
94
|
+
textColor: (_c = props.textColor) !== null && _c !== void 0 ? _c : theme.colors.text.primary,
|
|
95
|
+
accentColor: (_d = props.accentColor) !== null && _d !== void 0 ? _d : theme.colors.primary,
|
|
96
|
+
locale: props.locale,
|
|
97
|
+
};
|
|
98
|
+
if (react_native_1.Platform.OS === "android") {
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: containerStyle, children: [(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { onPress: () => setPickerVisible(true), style: {
|
|
100
|
+
flexDirection: "row",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
justifyContent: "space-between",
|
|
103
|
+
paddingVertical: 12,
|
|
104
|
+
paddingHorizontal: 16,
|
|
105
|
+
borderRadius: (_e = props.borderRadius) !== null && _e !== void 0 ? _e : 8,
|
|
106
|
+
borderWidth: (_f = props.borderWidth) !== null && _f !== void 0 ? _f : 1,
|
|
107
|
+
borderColor: (_g = props.borderColor) !== null && _g !== void 0 ? _g : theme.colors.neutral.low,
|
|
108
|
+
backgroundColor: theme.colors.neutral.lowest,
|
|
109
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
|
|
110
|
+
color: (_h = props.textColor) !== null && _h !== void 0 ? _h : theme.colors.text.primary,
|
|
111
|
+
fontSize: theme.typography.textStyles.body.fontSize,
|
|
112
|
+
}, children: formatDate(date, mode) }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: { color: theme.colors.text.tertiary, fontSize: 16 }, children: "\u203A" })] }), isPickerVisible && ((0, jsx_runtime_1.jsx)(datetimepicker_1.default, Object.assign({}, pickerProps, { display: ((_j = props.display) !== null && _j !== void 0 ? _j : "default"), onChange: (event, selected) => {
|
|
113
|
+
setPickerVisible(false);
|
|
114
|
+
handleChange(event, selected);
|
|
115
|
+
} })))] }));
|
|
116
|
+
}
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: containerStyle, children: (0, jsx_runtime_1.jsx)(datetimepicker_1.default, Object.assign({}, pickerProps, { display: ((_k = props.display) !== null && _k !== void 0 ? _k : "spinner") })) }));
|
|
118
|
+
};
|
|
119
|
+
exports.DatePickerElementComponent = DatePickerElementComponent;
|
|
120
|
+
//# sourceMappingURL=DatePickerElement.js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AAC,IACD,CACH,IACI,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,uBAAC,mBAAI,IAAC,KAAK,EAAE,cAAc,YACzB,uBAAC,wBAAc,oBACT,WAAW,IACf,OAAO,EAAE,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,SAAS,CAAQ,IAC5C,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AA1HW,QAAA,0BAA0B,8BA0HrC"}
|
|
@@ -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;AAC1B,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;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAczC,eAAO,MAAM,aAAa,GACxB,SAAS,SAAS,EAClB,KAAK,aAAa,EAClB,aAAa,QAAQ,GAAG,QAAQ,KAC/B,KAAK,CAAC,SAkDR,CAAC"}
|
|
@@ -11,7 +11,9 @@ const IconElement_1 = require("./IconElement");
|
|
|
11
11
|
const VideoElement_1 = require("./VideoElement");
|
|
12
12
|
const InputElement_1 = require("./InputElement");
|
|
13
13
|
const RadioGroupElement_1 = require("./RadioGroupElement");
|
|
14
|
+
const CheckboxGroupElement_1 = require("./CheckboxGroupElement");
|
|
14
15
|
const ButtonElement_1 = require("./ButtonElement");
|
|
16
|
+
const DatePickerElement_1 = require("./DatePickerElement");
|
|
15
17
|
const renderElement = (element, ctx, parentType) => {
|
|
16
18
|
if (element.type === "YStack" || element.type === "XStack") {
|
|
17
19
|
return (0, jsx_runtime_1.jsx)(StackElement_1.StackElementComponent, { element: element, ctx: ctx, parentType: parentType }, element.id);
|
|
@@ -40,9 +42,15 @@ const renderElement = (element, ctx, parentType) => {
|
|
|
40
42
|
if (element.type === "RadioGroup") {
|
|
41
43
|
return (0, jsx_runtime_1.jsx)(RadioGroupElement_1.RadioGroupComponent, { element: element, ctx: ctx }, element.id);
|
|
42
44
|
}
|
|
45
|
+
if (element.type === "CheckboxGroup") {
|
|
46
|
+
return (0, jsx_runtime_1.jsx)(CheckboxGroupElement_1.CheckboxGroupComponent, { element: element, ctx: ctx }, element.id);
|
|
47
|
+
}
|
|
43
48
|
if (element.type === "Button") {
|
|
44
49
|
return (0, jsx_runtime_1.jsx)(ButtonElement_1.ButtonElementComponent, { element: element, ctx: ctx }, element.id);
|
|
45
50
|
}
|
|
51
|
+
if (element.type === "DatePicker") {
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(DatePickerElement_1.DatePickerElementComponent, { element: element, ctx: ctx }, element.id);
|
|
53
|
+
}
|
|
46
54
|
return null;
|
|
47
55
|
};
|
|
48
56
|
exports.renderElement = renderElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":";;;;AAGA,iDAAuD;AACvD,+CAAqD;AACrD,iDAAuD;AACvD,mDAAyD;AACzD,+CAAoD;AACpD,+CAAqD;AACrD,iDAAsD;AACtD,iDAAuD;AACvD,2DAA0D;AAC1D,mDAAyD;
|
|
1
|
+
{"version":3,"file":"renderElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":";;;;AAGA,iDAAuD;AACvD,+CAAqD;AACrD,iDAAuD;AACvD,mDAAyD;AACzD,+CAAoD;AACpD,+CAAqD;AACrD,iDAAsD;AACt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,QAAA,aAAa,iBAsDxB"}
|
|
@@ -9,6 +9,8 @@ import { type VideoElementProps } from "./elements/VideoElement";
|
|
|
9
9
|
import { type InputElementProps } from "./elements/InputElement";
|
|
10
10
|
import { type ButtonElementProps } from "./elements/ButtonElement";
|
|
11
11
|
import { type RadioGroupElementProps } from "./elements/RadioGroupElement";
|
|
12
|
+
import { type CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
|
|
13
|
+
import { type DatePickerElementProps } from "./elements/DatePickerElement";
|
|
12
14
|
export type { BaseBoxProps } from "./elements/BaseBoxProps";
|
|
13
15
|
export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
|
|
14
16
|
export type { StackElementProps } from "./elements/StackElement";
|
|
@@ -21,6 +23,8 @@ export type { VideoElementProps } from "./elements/VideoElement";
|
|
|
21
23
|
export type { InputElementProps } from "./elements/InputElement";
|
|
22
24
|
export type { ButtonElementProps } from "./elements/ButtonElement";
|
|
23
25
|
export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
|
|
26
|
+
export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
|
|
27
|
+
export type { DatePickerElementProps } from "./elements/DatePickerElement";
|
|
24
28
|
export type UIElement = {
|
|
25
29
|
id: string;
|
|
26
30
|
name?: string;
|
|
@@ -72,6 +76,16 @@ export type UIElement = {
|
|
|
72
76
|
name?: string;
|
|
73
77
|
type: "RadioGroup";
|
|
74
78
|
props: RadioGroupElementProps;
|
|
79
|
+
} | {
|
|
80
|
+
id: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
type: "CheckboxGroup";
|
|
83
|
+
props: CheckboxGroupElementProps;
|
|
84
|
+
} | {
|
|
85
|
+
id: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
type: "DatePicker";
|
|
88
|
+
props: DatePickerElementProps;
|
|
75
89
|
};
|
|
76
90
|
export declare const UIElementSchema: z.ZodType<UIElement>;
|
|
77
91
|
export declare const ComposableScreenStepPayloadSchema: z.ZodObject<{
|
|
@@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MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,sBAAsB,CAAC;CAC/B,CAAC;AAEN,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CA4EhD,CAAC;AAEF,eAAO,MAAM,iCAAiC;;iBAE5C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBASzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -13,6 +13,8 @@ const VideoElement_1 = require("./elements/VideoElement");
|
|
|
13
13
|
const InputElement_1 = require("./elements/InputElement");
|
|
14
14
|
const ButtonElement_1 = require("./elements/ButtonElement");
|
|
15
15
|
const RadioGroupElement_1 = require("./elements/RadioGroupElement");
|
|
16
|
+
const CheckboxGroupElement_1 = require("./elements/CheckboxGroupElement");
|
|
17
|
+
const DatePickerElement_1 = require("./elements/DatePickerElement");
|
|
16
18
|
var BaseBoxProps_1 = require("./elements/BaseBoxProps");
|
|
17
19
|
Object.defineProperty(exports, "BaseBoxPropsSchema", { enumerable: true, get: function () { return BaseBoxProps_1.BaseBoxPropsSchema; } });
|
|
18
20
|
exports.UIElementSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
@@ -77,6 +79,18 @@ exports.UIElementSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
|
77
79
|
type: zod_1.z.literal("RadioGroup"),
|
|
78
80
|
props: RadioGroupElement_1.RadioGroupElementPropsSchema,
|
|
79
81
|
}),
|
|
82
|
+
zod_1.z.object({
|
|
83
|
+
id: zod_1.z.string(),
|
|
84
|
+
name: zod_1.z.string().optional(),
|
|
85
|
+
type: zod_1.z.literal("CheckboxGroup"),
|
|
86
|
+
props: CheckboxGroupElement_1.CheckboxGroupElementPropsSchema,
|
|
87
|
+
}),
|
|
88
|
+
zod_1.z.object({
|
|
89
|
+
id: zod_1.z.string(),
|
|
90
|
+
name: zod_1.z.string().optional(),
|
|
91
|
+
type: zod_1.z.literal("DatePicker"),
|
|
92
|
+
props: DatePickerElement_1.DatePickerElementPropsSchema,
|
|
93
|
+
}),
|
|
80
94
|
]));
|
|
81
95
|
exports.ComposableScreenStepPayloadSchema = zod_1.z.object({
|
|
82
96
|
elements: zod_1.z.array(exports.UIElementSchema),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA+C;AAC/C,0DAA0F;AAC1F,wDAAuF;AACvF,0DAA0F;AAC1F,4DAA6F;AAC7F,wDAAuF;AACvF,wDAAuF;AACvF,0DAA0F;AAC1F,0DAA0F;AAC1F,4DAA6F;AAC7F,oEAAyG;AAGzG,wDAA6D;AAApD,kHAAA,kBAAkB,OAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,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;AAGzG,wDAA6D;AAApD,kHAAA,kBAAkB,OAAA;AA2Fd,QAAA,eAAe,GAAyB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC/D,OAAC,CAAC,KAAK,CAAC;IACN,OAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAC,CA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I,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QAC7B,KAAK,EAAE,gDAA4B;KACpC,CAAC;CACH,CAAC,CACH,CAAC;AAEW,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAe,CAAC;CACnC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IACrD,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACnC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE;IAClC,OAAO,EAAE,yCAAiC;IAC1C,aAAa,EAAE,2BAAmB;IAClC,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;IAC9D,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,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.10.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",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"zod": "^4.1.11"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@react-native-community/datetimepicker": "^8.2.0",
|
|
31
32
|
"@react-native-picker/picker": "^2.11.2",
|
|
32
33
|
"@shopify/react-native-skia": "2.4.18",
|
|
33
34
|
"@types/react": "^19.0.0",
|
|
@@ -42,8 +43,9 @@
|
|
|
42
43
|
"typescript": "^5.0.0"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
46
|
+
"@react-native-community/datetimepicker": "*",
|
|
45
47
|
"@react-native-picker/picker": "*",
|
|
46
|
-
"@rocapine/react-native-onboarding": "^1.
|
|
48
|
+
"@rocapine/react-native-onboarding": "^1.10.0",
|
|
47
49
|
"@shopify/react-native-skia": ">=1.0.0",
|
|
48
50
|
"@tanstack/react-query": ">=5.0.0",
|
|
49
51
|
"@types/react": "*",
|
|
@@ -57,6 +59,9 @@
|
|
|
57
59
|
"expo-video": "*"
|
|
58
60
|
},
|
|
59
61
|
"peerDependenciesMeta": {
|
|
62
|
+
"@react-native-community/datetimepicker": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
60
65
|
"@react-native-picker/picker": {
|
|
61
66
|
"optional": true
|
|
62
67
|
},
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { View, Text, TouchableOpacity } from "react-native";
|
|
4
|
+
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
5
|
+
import type { UIElement } from "../types";
|
|
6
|
+
import type { RenderContext } from "./shared";
|
|
7
|
+
|
|
8
|
+
export type CheckboxGroupElementProps = BaseBoxProps & {
|
|
9
|
+
variableName?: string;
|
|
10
|
+
defaultValues?: string[];
|
|
11
|
+
gap?: number;
|
|
12
|
+
direction?: "vertical" | "horizontal";
|
|
13
|
+
items: Array<{ label: string; value: string }>;
|
|
14
|
+
itemBackgroundColor?: string;
|
|
15
|
+
itemSelectedBackgroundColor?: string;
|
|
16
|
+
itemBorderColor?: string;
|
|
17
|
+
itemSelectedBorderColor?: string;
|
|
18
|
+
itemBorderRadius?: number;
|
|
19
|
+
itemBorderWidth?: number;
|
|
20
|
+
itemColor?: string;
|
|
21
|
+
itemSelectedColor?: string;
|
|
22
|
+
itemFontSize?: number;
|
|
23
|
+
itemFontWeight?: string;
|
|
24
|
+
itemFontFamily?: string;
|
|
25
|
+
itemPadding?: number;
|
|
26
|
+
itemPaddingHorizontal?: number;
|
|
27
|
+
itemPaddingVertical?: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const CheckboxGroupElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
31
|
+
variableName: z.string().optional(),
|
|
32
|
+
defaultValues: z.array(z.string()).optional(),
|
|
33
|
+
gap: z.number().optional(),
|
|
34
|
+
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
35
|
+
items: z.array(z.object({ label: z.string().trim().min(1, "item label must not be empty"), value: z.string().trim().min(1, "item value must not be empty") })).min(1, "items must not be empty"),
|
|
36
|
+
itemBackgroundColor: z.string().optional(),
|
|
37
|
+
itemSelectedBackgroundColor: z.string().optional(),
|
|
38
|
+
itemBorderColor: z.string().optional(),
|
|
39
|
+
itemSelectedBorderColor: z.string().optional(),
|
|
40
|
+
itemBorderRadius: z.number().optional(),
|
|
41
|
+
itemBorderWidth: z.number().optional(),
|
|
42
|
+
itemColor: z.string().optional(),
|
|
43
|
+
itemSelectedColor: z.string().optional(),
|
|
44
|
+
itemFontSize: z.number().optional(),
|
|
45
|
+
itemFontWeight: z.string().optional(),
|
|
46
|
+
itemFontFamily: z.string().optional(),
|
|
47
|
+
itemPadding: z.number().optional(),
|
|
48
|
+
itemPaddingHorizontal: z.number().optional(),
|
|
49
|
+
itemPaddingVertical: z.number().optional(),
|
|
50
|
+
}).superRefine((data, ctx) => {
|
|
51
|
+
const values = data.items.map((i) => i.value);
|
|
52
|
+
const unique = new Set(values);
|
|
53
|
+
if (unique.size !== values.length) {
|
|
54
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "item values must be unique", path: ["items"] });
|
|
55
|
+
}
|
|
56
|
+
if (data.defaultValues !== undefined) {
|
|
57
|
+
data.defaultValues.forEach((dv, i) => {
|
|
58
|
+
if (!unique.has(dv)) {
|
|
59
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: `defaultValues entry "${dv}" must match one of the item values`, path: ["defaultValues", i] });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
type CheckboxGroupUIElement = Extract<UIElement, { type: "CheckboxGroup" }>;
|
|
66
|
+
|
|
67
|
+
type Props = {
|
|
68
|
+
element: CheckboxGroupUIElement;
|
|
69
|
+
ctx: RenderContext;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const CheckboxGroupComponent = ({ element, ctx }: Props): React.ReactElement => {
|
|
73
|
+
const { theme, variables, setVariable } = ctx;
|
|
74
|
+
// The variable stores a JSON-serialised string[] to stay compatible with the string-based variable system.
|
|
75
|
+
const rawValue = element.props.variableName ? variables[element.props.variableName]?.value : undefined;
|
|
76
|
+
const selectedValues: string[] | undefined = (() => {
|
|
77
|
+
if (typeof rawValue !== "string") return undefined;
|
|
78
|
+
try { return JSON.parse(rawValue) as string[]; } catch { return undefined; }
|
|
79
|
+
})();
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (element.props.variableName && element.props.defaultValues && selectedValues === undefined) {
|
|
83
|
+
const defaultLabels = element.props.defaultValues.map((dv) => element.props.items.find((i) => i.value === dv)?.label ?? dv);
|
|
84
|
+
setVariable(element.props.variableName, {
|
|
85
|
+
value: JSON.stringify(element.props.defaultValues),
|
|
86
|
+
label: defaultLabels.join(", "),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, [element.props.variableName, element.props.defaultValues, element.props.items, selectedValues]);
|
|
90
|
+
|
|
91
|
+
const handleToggle = (value: string, label: string) => {
|
|
92
|
+
if (!element.props.variableName) return;
|
|
93
|
+
const current: string[] = selectedValues ?? [];
|
|
94
|
+
const next = current.includes(value) ? current.filter((v) => v !== value) : [...current, value];
|
|
95
|
+
const nextLabels = next.map((v) => element.props.items.find((i) => i.value === v)?.label ?? v);
|
|
96
|
+
setVariable(element.props.variableName, {
|
|
97
|
+
value: JSON.stringify(next),
|
|
98
|
+
label: nextLabels.join(", "),
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const isHorizontal = element.props.direction === "horizontal";
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<View
|
|
106
|
+
accessibilityRole="list"
|
|
107
|
+
style={{
|
|
108
|
+
flexDirection: isHorizontal ? "row" : "column",
|
|
109
|
+
flexWrap: isHorizontal ? "wrap" : undefined,
|
|
110
|
+
alignSelf: element.props.alignSelf,
|
|
111
|
+
gap: element.props.gap ?? 8,
|
|
112
|
+
width: element.props.width,
|
|
113
|
+
height: element.props.height,
|
|
114
|
+
margin: element.props.margin,
|
|
115
|
+
marginHorizontal: element.props.marginHorizontal,
|
|
116
|
+
marginVertical: element.props.marginVertical,
|
|
117
|
+
padding: element.props.padding,
|
|
118
|
+
paddingHorizontal: element.props.paddingHorizontal,
|
|
119
|
+
paddingVertical: element.props.paddingVertical,
|
|
120
|
+
borderWidth: element.props.borderWidth,
|
|
121
|
+
borderRadius: element.props.borderRadius,
|
|
122
|
+
borderColor: element.props.borderColor,
|
|
123
|
+
opacity: element.props.opacity,
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{element.props.items.map((item) => {
|
|
127
|
+
const isSelected = (selectedValues ?? []).includes(item.value);
|
|
128
|
+
const bgColor = isSelected
|
|
129
|
+
? (element.props.itemSelectedBackgroundColor ?? (theme.colors.primary.startsWith("#") ? theme.colors.primary + "1A" : theme.colors.primary))
|
|
130
|
+
: (element.props.itemBackgroundColor ?? "transparent");
|
|
131
|
+
const textColor = isSelected
|
|
132
|
+
? (element.props.itemSelectedColor ?? theme.colors.primary)
|
|
133
|
+
: (element.props.itemColor ?? theme.colors.text.primary);
|
|
134
|
+
const borderColor = isSelected
|
|
135
|
+
? (element.props.itemSelectedBorderColor ?? theme.colors.primary)
|
|
136
|
+
: (element.props.itemBorderColor ?? theme.colors.neutral.low);
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<TouchableOpacity
|
|
140
|
+
key={item.value}
|
|
141
|
+
activeOpacity={0.7}
|
|
142
|
+
onPress={() => handleToggle(item.value, item.label)}
|
|
143
|
+
accessibilityRole="checkbox"
|
|
144
|
+
accessibilityState={{ checked: isSelected }}
|
|
145
|
+
accessibilityLabel={item.label}
|
|
146
|
+
style={{
|
|
147
|
+
flexDirection: "row",
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
gap: 12,
|
|
150
|
+
backgroundColor: bgColor,
|
|
151
|
+
borderRadius: element.props.itemBorderRadius ?? 8,
|
|
152
|
+
borderWidth: element.props.itemBorderWidth ?? 1,
|
|
153
|
+
borderColor: borderColor,
|
|
154
|
+
padding: element.props.itemPadding ?? (element.props.itemPaddingHorizontal === undefined && element.props.itemPaddingVertical === undefined ? 12 : undefined),
|
|
155
|
+
paddingHorizontal: element.props.itemPaddingHorizontal,
|
|
156
|
+
paddingVertical: element.props.itemPaddingVertical,
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<View
|
|
160
|
+
style={{
|
|
161
|
+
width: 20,
|
|
162
|
+
height: 20,
|
|
163
|
+
borderRadius: 4,
|
|
164
|
+
borderWidth: 2,
|
|
165
|
+
borderColor: isSelected ? theme.colors.primary : theme.colors.neutral.medium,
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
justifyContent: "center",
|
|
168
|
+
backgroundColor: isSelected ? theme.colors.primary : "transparent",
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
{isSelected && (
|
|
172
|
+
<Text
|
|
173
|
+
style={{
|
|
174
|
+
color: "#fff",
|
|
175
|
+
fontSize: 12,
|
|
176
|
+
fontWeight: "700",
|
|
177
|
+
lineHeight: 14,
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
✓
|
|
181
|
+
</Text>
|
|
182
|
+
)}
|
|
183
|
+
</View>
|
|
184
|
+
<Text
|
|
185
|
+
style={{
|
|
186
|
+
flexShrink: 1,
|
|
187
|
+
color: textColor,
|
|
188
|
+
fontSize: element.props.itemFontSize ?? theme.typography.textStyles.body.fontSize,
|
|
189
|
+
fontWeight: (element.props.itemFontWeight as any) ?? theme.typography.textStyles.body.fontWeight,
|
|
190
|
+
fontFamily: element.props.itemFontFamily,
|
|
191
|
+
}}
|
|
192
|
+
>
|
|
193
|
+
{item.label}
|
|
194
|
+
</Text>
|
|
195
|
+
</TouchableOpacity>
|
|
196
|
+
);
|
|
197
|
+
})}
|
|
198
|
+
</View>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Pressable, Text, View, Platform } from "react-native";
|
|
3
|
+
import DateTimePicker, { DateTimePickerEvent } from "@react-native-community/datetimepicker";
|
|
4
|
+
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import type { UIElement } from "../types";
|
|
7
|
+
import type { RenderContext } from "./shared";
|
|
8
|
+
|
|
9
|
+
export type DatePickerElementProps = BaseBoxProps & {
|
|
10
|
+
variableName?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
minimumDate?: string;
|
|
13
|
+
maximumDate?: string;
|
|
14
|
+
mode?: "date" | "time" | "datetime";
|
|
15
|
+
display?: "default" | "spinner" | "calendar" | "clock" | "compact" | "inline";
|
|
16
|
+
textColor?: string;
|
|
17
|
+
accentColor?: string;
|
|
18
|
+
locale?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const DatePickerElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
22
|
+
variableName: z.string().min(1).optional(),
|
|
23
|
+
defaultValue: z.string().refine((s) => !isNaN(Date.parse(s)), { message: "Invalid date string" }).optional(),
|
|
24
|
+
minimumDate: z.string().refine((s) => !isNaN(Date.parse(s)), { message: "Invalid date string" }).optional(),
|
|
25
|
+
maximumDate: z.string().refine((s) => !isNaN(Date.parse(s)), { message: "Invalid date string" }).optional(),
|
|
26
|
+
mode: z.enum(["date", "time", "datetime"]).optional().default("date"),
|
|
27
|
+
display: z.enum(["default", "spinner", "calendar", "clock", "compact", "inline"]).optional(),
|
|
28
|
+
textColor: z.string().optional(),
|
|
29
|
+
accentColor: z.string().optional(),
|
|
30
|
+
locale: z.string().optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
type DatePickerUIElement = Extract<UIElement, { type: "DatePicker" }>;
|
|
34
|
+
|
|
35
|
+
type Props = {
|
|
36
|
+
element: DatePickerUIElement;
|
|
37
|
+
ctx: RenderContext;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function formatDate(date: Date, mode: "date" | "time" | "datetime"): string {
|
|
41
|
+
if (mode === "time") {
|
|
42
|
+
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
43
|
+
}
|
|
44
|
+
if (mode === "datetime") {
|
|
45
|
+
return date.toLocaleString([], { dateStyle: "medium", timeStyle: "short" });
|
|
46
|
+
}
|
|
47
|
+
return date.toLocaleDateString([], { dateStyle: "medium" });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const DatePickerElementComponent = ({ element, ctx }: Props): React.ReactElement => {
|
|
51
|
+
const { theme, variables, setVariable } = ctx;
|
|
52
|
+
const { props } = element;
|
|
53
|
+
|
|
54
|
+
const persistedValue = props.variableName ? variables[props.variableName]?.value : undefined;
|
|
55
|
+
const initialDate = persistedValue
|
|
56
|
+
? new Date(persistedValue)
|
|
57
|
+
: props.defaultValue
|
|
58
|
+
? new Date(props.defaultValue)
|
|
59
|
+
: new Date();
|
|
60
|
+
|
|
61
|
+
const [date, setDate] = useState<Date>(initialDate);
|
|
62
|
+
const [isPickerVisible, setPickerVisible] = useState(false);
|
|
63
|
+
const mode = props.mode ?? "date";
|
|
64
|
+
|
|
65
|
+
// Tracks which variableName has been seeded so re-renders don't clobber a
|
|
66
|
+
// persisted value that arrived after the first render.
|
|
67
|
+
const seededVariableRef = useRef<string | undefined>(undefined);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (
|
|
71
|
+
props.variableName &&
|
|
72
|
+
persistedValue === undefined &&
|
|
73
|
+
seededVariableRef.current !== props.variableName
|
|
74
|
+
) {
|
|
75
|
+
seededVariableRef.current = props.variableName;
|
|
76
|
+
setVariable(props.variableName, {
|
|
77
|
+
value: initialDate.toISOString(),
|
|
78
|
+
label: formatDate(initialDate, mode),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [props.variableName, persistedValue, initialDate, mode, setVariable]);
|
|
82
|
+
|
|
83
|
+
const handleChange = (_event: DateTimePickerEvent, selected?: Date) => {
|
|
84
|
+
if (!selected) return;
|
|
85
|
+
setDate(selected);
|
|
86
|
+
if (props.variableName) {
|
|
87
|
+
setVariable(props.variableName, {
|
|
88
|
+
value: selected.toISOString(),
|
|
89
|
+
label: formatDate(selected, mode),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const containerStyle = {
|
|
95
|
+
alignSelf: props.alignSelf,
|
|
96
|
+
width: props.width,
|
|
97
|
+
height: props.height,
|
|
98
|
+
margin: props.margin,
|
|
99
|
+
marginHorizontal: props.marginHorizontal,
|
|
100
|
+
marginVertical: props.marginVertical,
|
|
101
|
+
padding: props.padding,
|
|
102
|
+
paddingHorizontal: props.paddingHorizontal,
|
|
103
|
+
paddingVertical: props.paddingVertical,
|
|
104
|
+
opacity: props.opacity,
|
|
105
|
+
borderWidth: props.borderWidth,
|
|
106
|
+
borderRadius: props.borderRadius,
|
|
107
|
+
borderColor: props.borderColor,
|
|
108
|
+
overflow: "hidden" as const,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const pickerProps = {
|
|
112
|
+
value: date,
|
|
113
|
+
mode,
|
|
114
|
+
onChange: handleChange,
|
|
115
|
+
minimumDate: props.minimumDate ? new Date(props.minimumDate) : undefined,
|
|
116
|
+
maximumDate: props.maximumDate ? new Date(props.maximumDate) : undefined,
|
|
117
|
+
// Fall back to theme tokens when CMS props are not provided.
|
|
118
|
+
textColor: props.textColor ?? theme.colors.text.primary,
|
|
119
|
+
accentColor: props.accentColor ?? theme.colors.primary,
|
|
120
|
+
locale: props.locale,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
if (Platform.OS === "android") {
|
|
124
|
+
return (
|
|
125
|
+
<View style={containerStyle}>
|
|
126
|
+
<Pressable
|
|
127
|
+
onPress={() => setPickerVisible(true)}
|
|
128
|
+
style={{
|
|
129
|
+
flexDirection: "row",
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
justifyContent: "space-between",
|
|
132
|
+
paddingVertical: 12,
|
|
133
|
+
paddingHorizontal: 16,
|
|
134
|
+
borderRadius: props.borderRadius ?? 8,
|
|
135
|
+
borderWidth: props.borderWidth ?? 1,
|
|
136
|
+
borderColor: props.borderColor ?? theme.colors.neutral.low,
|
|
137
|
+
backgroundColor: theme.colors.neutral.lowest,
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
<Text
|
|
141
|
+
style={{
|
|
142
|
+
color: props.textColor ?? theme.colors.text.primary,
|
|
143
|
+
fontSize: theme.typography.textStyles.body.fontSize,
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
{formatDate(date, mode)}
|
|
147
|
+
</Text>
|
|
148
|
+
<Text style={{ color: theme.colors.text.tertiary, fontSize: 16 }}>›</Text>
|
|
149
|
+
</Pressable>
|
|
150
|
+
{isPickerVisible && (
|
|
151
|
+
<DateTimePicker
|
|
152
|
+
{...pickerProps}
|
|
153
|
+
display={(props.display ?? "default") as any}
|
|
154
|
+
onChange={(event, selected) => {
|
|
155
|
+
setPickerVisible(false);
|
|
156
|
+
handleChange(event, selected);
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</View>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<View style={containerStyle}>
|
|
166
|
+
<DateTimePicker
|
|
167
|
+
{...pickerProps}
|
|
168
|
+
display={(props.display ?? "spinner") as any}
|
|
169
|
+
/>
|
|
170
|
+
</View>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
@@ -10,7 +10,9 @@ import { IconElementComponent } from "./IconElement";
|
|
|
10
10
|
import { VideoElementRenderer } from "./VideoElement";
|
|
11
11
|
import { InputElementComponent } from "./InputElement";
|
|
12
12
|
import { RadioGroupComponent } from "./RadioGroupElement";
|
|
13
|
+
import { CheckboxGroupComponent } from "./CheckboxGroupElement";
|
|
13
14
|
import { ButtonElementComponent } from "./ButtonElement";
|
|
15
|
+
import { DatePickerElementComponent } from "./DatePickerElement";
|
|
14
16
|
|
|
15
17
|
export const renderElement = (
|
|
16
18
|
element: UIElement,
|
|
@@ -53,9 +55,17 @@ export const renderElement = (
|
|
|
53
55
|
return <RadioGroupComponent key={element.id} element={element} ctx={ctx} />;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
if (element.type === "CheckboxGroup") {
|
|
59
|
+
return <CheckboxGroupComponent key={element.id} element={element} ctx={ctx} />;
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
if (element.type === "Button") {
|
|
57
63
|
return <ButtonElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
if (element.type === "DatePicker") {
|
|
67
|
+
return <DatePickerElementComponent key={element.id} element={element} ctx={ctx} />;
|
|
68
|
+
}
|
|
69
|
+
|
|
60
70
|
return null;
|
|
61
71
|
};
|
|
@@ -10,6 +10,8 @@ import { type VideoElementProps, VideoElementPropsSchema } from "./elements/Vide
|
|
|
10
10
|
import { type InputElementProps, InputElementPropsSchema } from "./elements/InputElement";
|
|
11
11
|
import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/ButtonElement";
|
|
12
12
|
import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
|
|
13
|
+
import { type CheckboxGroupElementProps, CheckboxGroupElementPropsSchema } from "./elements/CheckboxGroupElement";
|
|
14
|
+
import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./elements/DatePickerElement";
|
|
13
15
|
|
|
14
16
|
export type { BaseBoxProps } from "./elements/BaseBoxProps";
|
|
15
17
|
export { BaseBoxPropsSchema } from "./elements/BaseBoxProps";
|
|
@@ -23,6 +25,8 @@ export type { VideoElementProps } from "./elements/VideoElement";
|
|
|
23
25
|
export type { InputElementProps } from "./elements/InputElement";
|
|
24
26
|
export type { ButtonElementProps } from "./elements/ButtonElement";
|
|
25
27
|
export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
|
|
28
|
+
export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
|
|
29
|
+
export type { DatePickerElementProps } from "./elements/DatePickerElement";
|
|
26
30
|
|
|
27
31
|
// UIElement union — must live here (not in elements/) to avoid circular deps
|
|
28
32
|
// because the Stack variant's children: UIElement[] references itself.
|
|
@@ -87,6 +91,18 @@ export type UIElement =
|
|
|
87
91
|
name?: string;
|
|
88
92
|
type: "RadioGroup";
|
|
89
93
|
props: RadioGroupElementProps;
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
id: string;
|
|
97
|
+
name?: string;
|
|
98
|
+
type: "CheckboxGroup";
|
|
99
|
+
props: CheckboxGroupElementProps;
|
|
100
|
+
}
|
|
101
|
+
| {
|
|
102
|
+
id: string;
|
|
103
|
+
name?: string;
|
|
104
|
+
type: "DatePicker";
|
|
105
|
+
props: DatePickerElementProps;
|
|
90
106
|
};
|
|
91
107
|
|
|
92
108
|
export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
@@ -152,6 +168,18 @@ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
152
168
|
type: z.literal("RadioGroup"),
|
|
153
169
|
props: RadioGroupElementPropsSchema,
|
|
154
170
|
}),
|
|
171
|
+
z.object({
|
|
172
|
+
id: z.string(),
|
|
173
|
+
name: z.string().optional(),
|
|
174
|
+
type: z.literal("CheckboxGroup"),
|
|
175
|
+
props: CheckboxGroupElementPropsSchema,
|
|
176
|
+
}),
|
|
177
|
+
z.object({
|
|
178
|
+
id: z.string(),
|
|
179
|
+
name: z.string().optional(),
|
|
180
|
+
type: z.literal("DatePicker"),
|
|
181
|
+
props: DatePickerElementPropsSchema,
|
|
182
|
+
}),
|
|
155
183
|
])
|
|
156
184
|
);
|
|
157
185
|
|