@builder.io/sdk-react-native 0.0.1-7 → 0.0.1-70

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 (153) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +19 -0
  3. package/package.json +6 -4
  4. package/src/blocks/button/button.js +34 -0
  5. package/src/blocks/button/component-info.js +41 -0
  6. package/src/blocks/columns/columns.js +61 -0
  7. package/src/blocks/columns/component-info.js +242 -0
  8. package/src/blocks/custom-code/component-info.js +31 -0
  9. package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.js} +16 -33
  10. package/src/blocks/embed/component-info.js +44 -0
  11. package/src/blocks/embed/embed.js +43 -0
  12. package/src/blocks/embed/helpers.js +9 -0
  13. package/src/blocks/form/component-info.js +262 -0
  14. package/src/blocks/form/form.js +224 -0
  15. package/src/blocks/fragment/component-info.js +11 -0
  16. package/src/blocks/fragment/fragment.js +8 -0
  17. package/src/blocks/image/component-info.js +151 -0
  18. package/src/blocks/image/image.helpers.js +48 -0
  19. package/src/blocks/image/image.js +40 -0
  20. package/src/blocks/img/component-info.js +20 -0
  21. package/src/blocks/img/img.js +36 -0
  22. package/src/blocks/input/component-info.js +74 -0
  23. package/src/blocks/input/input.js +36 -0
  24. package/src/blocks/raw-text/component-info.js +16 -0
  25. package/src/blocks/raw-text/raw-text.js +10 -0
  26. package/src/blocks/section/component-info.js +49 -0
  27. package/src/blocks/section/section.js +31 -0
  28. package/src/blocks/select/component-info.js +59 -0
  29. package/src/blocks/select/select.js +36 -0
  30. package/src/blocks/submit-button/component-info.js +28 -0
  31. package/src/blocks/submit-button/submit-button.js +29 -0
  32. package/src/blocks/symbol/component-info.js +43 -0
  33. package/src/blocks/symbol/symbol.js +69 -0
  34. package/src/blocks/{text.js → text/component-info.js} +4 -11
  35. package/src/blocks/text/text.js +64 -0
  36. package/src/blocks/textarea/component-info.js +47 -0
  37. package/src/blocks/textarea/textarea.js +32 -0
  38. package/src/blocks/util.js +7 -0
  39. package/src/blocks/video/component-info.js +106 -0
  40. package/src/blocks/video/video.js +32 -0
  41. package/src/components/render-block/block-styles.js +37 -0
  42. package/src/components/render-block/render-block.helpers.js +23 -0
  43. package/src/components/render-block/render-block.js +171 -0
  44. package/src/components/render-block/render-component.js +35 -0
  45. package/src/components/render-block/render-repeated-block.js +30 -0
  46. package/src/components/render-block/types.js +0 -0
  47. package/src/components/render-blocks.js +29 -13
  48. package/src/components/render-content/components/render-styles.js +58 -0
  49. package/src/components/render-content/index.js +4 -0
  50. package/src/components/render-content/render-content.js +277 -0
  51. package/src/components/render-inlined-styles.js +18 -0
  52. package/src/constants/builder-registered-components.js +42 -0
  53. package/src/constants/device-sizes.js +3 -22
  54. package/src/constants/target.js +4 -0
  55. package/src/context/builder.context.js +7 -1
  56. package/src/functions/camel-to-kebab-case.js +4 -0
  57. package/src/functions/convert-style-object.js +6 -0
  58. package/src/functions/evaluate.js +17 -9
  59. package/src/functions/event-handler-name.js +7 -0
  60. package/src/functions/get-block-actions.js +14 -14
  61. package/src/functions/get-block-component-options.js +22 -2
  62. package/src/functions/get-block-properties.js +2 -4
  63. package/src/functions/get-block-styles.js +9 -28
  64. package/src/functions/get-block-tag.js +1 -2
  65. package/src/functions/get-builder-search-params/fn.test.js +13 -0
  66. package/src/functions/get-builder-search-params/index.js +33 -0
  67. package/src/functions/get-content/ab-testing.js +38 -0
  68. package/src/functions/get-content/fn.test.js +31 -0
  69. package/src/functions/get-content/index.js +96 -0
  70. package/src/functions/get-content/types.js +0 -0
  71. package/src/functions/get-fetch.js +34 -0
  72. package/src/functions/get-global-this.js +18 -0
  73. package/src/functions/get-processed-block.js +22 -10
  74. package/src/functions/get-processed-block.test.js +14 -9
  75. package/src/functions/if-target.js +11 -3
  76. package/src/functions/is-browser.js +1 -3
  77. package/src/functions/is-editing.js +1 -2
  78. package/src/functions/is-iframe.js +1 -2
  79. package/src/functions/is-previewing.js +14 -0
  80. package/src/functions/is-react-native.js +1 -2
  81. package/src/functions/on-change.js +0 -1
  82. package/src/functions/on-change.test.js +1 -3
  83. package/src/functions/register-component.js +46 -27
  84. package/src/functions/register.js +29 -0
  85. package/src/functions/sanitize-styles.js +32 -0
  86. package/src/functions/set-editor-settings.js +15 -0
  87. package/src/functions/set.js +0 -1
  88. package/src/functions/set.test.js +1 -3
  89. package/src/functions/track.js +109 -13
  90. package/src/functions/transform-block.js +37 -0
  91. package/src/helpers/cookie.js +59 -0
  92. package/src/helpers/css.js +12 -0
  93. package/src/helpers/flatten.js +34 -0
  94. package/src/helpers/localStorage.js +34 -0
  95. package/src/helpers/nullable.js +4 -0
  96. package/src/helpers/sessionId.js +26 -0
  97. package/src/helpers/time.js +5 -0
  98. package/src/helpers/url.js +10 -0
  99. package/src/helpers/url.test.js +15 -0
  100. package/src/helpers/uuid.js +13 -0
  101. package/src/helpers/visitorId.js +33 -0
  102. package/src/index-helpers/blocks-exports.js +18 -0
  103. package/src/index-helpers/top-of-file.js +1 -0
  104. package/src/index.js +10 -24
  105. package/src/scripts/init-editing.js +73 -51
  106. package/src/types/builder-block.js +0 -1
  107. package/src/types/builder-content.js +0 -1
  108. package/src/types/can-track.js +0 -0
  109. package/src/types/components.js +0 -0
  110. package/src/types/deep-partial.js +0 -0
  111. package/src/types/element.js +0 -0
  112. package/src/types/targets.js +0 -0
  113. package/src/types/typescript.js +0 -0
  114. package/index.js +0 -11
  115. package/src/blocks/button.js +0 -37
  116. package/src/blocks/button.lite.tsx +0 -29
  117. package/src/blocks/columns.js +0 -42
  118. package/src/blocks/columns.lite.tsx +0 -41
  119. package/src/blocks/custom-code.js +0 -56
  120. package/src/blocks/embed.js +0 -56
  121. package/src/blocks/embed.lite.tsx +0 -65
  122. package/src/blocks/form.js +0 -229
  123. package/src/blocks/form.lite.tsx +0 -257
  124. package/src/blocks/image.js +0 -123
  125. package/src/blocks/image.lite.tsx +0 -35
  126. package/src/blocks/img.js +0 -41
  127. package/src/blocks/img.lite.tsx +0 -19
  128. package/src/blocks/input.js +0 -41
  129. package/src/blocks/input.lite.tsx +0 -23
  130. package/src/blocks/raw-text.js +0 -17
  131. package/src/blocks/raw-text.lite.tsx +0 -12
  132. package/src/blocks/section.js +0 -36
  133. package/src/blocks/section.lite.tsx +0 -20
  134. package/src/blocks/select.js +0 -40
  135. package/src/blocks/select.lite.tsx +0 -24
  136. package/src/blocks/submit-button.js +0 -34
  137. package/src/blocks/submit-button.lite.tsx +0 -11
  138. package/src/blocks/symbol.js +0 -20
  139. package/src/blocks/symbol.lite.tsx +0 -20
  140. package/src/blocks/text.lite.tsx +0 -12
  141. package/src/blocks/textarea.js +0 -37
  142. package/src/blocks/textarea.lite.tsx +0 -15
  143. package/src/blocks/video.js +0 -49
  144. package/src/blocks/video.lite.tsx +0 -28
  145. package/src/components/render-block.js +0 -84
  146. package/src/components/render-block.lite.tsx +0 -92
  147. package/src/components/render-blocks.lite.tsx +0 -56
  148. package/src/components/render-content.js +0 -66
  149. package/src/components/render-content.lite.tsx +0 -95
  150. package/src/functions/get-content.js +0 -103
  151. package/src/functions/get-target.js +0 -7
  152. package/src/functions/macro-eval.js +0 -6
  153. package/src/package.json +0 -18
@@ -1,257 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useState, useContext, useRef } from "react";
4
- import { BuilderBlockComponent as BuilderBlock } from "@dummy";
5
- import { Builder, builder } from "@builder.io/sdk";
6
- import { BuilderBlocks } from "@dummy";
7
- import { set } from "@dummy";
8
- import { get } from "@dummy";
9
-
10
- export default function FormComponent(props) {
11
- const [state, setState] = useState(() => "unsubmitted");
12
-
13
- const [responseData, setResponseData] = useState(() => null);
14
-
15
- const [formErrorMessage, setFormErrorMessage] = useState(() => "");
16
-
17
- function submissionState() {
18
- return (Builder.isEditing && props.previewState) || state;
19
- }
20
-
21
- function onSubmit(event) {
22
- const sendWithJs = props.sendWithJs || props.sendSubmissionsTo === "email";
23
-
24
- if (props.sendSubmissionsTo === "zapier") {
25
- event.preventDefault();
26
- } else if (sendWithJs) {
27
- if (!(props.action || props.sendSubmissionsTo === "email")) {
28
- event.preventDefault();
29
- return;
30
- }
31
-
32
- event.preventDefault();
33
- const el = event.currentTarget;
34
- const headers = props.customHeaders || {};
35
- let body;
36
- const formData = new FormData(el); // TODO: maybe support null
37
-
38
- const formPairs = Array.from(
39
- event.currentTarget.querySelectorAll("input,select,textarea")
40
- )
41
- .filter((el) => !!el.name)
42
- .map((el) => {
43
- let value;
44
- const key = el.name;
45
-
46
- if (el instanceof HTMLInputElement) {
47
- if (el.type === "radio") {
48
- if (el.checked) {
49
- value = el.name;
50
- return {
51
- key,
52
- value,
53
- };
54
- }
55
- } else if (el.type === "checkbox") {
56
- value = el.checked;
57
- } else if (el.type === "number" || el.type === "range") {
58
- const num = el.valueAsNumber;
59
-
60
- if (!isNaN(num)) {
61
- value = num;
62
- }
63
- } else if (el.type === "file") {
64
- // TODO: one vs multiple files
65
- value = el.files;
66
- } else {
67
- value = el.value;
68
- }
69
- } else {
70
- value = el.value;
71
- }
72
-
73
- return {
74
- key,
75
- value,
76
- };
77
- });
78
- let contentType = props.contentType;
79
-
80
- if (props.sendSubmissionsTo === "email") {
81
- contentType = "multipart/form-data";
82
- }
83
-
84
- Array.from(formPairs).forEach(({ value }) => {
85
- if (
86
- value instanceof File ||
87
- (Array.isArray(value) && value[0] instanceof File) ||
88
- value instanceof FileList
89
- ) {
90
- contentType = "multipart/form-data";
91
- }
92
- }); // TODO: send as urlEncoded or multipart by default
93
- // because of ease of use and reliability in browser API
94
- // for encoding the form?
95
-
96
- if (contentType !== "application/json") {
97
- body = formData;
98
- } else {
99
- // Json
100
- const json = {};
101
- Array.from(formPairs).forEach(({ value, key }) => {
102
- set(json, key, value);
103
- });
104
- body = JSON.stringify(json);
105
- }
106
-
107
- if (contentType && contentType !== "multipart/form-data") {
108
- if (
109
- /* Zapier doesn't allow content-type header to be sent from browsers */ !(
110
- sendWithJs && props.action?.includes("zapier.com")
111
- )
112
- ) {
113
- headers["content-type"] = contentType;
114
- }
115
- }
116
- const presubmitEvent = new CustomEvent("presubmit", { detail: { body } });
117
- if (formRef.current) {
118
- formRef.current.dispatchEvent(presubmitEvent);
119
- if (presubmitEvent.defaultPrevented) {
120
- return;
121
- }
122
- }
123
- setState("sending");
124
- const formUrl = `${
125
- builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"
126
- }/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(
127
- props.sendSubmissionsToEmail || ""
128
- )}&name=${encodeURIComponent(props.name || "")}`;
129
- fetch(
130
- props.sendSubmissionsTo === "email"
131
- ? formUrl
132
- : props.action /* TODO: throw error if no action URL */,
133
- { body, headers, method: props.method || "post" }
134
- ).then(
135
- async (res) => {
136
- let body;
137
- const contentType = res.headers.get("content-type");
138
- if (contentType && contentType.indexOf("application/json") !== -1) {
139
- body = await res.json();
140
- } else {
141
- body = await res.text();
142
- }
143
- if (!res.ok && props.errorMessagePath) {
144
- /* TODO: allow supplying an error formatter function */ let message =
145
- get(body, props.errorMessagePath);
146
- if (message) {
147
- if (typeof message !== "string") {
148
- /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
149
- JSON.stringify(message);
150
- }
151
- setFormErrorMessage(message);
152
- }
153
- }
154
- setResponseData(body);
155
- setState(res.ok ? "success" : "error");
156
- if (res.ok) {
157
- const submitSuccessEvent = new CustomEvent("submit:success", {
158
- detail: { res, body },
159
- });
160
- if (formRef.current) {
161
- formRef.current.dispatchEvent(submitSuccessEvent);
162
- if (submitSuccessEvent.defaultPrevented) {
163
- return;
164
- }
165
- /* TODO: option to turn this on/off? */ if (
166
- props.resetFormOnSubmit !== false
167
- ) {
168
- formRef.current.reset();
169
- }
170
- }
171
- /* TODO: client side route event first that can be preventDefaulted */ if (
172
- props.successUrl
173
- ) {
174
- if (formRef.current) {
175
- const event = new CustomEvent("route", {
176
- detail: { url: props.successUrl },
177
- });
178
- formRef.current.dispatchEvent(event);
179
- if (!event.defaultPrevented) {
180
- location.href = props.successUrl;
181
- }
182
- } else {
183
- location.href = props.successUrl;
184
- }
185
- }
186
- }
187
- },
188
- (err) => {
189
- const submitErrorEvent = new CustomEvent("submit:error", {
190
- detail: { error: err },
191
- });
192
- if (formRef.current) {
193
- formRef.current.dispatchEvent(submitErrorEvent);
194
- if (submitErrorEvent.defaultPrevented) {
195
- return;
196
- }
197
- }
198
- setResponseData(err);
199
- setState("error");
200
- }
201
- );
202
- }
203
- }
204
- const formRef = useRef();
205
- return (
206
- <View
207
- {...props.attributes}
208
- validate={props.validate}
209
- ref={formRef}
210
- action={!props.sendWithJs && props.action}
211
- method={props.method}
212
- name={props.name}
213
- onSubmit={(event) => onSubmit(event)}
214
- >
215
- {" "}
216
- {props.builderBlock && props.builderBlock.children && (
217
- <>
218
- {props.builderBlock?.children.map((block) => (
219
- <BuilderBlockComponent block={block} />
220
- ))}
221
- </>
222
- )}{" "}
223
- {submissionState() === "error" && (
224
- <>
225
- <BuilderBlocks dataPath="errorMessage" blocks={props.errorMessage} />
226
- </>
227
- )}{" "}
228
- {submissionState() === "sending" && (
229
- <>
230
- <BuilderBlocks
231
- dataPath="sendingMessage"
232
- blocks={props.sendingMessage}
233
- />
234
- </>
235
- )}{" "}
236
- {submissionState() === "error" && responseData && (
237
- <>
238
- <View className="builder-form-error-text" style={styles.view1}>
239
- {" "}
240
- {JSON.stringify(responseData, null, 2)}{" "}
241
- </View>
242
- </>
243
- )}{" "}
244
- {submissionState() === "success" && (
245
- <>
246
- <BuilderBlocks
247
- dataPath="successMessage"
248
- blocks={props.successMessage}
249
- />
250
- </>
251
- )}{" "}
252
- </View>
253
- );
254
- }
255
- const styles = StyleSheet.create({
256
- view1: { padding: 10, color: "red", textAlign: "center" },
257
- });
@@ -1,123 +0,0 @@
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("div", {
12
- className: "builder-image-sizer",
13
- style: {
14
- width: "100%",
15
- paddingTop: props.aspectRatio * 100 + "%",
16
- pointerEvents: "none",
17
- fontSize: 0
18
- }
19
- }, " "));
20
- }
21
- registerComponent(Image, {
22
- name: "Image",
23
- static: true,
24
- 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",
25
- defaultStyles: {
26
- position: "relative",
27
- minHeight: "20px",
28
- minWidth: "20px",
29
- overflow: "hidden"
30
- },
31
- canHaveChildren: true,
32
- inputs: [
33
- {
34
- name: "image",
35
- type: "file",
36
- bubble: true,
37
- allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
38
- required: true,
39
- defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
40
- 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); } } }); }"
41
- },
42
- {
43
- name: "backgroundSize",
44
- type: "text",
45
- defaultValue: "cover",
46
- enum: [
47
- {
48
- label: "contain",
49
- value: "contain",
50
- helperText: "The image should never get cropped"
51
- },
52
- {
53
- label: "cover",
54
- value: "cover",
55
- helperText: `The image should fill it's box, cropping when needed`
56
- }
57
- ]
58
- },
59
- {
60
- name: "backgroundPosition",
61
- type: "text",
62
- defaultValue: "center",
63
- enum: [
64
- "center",
65
- "top",
66
- "left",
67
- "right",
68
- "bottom",
69
- "top left",
70
- "top right",
71
- "bottom left",
72
- "bottom right"
73
- ]
74
- },
75
- {
76
- name: "altText",
77
- type: "string",
78
- helperText: "Text to display when the user has images off"
79
- },
80
- {
81
- name: "height",
82
- type: "number",
83
- hideFromUI: true
84
- },
85
- {
86
- name: "width",
87
- type: "number",
88
- hideFromUI: true
89
- },
90
- {
91
- name: "sizes",
92
- type: "string",
93
- hideFromUI: true
94
- },
95
- {
96
- name: "srcset",
97
- type: "string",
98
- hideFromUI: true
99
- },
100
- {
101
- name: "lazy",
102
- type: "boolean",
103
- defaultValue: true,
104
- hideFromUI: true
105
- },
106
- {
107
- name: "fitContent",
108
- type: "boolean",
109
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
110
- defaultValue: true
111
- },
112
- {
113
- name: "aspectRatio",
114
- type: "number",
115
- 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",
116
- advanced: true,
117
- defaultValue: 0.7041
118
- }
119
- ]
120
- });
121
- export {
122
- Image as default
123
- };
@@ -1,35 +0,0 @@
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
- <>
8
- <View>
9
- <View
10
- loading="lazy"
11
- alt={props.altText}
12
- aria-role={props.altText ? "presentation" : undefined}
13
- className={"builder-image" + (props.class ? " " + props.class : "")}
14
- src={props.image}
15
- srcset={props.srcset}
16
- sizes={props.sizes}
17
- style={styles.view1}
18
- />
19
-
20
- <View srcSet={props.srcset} />
21
- </View>
22
-
23
- {props.children}
24
- </>
25
- );
26
- }
27
-
28
- const styles = StyleSheet.create({
29
- view1: {
30
- opacity: 1,
31
- transition: "opacity 0.2s ease-in-out",
32
- objectFit: "cover",
33
- objectPosition: "center",
34
- },
35
- });
package/src/blocks/img.js DELETED
@@ -1,41 +0,0 @@
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 { Builder } from "@builder.io/sdk";
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: Builder.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,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});
@@ -1,19 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
- import { Builder } from "@builder.io/sdk";
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={(Builder.isEditing && props.imgSrc) || "default-key"}
15
- alt={props.altText}
16
- src={props.imgSrc}
17
- />
18
- );
19
- }
@@ -1,41 +0,0 @@
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 { Builder } from "@builder.io/sdk";
25
- function FormInputComponent(props) {
26
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
- key: Builder.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',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'}});
@@ -1,23 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
- import { Builder } from "@builder.io/sdk";
5
-
6
- export default function FormInputComponent(props) {
7
- return (
8
- <View
9
- {...props.attributes}
10
- key={
11
- Builder.isEditing && props.defaultValue
12
- ? props.defaultValue
13
- : "default-key"
14
- }
15
- placeholder={props.placeholder}
16
- type={props.type}
17
- name={props.name}
18
- value={props.value}
19
- defaultValue={props.defaultValue}
20
- required={props.required}
21
- />
22
- );
23
- }
@@ -1,17 +0,0 @@
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,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
@@ -1,12 +0,0 @@
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
- }
@@ -1,36 +0,0 @@
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
- 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
- }), props.children);
30
- }
31
- export {
32
- SectionComponent as default
33
- };
34
-
35
-
36
- registerComponent(SectionComponent, {name:'Core:Section',static: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>"}}}]});
@@ -1,20 +0,0 @@
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 SectionComponent(props) {
6
- return (
7
- <View
8
- {...props.attributes}
9
- style={
10
- props.maxWidth && typeof props.maxWidth === "number"
11
- ? {
12
- maxWidth: props.maxWidth,
13
- }
14
- : undefined
15
- }
16
- >
17
- {props.children}
18
- </View>
19
- );
20
- }
@@ -1,40 +0,0 @@
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 { Builder } from "@builder.io/sdk";
25
- function SelectComponent(props) {
26
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
- value: props.value,
28
- key: Builder.isEditing && props.defaultValue ? props.defaultValue : "default-key",
29
- defaultValue: props.defaultValue,
30
- name: props.name
31
- }), props.options.map((option) => /* @__PURE__ */ React.createElement(View, {
32
- value: option.value
33
- }, option.name || option.value)));
34
- }
35
- export {
36
- SelectComponent as default
37
- };
38
-
39
-
40
- registerComponent(SelectComponent, {name:'Form:Select',image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',defaultStyles:{alignSelf:'flex-start'},inputs:[{name:'options',type:'list',required:true,subFields:[{name:'value',type:'text',required:true},{name:'name',type:'text'}],defaultValue:[{value:'option 1'},{value:'option 2'}]},{name:'name',type:'string',required:true,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',defaultValue:false}],static:true,noWrap:true});