@builder.io/sdk-react-native 0.0.1-34 → 0.0.1-35

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.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button.js +35 -0
  3. package/src/blocks/button.lite.tsx +25 -0
  4. package/src/blocks/columns.js +43 -0
  5. package/src/blocks/columns.lite.tsx +41 -0
  6. package/src/blocks/custom-code.js +56 -0
  7. package/src/blocks/custom-code.lite.tsx +67 -0
  8. package/src/blocks/embed.js +56 -0
  9. package/src/blocks/embed.lite.tsx +65 -0
  10. package/src/blocks/form.js +226 -0
  11. package/src/blocks/form.lite.tsx +253 -0
  12. package/src/blocks/fragment.js +13 -0
  13. package/src/blocks/fragment.lite.tsx +11 -0
  14. package/src/blocks/image.js +121 -0
  15. package/src/blocks/image.lite.tsx +67 -0
  16. package/src/blocks/img.js +41 -0
  17. package/src/blocks/img.lite.tsx +19 -0
  18. package/src/blocks/input.js +41 -0
  19. package/src/blocks/input.lite.tsx +21 -0
  20. package/src/blocks/raw-text.js +17 -0
  21. package/src/blocks/raw-text.lite.tsx +12 -0
  22. package/src/blocks/section.js +36 -0
  23. package/src/blocks/section.lite.tsx +20 -0
  24. package/src/blocks/select.js +41 -0
  25. package/src/blocks/select.lite.tsx +24 -0
  26. package/src/blocks/submit-button.js +34 -0
  27. package/src/blocks/submit-button.lite.tsx +11 -0
  28. package/src/blocks/symbol.js +20 -0
  29. package/src/blocks/symbol.lite.tsx +20 -0
  30. package/src/blocks/text.js +85 -0
  31. package/src/blocks/text.lite.tsx +12 -0
  32. package/src/blocks/textarea.js +37 -0
  33. package/src/blocks/textarea.lite.tsx +15 -0
  34. package/src/blocks/video.js +88 -0
  35. package/src/blocks/video.lite.tsx +28 -0
  36. package/src/components/block-styles.js +7 -0
  37. package/src/components/block-styles.lite.tsx +7 -0
  38. package/src/components/error-boundary.js +25 -0
  39. package/src/components/error-boundary.lite.tsx +7 -0
  40. package/src/components/render-block.js +105 -0
  41. package/src/components/render-block.lite.tsx +125 -0
  42. package/src/components/render-blocks.js +47 -0
  43. package/src/components/render-blocks.lite.tsx +60 -0
  44. package/src/components/render-content.js +143 -0
  45. package/src/components/render-content.lite.tsx +207 -0
  46. package/src/constants/device-sizes.js +40 -0
  47. package/src/context/builder.context.js +5 -0
  48. package/src/functions/evaluate.js +20 -0
  49. package/src/functions/get-block-actions.js +23 -0
  50. package/src/functions/get-block-component-options.js +24 -0
  51. package/src/functions/get-block-properties.js +43 -0
  52. package/src/functions/get-block-styles.js +61 -0
  53. package/src/functions/get-block-tag.js +8 -0
  54. package/src/functions/get-content.js +128 -0
  55. package/src/functions/get-content.test.js +47 -0
  56. package/src/functions/get-fetch.js +13 -0
  57. package/src/functions/get-global-this.js +19 -0
  58. package/src/functions/get-processed-block.js +45 -0
  59. package/src/functions/get-processed-block.test.js +27 -0
  60. package/src/functions/get-target.js +7 -0
  61. package/src/functions/if-target.js +7 -0
  62. package/src/functions/is-browser.js +8 -0
  63. package/src/functions/is-editing.js +8 -0
  64. package/src/functions/is-iframe.js +8 -0
  65. package/src/functions/is-previewing.js +15 -0
  66. package/src/functions/is-react-native.js +7 -0
  67. package/src/functions/macro-eval.js +6 -0
  68. package/src/functions/on-change.js +28 -0
  69. package/src/functions/on-change.test.js +21 -0
  70. package/src/functions/previewing-model-name.js +12 -0
  71. package/src/functions/register-component.js +54 -0
  72. package/src/functions/register.js +30 -0
  73. package/src/functions/set-editor-settings.js +16 -0
  74. package/src/functions/set.js +12 -0
  75. package/src/functions/set.test.js +18 -0
  76. package/src/functions/track.js +19 -0
  77. package/src/index.js +25 -0
  78. package/src/package.json +18 -0
  79. package/src/scripts/init-editing.js +71 -0
  80. package/src/types/builder-block.js +1 -0
  81. package/src/types/builder-content.js +1 -0
  82. package/src/types/deep-partial.js +1 -0
@@ -0,0 +1,253 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useState, useContext, useRef } from "react";
4
+ import RenderBlock from "../components/render-block.lite";
5
+
6
+ export default function FormComponent(props) {
7
+ const [state, setState] = useState(() => "unsubmitted");
8
+
9
+ const [responseData, setResponseData] = useState(() => null);
10
+
11
+ const [formErrorMessage, setFormErrorMessage] = useState(() => "");
12
+
13
+ function submissionState() {
14
+ return (Builder.isEditing && props.previewState) || state;
15
+ }
16
+
17
+ function onSubmit(event) {
18
+ const sendWithJs = props.sendWithJs || props.sendSubmissionsTo === "email";
19
+
20
+ if (props.sendSubmissionsTo === "zapier") {
21
+ event.preventDefault();
22
+ } else if (sendWithJs) {
23
+ if (!(props.action || props.sendSubmissionsTo === "email")) {
24
+ event.preventDefault();
25
+ return;
26
+ }
27
+
28
+ event.preventDefault();
29
+ const el = event.currentTarget;
30
+ const headers = props.customHeaders || {};
31
+ let body;
32
+ const formData = new FormData(el); // TODO: maybe support null
33
+
34
+ const formPairs = Array.from(
35
+ event.currentTarget.querySelectorAll("input,select,textarea")
36
+ )
37
+ .filter((el) => !!el.name)
38
+ .map((el) => {
39
+ let value;
40
+ const key = el.name;
41
+
42
+ if (el instanceof HTMLInputElement) {
43
+ if (el.type === "radio") {
44
+ if (el.checked) {
45
+ value = el.name;
46
+ return {
47
+ key,
48
+ value,
49
+ };
50
+ }
51
+ } else if (el.type === "checkbox") {
52
+ value = el.checked;
53
+ } else if (el.type === "number" || el.type === "range") {
54
+ const num = el.valueAsNumber;
55
+
56
+ if (!isNaN(num)) {
57
+ value = num;
58
+ }
59
+ } else if (el.type === "file") {
60
+ // TODO: one vs multiple files
61
+ value = el.files;
62
+ } else {
63
+ value = el.value;
64
+ }
65
+ } else {
66
+ value = el.value;
67
+ }
68
+
69
+ return {
70
+ key,
71
+ value,
72
+ };
73
+ });
74
+ let contentType = props.contentType;
75
+
76
+ if (props.sendSubmissionsTo === "email") {
77
+ contentType = "multipart/form-data";
78
+ }
79
+
80
+ Array.from(formPairs).forEach(({ value }) => {
81
+ if (
82
+ value instanceof File ||
83
+ (Array.isArray(value) && value[0] instanceof File) ||
84
+ value instanceof FileList
85
+ ) {
86
+ contentType = "multipart/form-data";
87
+ }
88
+ }); // TODO: send as urlEncoded or multipart by default
89
+ // because of ease of use and reliability in browser API
90
+ // for encoding the form?
91
+
92
+ if (contentType !== "application/json") {
93
+ body = formData;
94
+ } else {
95
+ // Json
96
+ const json = {};
97
+ Array.from(formPairs).forEach(({ value, key }) => {
98
+ set(json, key, value);
99
+ });
100
+ body = JSON.stringify(json);
101
+ }
102
+
103
+ if (contentType && contentType !== "multipart/form-data") {
104
+ if (
105
+ /* Zapier doesn't allow content-type header to be sent from browsers */ !(
106
+ sendWithJs && props.action?.includes("zapier.com")
107
+ )
108
+ ) {
109
+ headers["content-type"] = contentType;
110
+ }
111
+ }
112
+ const presubmitEvent = new CustomEvent("presubmit", { detail: { body } });
113
+ if (formRef.current) {
114
+ formRef.current.dispatchEvent(presubmitEvent);
115
+ if (presubmitEvent.defaultPrevented) {
116
+ return;
117
+ }
118
+ }
119
+ setState("sending");
120
+ const formUrl = `${
121
+ builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"
122
+ }/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(
123
+ props.sendSubmissionsToEmail || ""
124
+ )}&name=${encodeURIComponent(props.name || "")}`;
125
+ fetch(
126
+ props.sendSubmissionsTo === "email"
127
+ ? formUrl
128
+ : props.action /* TODO: throw error if no action URL */,
129
+ { body, headers, method: props.method || "post" }
130
+ ).then(
131
+ async (res) => {
132
+ let body;
133
+ const contentType = res.headers.get("content-type");
134
+ if (contentType && contentType.indexOf("application/json") !== -1) {
135
+ body = await res.json();
136
+ } else {
137
+ body = await res.text();
138
+ }
139
+ if (!res.ok && props.errorMessagePath) {
140
+ /* TODO: allow supplying an error formatter function */ let message =
141
+ get(body, props.errorMessagePath);
142
+ if (message) {
143
+ if (typeof message !== "string") {
144
+ /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
145
+ JSON.stringify(message);
146
+ }
147
+ setFormErrorMessage(message);
148
+ }
149
+ }
150
+ setResponseData(body);
151
+ setState(res.ok ? "success" : "error");
152
+ if (res.ok) {
153
+ const submitSuccessEvent = new CustomEvent("submit:success", {
154
+ detail: { res, body },
155
+ });
156
+ if (formRef.current) {
157
+ formRef.current.dispatchEvent(submitSuccessEvent);
158
+ if (submitSuccessEvent.defaultPrevented) {
159
+ return;
160
+ }
161
+ /* TODO: option to turn this on/off? */ if (
162
+ props.resetFormOnSubmit !== false
163
+ ) {
164
+ formRef.current.reset();
165
+ }
166
+ }
167
+ /* TODO: client side route event first that can be preventDefaulted */ if (
168
+ props.successUrl
169
+ ) {
170
+ if (formRef.current) {
171
+ const event = new CustomEvent("route", {
172
+ detail: { url: props.successUrl },
173
+ });
174
+ formRef.current.dispatchEvent(event);
175
+ if (!event.defaultPrevented) {
176
+ location.href = props.successUrl;
177
+ }
178
+ } else {
179
+ location.href = props.successUrl;
180
+ }
181
+ }
182
+ }
183
+ },
184
+ (err) => {
185
+ const submitErrorEvent = new CustomEvent("submit:error", {
186
+ detail: { error: err },
187
+ });
188
+ if (formRef.current) {
189
+ formRef.current.dispatchEvent(submitErrorEvent);
190
+ if (submitErrorEvent.defaultPrevented) {
191
+ return;
192
+ }
193
+ }
194
+ setResponseData(err);
195
+ setState("error");
196
+ }
197
+ );
198
+ }
199
+ }
200
+ const formRef = useRef();
201
+ return (
202
+ <View
203
+ {...props.attributes}
204
+ validate={props.validate}
205
+ ref={formRef}
206
+ action={!props.sendWithJs && props.action}
207
+ method={props.method}
208
+ name={props.name}
209
+ onSubmit={(event) => onSubmit(event)}
210
+ >
211
+ {" "}
212
+ {props.builderBlock && props.builderBlock.children ? (
213
+ <>
214
+ {props.builderBlock?.children?.map((block) => (
215
+ <RenderBlock block={block} />
216
+ ))}
217
+ </>
218
+ ) : null}{" "}
219
+ {submissionState() === "error" ? (
220
+ <>
221
+ <BuilderBlocks dataPath="errorMessage" blocks={props.errorMessage} />
222
+ </>
223
+ ) : null}{" "}
224
+ {submissionState() === "sending" ? (
225
+ <>
226
+ <BuilderBlocks
227
+ dataPath="sendingMessage"
228
+ blocks={props.sendingMessage}
229
+ />
230
+ </>
231
+ ) : null}{" "}
232
+ {submissionState() === "error" && responseData ? (
233
+ <>
234
+ <View className="builder-form-error-text" style={styles.view1}>
235
+ {" "}
236
+ <Text>{JSON.stringify(responseData, null, 2)}</Text>{" "}
237
+ </View>
238
+ </>
239
+ ) : null}{" "}
240
+ {submissionState() === "success" ? (
241
+ <>
242
+ <BuilderBlocks
243
+ dataPath="successMessage"
244
+ blocks={props.successMessage}
245
+ />
246
+ </>
247
+ ) : null}{" "}
248
+ </View>
249
+ );
250
+ }
251
+ const styles = StyleSheet.create({
252
+ view1: { padding: 10, color: "red", textAlign: "center" },
253
+ });
@@ -0,0 +1,13 @@
1
+ import { registerComponent } from '../functions/register-component';
2
+
3
+ import * as React from "react";
4
+ import { View, Text } from "react-native";
5
+ function FragmentComponent(props) {
6
+ return /* @__PURE__ */ React.createElement(View, null, /* @__PURE__ */ React.createElement(Text, null, props.children));
7
+ }
8
+ export {
9
+ FragmentComponent as default
10
+ };
11
+
12
+
13
+ registerComponent(FragmentComponent, {name:'Fragment',static:true,hidden:true,builtIn:true,canHaveChildren:true,noWrap:true});
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useContext } from "react";
4
+
5
+ export default function FragmentComponent(props) {
6
+ return (
7
+ <View>
8
+ <Text>{props.children}</Text>
9
+ </View>
10
+ );
11
+ }
@@ -0,0 +1,121 @@
1
+ import * as React from 'react';
2
+ import { Image as ReactImage, View } from "react-native";
3
+ import { registerComponent } from "../functions/register-component";
4
+ function Image(props) {
5
+ return /* @__PURE__ */ React.createElement(View, {
6
+ style: { position: "relative" }
7
+ }, /* @__PURE__ */ React.createElement(ReactImage, {
8
+ resizeMode: props.backgroundSize || "contain",
9
+ style: { position: "absolute", top: 0, bottom: 0, left: 0, right: 0 },
10
+ source: { uri: props.image }
11
+ }), /* @__PURE__ */ React.createElement(View, {
12
+ style: {
13
+ width: "100%",
14
+ paddingTop: props.aspectRatio * 100 + "%"
15
+ }
16
+ }));
17
+ }
18
+ registerComponent(Image, {
19
+ name: "Image",
20
+ static: true,
21
+ builtIn: true,
22
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
23
+ defaultStyles: {
24
+ position: "relative",
25
+ minHeight: "20px",
26
+ minWidth: "20px",
27
+ overflow: "hidden"
28
+ },
29
+ canHaveChildren: true,
30
+ inputs: [
31
+ {
32
+ name: "image",
33
+ type: "file",
34
+ bubble: true,
35
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
36
+ required: true,
37
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
38
+ onChange: " const DEFAULT_ASPECT_RATIO = 0.7041; options.delete('srcset'); options.delete('noWebp'); function loadImage(url, timeout) { return new Promise((resolve, reject) => { const img = document.createElement('img'); let loaded = false; img.onload = () => { loaded = true; resolve(img); }; img.addEventListener('error', event => { console.warn('Image load failed', event.error); reject(event.error); }); img.src = url; setTimeout(() => { if (!loaded) { reject(new Error('Image load timed out')); } }, timeout); }); } function round(num) { return Math.round(num * 1000) / 1000; } const value = options.get('image'); const aspectRatio = options.get('aspectRatio'); // For SVG images - don't render as webp, keep them as SVG fetch(value) .then(res => res.blob()) .then(blob => { if (blob.type.includes('svg')) { options.set('noWebp', true); } }); if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) { return loadImage(value).then(img => { const possiblyUpdatedAspectRatio = options.get('aspectRatio'); if ( options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO) ) { if (img.width && img.height) { options.set('aspectRatio', round(img.height / img.width)); options.set('height', img.height); options.set('width', img.width); } } }); }"
39
+ },
40
+ {
41
+ name: "backgroundSize",
42
+ type: "text",
43
+ defaultValue: "cover",
44
+ enum: [
45
+ {
46
+ label: "contain",
47
+ value: "contain",
48
+ helperText: "The image should never get cropped"
49
+ },
50
+ {
51
+ label: "cover",
52
+ value: "cover",
53
+ helperText: `The image should fill it's box, cropping when needed`
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ name: "backgroundPosition",
59
+ type: "text",
60
+ defaultValue: "center",
61
+ enum: [
62
+ "center",
63
+ "top",
64
+ "left",
65
+ "right",
66
+ "bottom",
67
+ "top left",
68
+ "top right",
69
+ "bottom left",
70
+ "bottom right"
71
+ ]
72
+ },
73
+ {
74
+ name: "altText",
75
+ type: "string",
76
+ helperText: "Text to display when the user has images off"
77
+ },
78
+ {
79
+ name: "height",
80
+ type: "number",
81
+ hideFromUI: true
82
+ },
83
+ {
84
+ name: "width",
85
+ type: "number",
86
+ hideFromUI: true
87
+ },
88
+ {
89
+ name: "sizes",
90
+ type: "string",
91
+ hideFromUI: true
92
+ },
93
+ {
94
+ name: "srcset",
95
+ type: "string",
96
+ hideFromUI: true
97
+ },
98
+ {
99
+ name: "lazy",
100
+ type: "boolean",
101
+ defaultValue: true,
102
+ hideFromUI: true
103
+ },
104
+ {
105
+ name: "fitContent",
106
+ type: "boolean",
107
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
108
+ defaultValue: true
109
+ },
110
+ {
111
+ name: "aspectRatio",
112
+ type: "number",
113
+ helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
114
+ advanced: true,
115
+ defaultValue: 0.7041
116
+ }
117
+ ]
118
+ });
119
+ export {
120
+ Image as default
121
+ };
@@ -0,0 +1,67 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useContext } from "react";
4
+
5
+ export default function Image(props) {
6
+ return (
7
+ <View style={styles.view1}>
8
+ <View>
9
+ <View
10
+ loading="lazy"
11
+ alt={props.altText}
12
+ aria-role={props.altText ? "presentation" : undefined}
13
+ style={styles.view2}
14
+ className={"builder-image" + (props.class ? " " + props.class : "")}
15
+ src={props.image}
16
+ srcset={props.srcset}
17
+ sizes={props.sizes}
18
+ />
19
+
20
+ <View srcSet={props.srcset} />
21
+ </View>
22
+
23
+ {props.aspectRatio &&
24
+ !(props.fitContent && props.builderBlock?.children?.length) ? (
25
+ <View className="builder-image-sizer" style={styles.view3}>
26
+ <Text> </Text>
27
+ </View>
28
+ ) : null}
29
+
30
+ {props.builderBlock?.children?.length && props.fitContent ? (
31
+ <Text>{props.children}</Text>
32
+ ) : null}
33
+
34
+ {!props.fitContent ? (
35
+ <>
36
+ <View style={styles.view4}>
37
+ <Text>{props.children}</Text>
38
+ </View>
39
+ </>
40
+ ) : null}
41
+ </View>
42
+ );
43
+ }
44
+
45
+ const styles = StyleSheet.create({
46
+ view1: { position: "relative" },
47
+ view2: {
48
+ opacity: 1,
49
+ transition: "opacity 0.2s ease-in-out",
50
+ position: "absolute",
51
+ height: 100,
52
+ width: 100,
53
+ top: 0,
54
+ left: 0,
55
+ },
56
+ view3: { width: 100, pointerEvents: "none", fontSize: 0 },
57
+ view4: {
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ alignItems: "stretch",
61
+ position: "absolute",
62
+ top: 0,
63
+ left: 0,
64
+ width: 100,
65
+ height: 100,
66
+ },
67
+ });
@@ -0,0 +1,41 @@
1
+ import { registerComponent } from '../functions/register-component';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ import * as React from "react";
23
+ import { View } from "react-native";
24
+ import { isEditing } from "../functions/is-editing";
25
+ function ImgComponent(props) {
26
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
+ style: {
28
+ objectFit: props.backgroundSize || "cover",
29
+ objectPosition: props.backgroundPosition || "center"
30
+ },
31
+ key: isEditing() && props.imgSrc || "default-key",
32
+ alt: props.altText,
33
+ src: props.imgSrc
34
+ }));
35
+ }
36
+ export {
37
+ ImgComponent as default
38
+ };
39
+
40
+
41
+ registerComponent(ImgComponent, {name:'Raw:Img',hideFromInsertMenu:true,builtIn:true,image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',inputs:[{name:'image',bubble:true,type:'file',allowedFileTypes:['jpeg','jpg','png','svg'],required:true}],noWrap:true,static:true});
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useContext } from "react";
4
+ import { isEditing } from "../functions/is-editing";
5
+
6
+ export default function ImgComponent(props) {
7
+ return (
8
+ <View
9
+ {...props.attributes}
10
+ style={{
11
+ objectFit: props.backgroundSize || "cover",
12
+ objectPosition: props.backgroundPosition || "center",
13
+ }}
14
+ key={(isEditing() && props.imgSrc) || "default-key"}
15
+ alt={props.altText}
16
+ src={props.imgSrc}
17
+ />
18
+ );
19
+ }
@@ -0,0 +1,41 @@
1
+ import { registerComponent } from '../functions/register-component';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ import * as React from "react";
23
+ import { View } from "react-native";
24
+ import { isEditing } from "../functions/is-editing";
25
+ function FormInputComponent(props) {
26
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
+ key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
28
+ placeholder: props.placeholder,
29
+ type: props.type,
30
+ name: props.name,
31
+ value: props.value,
32
+ defaultValue: props.defaultValue,
33
+ required: props.required
34
+ }));
35
+ }
36
+ export {
37
+ FormInputComponent as default
38
+ };
39
+
40
+
41
+ registerComponent(FormInputComponent, {name:'Form:Input',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',inputs:[{name:'type',type:'text',enum:['text','number','email','url','checkbox','radio','range','date','datetime-local','search','tel','time','file','month','week','password','color','hidden'],defaultValue:'text'},{name:'name',type:'string',required:true,helperText:'Every input in a form needs a unique name describing what it takes, e.g. "email"'},{name:'placeholder',type:'string',defaultValue:'Hello there',helperText:'Text to display when there is no value'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',helperText:'Is this input required to be filled out to submit a form',defaultValue:false}],noWrap:true,static:true,defaultStyles:{paddingTop:'10px',paddingBottom:'10px',paddingLeft:'10px',paddingRight:'10px',borderRadius:'3px',borderWidth:'1px',borderStyle:'solid',borderColor:'#ccc'}});
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useContext } from "react";
4
+ import { isEditing } from "../functions/is-editing";
5
+
6
+ export default function FormInputComponent(props) {
7
+ return (
8
+ <View
9
+ {...props.attributes}
10
+ key={
11
+ isEditing() && props.defaultValue ? props.defaultValue : "default-key"
12
+ }
13
+ placeholder={props.placeholder}
14
+ type={props.type}
15
+ name={props.name}
16
+ value={props.value}
17
+ defaultValue={props.defaultValue}
18
+ required={props.required}
19
+ />
20
+ );
21
+ }
@@ -0,0 +1,17 @@
1
+ import { registerComponent } from '../functions/register-component';
2
+
3
+ import * as React from "react";
4
+ import { View } from "react-native";
5
+ function RawText(props) {
6
+ var _a, _b;
7
+ return /* @__PURE__ */ React.createElement(View, {
8
+ className: ((_a = props.attributes) == null ? void 0 : _a.class) || ((_b = props.attributes) == null ? void 0 : _b.className),
9
+ dangerouslySetInnerHTML: { __html: "props.text || ''" }
10
+ });
11
+ }
12
+ export {
13
+ RawText as default
14
+ };
15
+
16
+
17
+ registerComponent(RawText, {name:'Builder:RawText',hideFromInsertMenu:true,builtIn:true,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useContext } from "react";
4
+
5
+ export default function RawText(props) {
6
+ return (
7
+ <View
8
+ className={props.attributes?.class || props.attributes?.className}
9
+ dangerouslySetInnerHTML={{ __html: "props.text || ''" }}
10
+ />
11
+ );
12
+ }
@@ -0,0 +1,36 @@
1
+ import { registerComponent } from '../functions/register-component';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ import * as React from "react";
23
+ import { View, Text } from "react-native";
24
+ function SectionComponent(props) {
25
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
26
+ style: props.maxWidth && typeof props.maxWidth === "number" ? {
27
+ maxWidth: props.maxWidth
28
+ } : void 0
29
+ }), /* @__PURE__ */ React.createElement(Text, null, props.children));
30
+ }
31
+ export {
32
+ SectionComponent as default
33
+ };
34
+
35
+
36
+ registerComponent(SectionComponent, {name:'Core:Section',static:true,builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a',inputs:[{name:'maxWidth',type:'number',defaultValue:1200},{name:'lazyLoad',type:'boolean',defaultValue:false,advanced:true,description:'Only render this section when in view'}],defaultStyles:{paddingLeft:'20px',paddingRight:'20px',paddingTop:'50px',paddingBottom:'50px',marginTop:'0px',width:'100vw',marginLeft:'calc(50% - 50vw)'},canHaveChildren:true,defaultChildren:[{'@type':'@builder.io/sdk:Element',responsiveStyles:{large:{textAlign:'center'}},component:{name:'Text',options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]});