@builder.io/sdk-react-native 0.0.1-6 → 0.0.1-60

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 (131) 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 +31 -0
  5. package/src/blocks/button/component-info.js +42 -0
  6. package/src/blocks/columns/columns.js +59 -0
  7. package/src/blocks/columns/component-info.js +218 -0
  8. package/src/blocks/custom-code/component-info.js +32 -0
  9. package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.js} +16 -33
  10. package/src/blocks/embed/component-info.js +25 -0
  11. package/src/blocks/{embed.lite.tsx → embed/embed.js} +16 -31
  12. package/src/blocks/form/component-info.js +263 -0
  13. package/src/blocks/form/form.js +221 -0
  14. package/src/blocks/fragment/component-info.js +12 -0
  15. package/src/blocks/fragment/fragment.js +8 -0
  16. package/src/blocks/{image.js → image/component-info.js} +5 -23
  17. package/src/blocks/image/image.js +41 -0
  18. package/src/blocks/img/component-info.js +21 -0
  19. package/src/blocks/img/img.js +36 -0
  20. package/src/blocks/input/component-info.js +75 -0
  21. package/src/blocks/input/input.js +36 -0
  22. package/src/blocks/raw-text/component-info.js +17 -0
  23. package/src/blocks/raw-text/raw-text.js +10 -0
  24. package/src/blocks/section/component-info.js +50 -0
  25. package/src/blocks/section/section.js +31 -0
  26. package/src/blocks/select/component-info.js +60 -0
  27. package/src/blocks/select/select.js +36 -0
  28. package/src/blocks/submit-button/component-info.js +29 -0
  29. package/src/blocks/submit-button/submit-button.js +29 -0
  30. package/src/blocks/symbol/component-info.js +44 -0
  31. package/src/blocks/symbol/symbol.js +68 -0
  32. package/src/blocks/{text.js → text/component-info.js} +4 -10
  33. package/src/blocks/text/text.js +65 -0
  34. package/src/blocks/textarea/component-info.js +48 -0
  35. package/src/blocks/textarea/textarea.js +32 -0
  36. package/src/blocks/video/component-info.js +107 -0
  37. package/src/blocks/video/video.js +33 -0
  38. package/src/components/render-block/block-styles.js +40 -0
  39. package/src/components/render-block/render-block.helpers.js +24 -0
  40. package/src/components/render-block/render-block.js +171 -0
  41. package/src/components/render-block/render-component.js +33 -0
  42. package/src/components/render-block/render-repeated-block.js +29 -0
  43. package/src/components/render-blocks.js +23 -12
  44. package/src/components/render-content/components/render-styles.js +58 -0
  45. package/src/components/render-content/index.js +5 -0
  46. package/src/components/render-content/render-content.js +254 -0
  47. package/src/components/render-inlined-styles.js +18 -0
  48. package/src/constants/builder-registered-components.js +43 -0
  49. package/src/constants/device-sizes.js +3 -21
  50. package/src/constants/target.js +5 -0
  51. package/src/context/builder.context.js +7 -1
  52. package/src/functions/camel-to-kebab-case.js +5 -0
  53. package/src/functions/convert-style-object.js +7 -0
  54. package/src/functions/evaluate.js +17 -8
  55. package/src/functions/event-handler-name.js +8 -0
  56. package/src/functions/fast-clone.js +5 -0
  57. package/src/functions/get-block-actions.js +14 -13
  58. package/src/functions/get-block-component-options.js +22 -1
  59. package/src/functions/get-block-properties.js +2 -3
  60. package/src/functions/get-block-styles.js +9 -19
  61. package/src/functions/get-builder-search-params/fn.test.js +14 -0
  62. package/src/functions/get-builder-search-params/index.js +23 -0
  63. package/src/functions/get-content/fn.test.js +32 -0
  64. package/src/functions/get-content/index.js +139 -0
  65. package/src/functions/get-fetch.js +35 -0
  66. package/src/functions/get-global-this.js +19 -0
  67. package/src/functions/get-processed-block.js +18 -9
  68. package/src/functions/get-processed-block.test.js +14 -8
  69. package/src/functions/if-target.js +11 -2
  70. package/src/functions/is-browser.js +1 -2
  71. package/src/functions/is-editing.js +1 -1
  72. package/src/functions/is-iframe.js +1 -1
  73. package/src/functions/is-previewing.js +15 -0
  74. package/src/functions/is-react-native.js +1 -1
  75. package/src/functions/on-change.test.js +1 -2
  76. package/src/functions/previewing-model-name.js +12 -0
  77. package/src/functions/register-component.js +31 -13
  78. package/src/functions/register.js +30 -0
  79. package/src/functions/sanitize-styles.js +33 -0
  80. package/src/functions/set-editor-settings.js +16 -0
  81. package/src/functions/set.test.js +1 -2
  82. package/src/functions/track.js +7 -3
  83. package/src/functions/transform-block.js +38 -0
  84. package/src/helpers/css.js +13 -0
  85. package/src/index-helpers/blocks-exports.js +19 -0
  86. package/src/index-helpers/top-of-file.js +2 -0
  87. package/src/index.js +10 -23
  88. package/src/scripts/init-editing.js +73 -49
  89. package/src/types/components.js +1 -0
  90. package/src/types/deep-partial.js +1 -0
  91. package/src/types/element.js +1 -0
  92. package/src/types/targets.js +1 -0
  93. package/src/types/typescript.js +1 -0
  94. package/index.js +0 -11
  95. package/src/blocks/button.js +0 -37
  96. package/src/blocks/button.lite.tsx +0 -29
  97. package/src/blocks/columns.js +0 -42
  98. package/src/blocks/columns.lite.tsx +0 -41
  99. package/src/blocks/custom-code.js +0 -56
  100. package/src/blocks/embed.js +0 -56
  101. package/src/blocks/form.js +0 -229
  102. package/src/blocks/form.lite.tsx +0 -257
  103. package/src/blocks/image.lite.tsx +0 -35
  104. package/src/blocks/img.js +0 -41
  105. package/src/blocks/img.lite.tsx +0 -19
  106. package/src/blocks/input.js +0 -41
  107. package/src/blocks/input.lite.tsx +0 -23
  108. package/src/blocks/raw-text.js +0 -17
  109. package/src/blocks/raw-text.lite.tsx +0 -12
  110. package/src/blocks/section.js +0 -36
  111. package/src/blocks/section.lite.tsx +0 -20
  112. package/src/blocks/select.js +0 -40
  113. package/src/blocks/select.lite.tsx +0 -24
  114. package/src/blocks/submit-button.js +0 -34
  115. package/src/blocks/submit-button.lite.tsx +0 -11
  116. package/src/blocks/symbol.js +0 -20
  117. package/src/blocks/symbol.lite.tsx +0 -20
  118. package/src/blocks/text.lite.tsx +0 -12
  119. package/src/blocks/textarea.js +0 -37
  120. package/src/blocks/textarea.lite.tsx +0 -15
  121. package/src/blocks/video.js +0 -49
  122. package/src/blocks/video.lite.tsx +0 -28
  123. package/src/components/render-block.js +0 -84
  124. package/src/components/render-block.lite.tsx +0 -92
  125. package/src/components/render-blocks.lite.tsx +0 -56
  126. package/src/components/render-content.js +0 -66
  127. package/src/components/render-content.lite.tsx +0 -95
  128. package/src/functions/get-content.js +0 -103
  129. package/src/functions/get-target.js +0 -7
  130. package/src/functions/macro-eval.js +0 -6
  131. package/src/package.json +0 -18
@@ -0,0 +1,263 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Form:Form",
4
+ builtIn: true,
5
+ defaults: {
6
+ responsiveStyles: {
7
+ large: {
8
+ marginTop: "15px",
9
+ paddingBottom: "15px"
10
+ }
11
+ }
12
+ },
13
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
14
+ inputs: [
15
+ {
16
+ name: "sendSubmissionsTo",
17
+ type: "string",
18
+ enum: [
19
+ {
20
+ label: "Send to email",
21
+ value: "email",
22
+ helperText: "Send form submissions to the email address of your choosing"
23
+ },
24
+ {
25
+ label: "Custom",
26
+ value: "custom",
27
+ helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
28
+ }
29
+ ],
30
+ defaultValue: "email"
31
+ },
32
+ {
33
+ name: "sendSubmissionsToEmail",
34
+ type: "string",
35
+ required: true,
36
+ defaultValue: "your@email.com",
37
+ showIf: 'options.get("sendSubmissionsTo") === "email"'
38
+ },
39
+ {
40
+ name: "sendWithJs",
41
+ type: "boolean",
42
+ helperText: "Set to false to use basic html form action",
43
+ defaultValue: true,
44
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
45
+ },
46
+ {
47
+ name: "name",
48
+ type: "string",
49
+ defaultValue: "My form"
50
+ },
51
+ {
52
+ name: "action",
53
+ type: "string",
54
+ helperText: "URL to send the form data to",
55
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
56
+ },
57
+ {
58
+ name: "contentType",
59
+ type: "string",
60
+ defaultValue: "application/json",
61
+ advanced: true,
62
+ enum: [
63
+ "application/json",
64
+ "multipart/form-data",
65
+ "application/x-www-form-urlencoded"
66
+ ],
67
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
68
+ },
69
+ {
70
+ name: "method",
71
+ type: "string",
72
+ showIf: 'options.get("sendSubmissionsTo") === "custom"',
73
+ defaultValue: "POST",
74
+ advanced: true
75
+ },
76
+ {
77
+ name: "previewState",
78
+ type: "string",
79
+ enum: ["unsubmitted", "sending", "success", "error"],
80
+ defaultValue: "unsubmitted",
81
+ helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
82
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
83
+ },
84
+ {
85
+ name: "successUrl",
86
+ type: "url",
87
+ helperText: "Optional URL to redirect the user to on form submission success",
88
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
89
+ },
90
+ {
91
+ name: "resetFormOnSubmit",
92
+ type: "boolean",
93
+ showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
94
+ advanced: true
95
+ },
96
+ {
97
+ name: "successMessage",
98
+ type: "uiBlocks",
99
+ hideFromUI: true,
100
+ defaultValue: [
101
+ {
102
+ "@type": "@builder.io/sdk:Element",
103
+ responsiveStyles: {
104
+ large: {
105
+ marginTop: "10px"
106
+ }
107
+ },
108
+ component: {
109
+ name: "Text",
110
+ options: {
111
+ text: "<span>Thanks!</span>"
112
+ }
113
+ }
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ name: "validate",
119
+ type: "boolean",
120
+ defaultValue: true,
121
+ advanced: true
122
+ },
123
+ {
124
+ name: "errorMessagePath",
125
+ type: "text",
126
+ advanced: true,
127
+ helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
128
+ },
129
+ {
130
+ name: "errorMessage",
131
+ type: "uiBlocks",
132
+ hideFromUI: true,
133
+ defaultValue: [
134
+ {
135
+ "@type": "@builder.io/sdk:Element",
136
+ responsiveStyles: {
137
+ large: {
138
+ marginTop: "10px"
139
+ }
140
+ },
141
+ bindings: {
142
+ "component.options.text": "state.formErrorMessage || block.component.options.text"
143
+ },
144
+ component: {
145
+ name: "Text",
146
+ options: {
147
+ text: "<span>Form submission error :( Please check your answers and try again</span>"
148
+ }
149
+ }
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ name: "sendingMessage",
155
+ type: "uiBlocks",
156
+ hideFromUI: true,
157
+ defaultValue: [
158
+ {
159
+ "@type": "@builder.io/sdk:Element",
160
+ responsiveStyles: {
161
+ large: {
162
+ marginTop: "10px"
163
+ }
164
+ },
165
+ component: {
166
+ name: "Text",
167
+ options: {
168
+ text: "<span>Sending...</span>"
169
+ }
170
+ }
171
+ }
172
+ ]
173
+ },
174
+ {
175
+ name: "customHeaders",
176
+ type: "map",
177
+ valueType: {
178
+ type: "string"
179
+ },
180
+ advanced: true,
181
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
182
+ }
183
+ ],
184
+ noWrap: true,
185
+ canHaveChildren: true,
186
+ defaultChildren: [
187
+ {
188
+ "@type": "@builder.io/sdk:Element",
189
+ responsiveStyles: {
190
+ large: {
191
+ marginTop: "10px"
192
+ }
193
+ },
194
+ component: {
195
+ name: "Text",
196
+ options: {
197
+ text: "<span>Enter your name</span>"
198
+ }
199
+ }
200
+ },
201
+ {
202
+ "@type": "@builder.io/sdk:Element",
203
+ responsiveStyles: {
204
+ large: {
205
+ marginTop: "10px"
206
+ }
207
+ },
208
+ component: {
209
+ name: "Form:Input",
210
+ options: {
211
+ name: "name",
212
+ placeholder: "Jane Doe"
213
+ }
214
+ }
215
+ },
216
+ {
217
+ "@type": "@builder.io/sdk:Element",
218
+ responsiveStyles: {
219
+ large: {
220
+ marginTop: "10px"
221
+ }
222
+ },
223
+ component: {
224
+ name: "Text",
225
+ options: {
226
+ text: "<span>Enter your email</span>"
227
+ }
228
+ }
229
+ },
230
+ {
231
+ "@type": "@builder.io/sdk:Element",
232
+ responsiveStyles: {
233
+ large: {
234
+ marginTop: "10px"
235
+ }
236
+ },
237
+ component: {
238
+ name: "Form:Input",
239
+ options: {
240
+ name: "email",
241
+ placeholder: "jane@doe.com"
242
+ }
243
+ }
244
+ },
245
+ {
246
+ "@type": "@builder.io/sdk:Element",
247
+ responsiveStyles: {
248
+ large: {
249
+ marginTop: "10px"
250
+ }
251
+ },
252
+ component: {
253
+ name: "Form:SubmitButton",
254
+ options: {
255
+ text: "Submit"
256
+ }
257
+ }
258
+ }
259
+ ]
260
+ };
261
+ export {
262
+ componentInfo
263
+ };
@@ -0,0 +1,221 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
40
+ import * as React from "react";
41
+ import { View, StyleSheet, Text } from "react-native";
42
+ import { useState, useRef } from "react";
43
+ import RenderBlock from "../../components/render-block/render-block.js";
44
+ import { isEditing } from "../../functions/is-editing.js";
45
+ function FormComponent(props) {
46
+ var _a, _b;
47
+ const formRef = useRef(null);
48
+ const [formState, setFormState] = useState(() => "unsubmitted");
49
+ const [responseData, setResponseData] = useState(() => null);
50
+ const [formErrorMessage, setFormErrorMessage] = useState(() => "");
51
+ function submissionState() {
52
+ return isEditing() && props.previewState || formState;
53
+ }
54
+ function onSubmit(event) {
55
+ var _a2;
56
+ const sendWithJs = props.sendWithJs || props.sendSubmissionsTo === "email";
57
+ if (props.sendSubmissionsTo === "zapier") {
58
+ event.preventDefault();
59
+ } else if (sendWithJs) {
60
+ if (!(props.action || props.sendSubmissionsTo === "email")) {
61
+ event.preventDefault();
62
+ return;
63
+ }
64
+ event.preventDefault();
65
+ const el = event.currentTarget;
66
+ const headers = props.customHeaders || {};
67
+ let body;
68
+ const formData = new FormData(el);
69
+ const formPairs = Array.from(event.currentTarget.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
70
+ let value;
71
+ const key = el2.name;
72
+ if (el2 instanceof HTMLInputElement) {
73
+ if (el2.type === "radio") {
74
+ if (el2.checked) {
75
+ value = el2.name;
76
+ return {
77
+ key,
78
+ value
79
+ };
80
+ }
81
+ } else if (el2.type === "checkbox") {
82
+ value = el2.checked;
83
+ } else if (el2.type === "number" || el2.type === "range") {
84
+ const num = el2.valueAsNumber;
85
+ if (!isNaN(num)) {
86
+ value = num;
87
+ }
88
+ } else if (el2.type === "file") {
89
+ value = el2.files;
90
+ } else {
91
+ value = el2.value;
92
+ }
93
+ } else {
94
+ value = el2.value;
95
+ }
96
+ return {
97
+ key,
98
+ value
99
+ };
100
+ });
101
+ let contentType = props.contentType;
102
+ if (props.sendSubmissionsTo === "email") {
103
+ contentType = "multipart/form-data";
104
+ }
105
+ Array.from(formPairs).forEach(({ value }) => {
106
+ if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
107
+ contentType = "multipart/form-data";
108
+ }
109
+ });
110
+ if (contentType !== "application/json") {
111
+ body = formData;
112
+ } else {
113
+ const json = {};
114
+ Array.from(formPairs).forEach(({ value, key }) => {
115
+ set(json, key, value);
116
+ });
117
+ body = JSON.stringify(json);
118
+ }
119
+ if (contentType && contentType !== "multipart/form-data") {
120
+ if (!(sendWithJs && ((_a2 = props.action) == null ? void 0 : _a2.includes("zapier.com")))) {
121
+ headers["content-type"] = contentType;
122
+ }
123
+ }
124
+ const presubmitEvent = new CustomEvent("presubmit", { detail: { body } });
125
+ if (formRef.current) {
126
+ formRef.current.dispatchEvent(presubmitEvent);
127
+ if (presubmitEvent.defaultPrevented) {
128
+ return;
129
+ }
130
+ }
131
+ setFormState("sending");
132
+ const formUrl = `${builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
133
+ fetch(props.sendSubmissionsTo === "email" ? formUrl : props.action, { body, headers, method: props.method || "post" }).then((res) => __async(this, null, function* () {
134
+ let body2;
135
+ const contentType2 = res.headers.get("content-type");
136
+ if (contentType2 && contentType2.indexOf("application/json") !== -1) {
137
+ body2 = yield res.json();
138
+ } else {
139
+ body2 = yield res.text();
140
+ }
141
+ if (!res.ok && props.errorMessagePath) {
142
+ let message = get(body2, props.errorMessagePath);
143
+ if (message) {
144
+ if (typeof message !== "string") {
145
+ message = JSON.stringify(message);
146
+ }
147
+ setFormErrorMessage(message);
148
+ }
149
+ }
150
+ setResponseData(body2);
151
+ setFormState(res.ok ? "success" : "error");
152
+ if (res.ok) {
153
+ const submitSuccessEvent = new CustomEvent("submit:success", {
154
+ detail: { res, body: body2 }
155
+ });
156
+ if (formRef.current) {
157
+ formRef.current.dispatchEvent(submitSuccessEvent);
158
+ if (submitSuccessEvent.defaultPrevented) {
159
+ return;
160
+ }
161
+ if (props.resetFormOnSubmit !== false) {
162
+ formRef.current.reset();
163
+ }
164
+ }
165
+ if (props.successUrl) {
166
+ if (formRef.current) {
167
+ const event2 = new CustomEvent("route", {
168
+ detail: { url: props.successUrl }
169
+ });
170
+ formRef.current.dispatchEvent(event2);
171
+ if (!event2.defaultPrevented) {
172
+ location.href = props.successUrl;
173
+ }
174
+ } else {
175
+ location.href = props.successUrl;
176
+ }
177
+ }
178
+ }
179
+ }), (err) => {
180
+ const submitErrorEvent = new CustomEvent("submit:error", {
181
+ detail: { error: err }
182
+ });
183
+ if (formRef.current) {
184
+ formRef.current.dispatchEvent(submitErrorEvent);
185
+ if (submitErrorEvent.defaultPrevented) {
186
+ return;
187
+ }
188
+ }
189
+ setResponseData(err);
190
+ setFormState("error");
191
+ });
192
+ }
193
+ }
194
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
195
+ validate: props.validate,
196
+ ref: formRef,
197
+ action: !props.sendWithJs && props.action,
198
+ method: props.method,
199
+ name: props.name,
200
+ onSubmit: (event) => onSubmit(event)
201
+ }), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
202
+ block
203
+ }))) : null, " ", submissionState() === "error" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
204
+ dataPath: "errorMessage",
205
+ blocks: props.errorMessage
206
+ })) : null, " ", submissionState() === "sending" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
207
+ dataPath: "sendingMessage",
208
+ blocks: props.sendingMessage
209
+ })) : null, " ", submissionState() === "error" && responseData ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
210
+ style: styles.view1
211
+ }, " ", /* @__PURE__ */ React.createElement(Text, null, JSON.stringify(responseData, null, 2)), " ")) : null, " ", submissionState() === "success" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
212
+ dataPath: "successMessage",
213
+ blocks: props.successMessage
214
+ })) : null, " ");
215
+ }
216
+ const styles = StyleSheet.create({
217
+ view1: { padding: 10, color: "red", textAlign: "center" }
218
+ });
219
+ export {
220
+ FormComponent as default
221
+ };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Fragment",
4
+ static: true,
5
+ hidden: true,
6
+ builtIn: true,
7
+ canHaveChildren: true,
8
+ noWrap: true
9
+ };
10
+ export {
11
+ componentInfo
12
+ };
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { View, Text } from "react-native";
3
+ function FragmentComponent(props) {
4
+ return /* @__PURE__ */ React.createElement(View, null, /* @__PURE__ */ React.createElement(Text, null, props.children));
5
+ }
6
+ export {
7
+ FragmentComponent as default
8
+ };
@@ -1,26 +1,8 @@
1
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, {
2
+ const componentInfo = {
22
3
  name: "Image",
23
4
  static: true,
5
+ builtIn: true,
24
6
  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
7
  defaultStyles: {
26
8
  position: "relative",
@@ -52,7 +34,7 @@ registerComponent(Image, {
52
34
  {
53
35
  label: "cover",
54
36
  value: "cover",
55
- helperText: `The image should fill it's box, cropping when needed`
37
+ helperText: "The image should fill it's box, cropping when needed"
56
38
  }
57
39
  ]
58
40
  },
@@ -117,7 +99,7 @@ registerComponent(Image, {
117
99
  defaultValue: 0.7041
118
100
  }
119
101
  ]
120
- });
102
+ };
121
103
  export {
122
- Image as default
104
+ componentInfo
123
105
  };
@@ -0,0 +1,41 @@
1
+ import * as React from 'react';
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ import { Image as ReactImage, View } from "react-native";
19
+ function Image(props) {
20
+ return props.aspectRatio ? /* @__PURE__ */ React.createElement(View, {
21
+ style: { position: "relative" }
22
+ }, /* @__PURE__ */ React.createElement(ReactImage, {
23
+ resizeMode: props.backgroundSize || "contain",
24
+ style: { position: "absolute", top: 0, bottom: 0, left: 0, right: 0 },
25
+ source: { uri: props.image }
26
+ }), /* @__PURE__ */ React.createElement(View, {
27
+ style: {
28
+ width: "100%",
29
+ paddingTop: props.aspectRatio * 100 + "%"
30
+ }
31
+ })) : /* @__PURE__ */ React.createElement(ReactImage, {
32
+ resizeMode: props.backgroundSize || "contain",
33
+ style: __spreadValues(__spreadValues({
34
+ position: "relative"
35
+ }, props.width ? { width: props.width } : {}), props.height ? { height: props.height } : {}),
36
+ source: { uri: props.image }
37
+ });
38
+ }
39
+ export {
40
+ Image as default
41
+ };
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Raw:Img",
4
+ hideFromInsertMenu: true,
5
+ builtIn: true,
6
+ 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",
7
+ inputs: [
8
+ {
9
+ name: "image",
10
+ bubble: true,
11
+ type: "file",
12
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
13
+ required: true
14
+ }
15
+ ],
16
+ noWrap: true,
17
+ static: true
18
+ };
19
+ export {
20
+ componentInfo
21
+ };
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { View } from "react-native";
22
+ import { isEditing } from "../../functions/is-editing.js";
23
+ function ImgComponent(props) {
24
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
25
+ style: {
26
+ objectFit: props.backgroundSize || "cover",
27
+ objectPosition: props.backgroundPosition || "center"
28
+ },
29
+ key: isEditing() && props.imgSrc || "default-key",
30
+ alt: props.altText,
31
+ src: props.imgSrc
32
+ }));
33
+ }
34
+ export {
35
+ ImgComponent as default
36
+ };