@builder.io/sdk-react-native 0.0.1-9 → 0.0.1
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/CHANGELOG.md +42 -0
- package/README.md +19 -0
- package/package.json +7 -4
- package/src/blocks/button/button.js +34 -0
- package/src/blocks/button/component-info.js +41 -0
- package/src/blocks/columns/columns.js +62 -0
- package/src/blocks/columns/component-info.js +242 -0
- package/src/blocks/custom-code/component-info.js +31 -0
- package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.js} +16 -33
- package/src/blocks/embed/component-info.js +44 -0
- package/src/blocks/embed/embed.js +43 -0
- package/src/blocks/embed/helpers.js +9 -0
- package/src/blocks/form/component-info.js +262 -0
- package/src/blocks/form/form.js +224 -0
- package/src/blocks/fragment/component-info.js +11 -0
- package/src/blocks/fragment/fragment.js +8 -0
- package/src/blocks/image/component-info.js +151 -0
- package/src/blocks/image/image.helpers.js +48 -0
- package/src/blocks/image/image.js +77 -0
- package/src/blocks/img/component-info.js +20 -0
- package/src/blocks/img/img.js +36 -0
- package/src/blocks/input/component-info.js +74 -0
- package/src/blocks/input/input.js +36 -0
- package/src/blocks/raw-text/component-info.js +16 -0
- package/src/blocks/raw-text/raw-text.js +10 -0
- package/src/blocks/section/component-info.js +49 -0
- package/src/blocks/section/section.js +31 -0
- package/src/blocks/select/component-info.js +59 -0
- package/src/blocks/select/select.js +36 -0
- package/src/blocks/submit-button/component-info.js +28 -0
- package/src/blocks/submit-button/submit-button.js +29 -0
- package/src/blocks/symbol/component-info.js +43 -0
- package/src/blocks/symbol/symbol.js +65 -0
- package/src/blocks/{text.js → text/component-info.js} +4 -11
- package/src/blocks/text/text.js +10 -0
- package/src/blocks/textarea/component-info.js +47 -0
- package/src/blocks/textarea/textarea.js +32 -0
- package/src/blocks/util.js +7 -0
- package/src/blocks/video/component-info.js +106 -0
- package/src/blocks/video/video.js +52 -0
- package/src/components/render-block/block-styles.js +37 -0
- package/src/components/render-block/render-block.helpers.js +23 -0
- package/src/components/render-block/render-block.js +171 -0
- package/src/components/render-block/render-component.js +36 -0
- package/src/components/render-block/render-repeated-block.js +30 -0
- package/src/components/render-block/types.js +0 -0
- package/src/components/render-blocks.js +29 -13
- package/src/components/render-content/components/render-styles.js +58 -0
- package/src/components/render-content/index.js +4 -0
- package/src/components/render-content/render-content.js +262 -0
- package/src/components/render-inlined-styles.js +18 -0
- package/src/constants/builder-registered-components.js +42 -0
- package/src/constants/device-sizes.js +3 -22
- package/src/constants/target.js +4 -0
- package/src/context/builder.context.js +7 -1
- package/src/context/types.js +0 -0
- package/src/functions/camel-to-kebab-case.js +4 -0
- package/src/functions/convert-style-object.js +6 -0
- package/src/functions/evaluate.js +17 -9
- package/src/functions/event-handler-name.js +7 -0
- package/src/functions/get-block-actions.js +14 -14
- package/src/functions/get-block-component-options.js +22 -2
- package/src/functions/get-block-properties.js +2 -4
- package/src/functions/get-block-styles.js +9 -28
- package/src/functions/get-block-tag.js +1 -2
- package/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/src/functions/get-builder-search-params/index.js +37 -0
- package/src/functions/get-content/ab-testing.js +38 -0
- package/src/functions/get-content/fn.test.js +31 -0
- package/src/functions/get-content/index.js +95 -0
- package/src/functions/get-content/types.js +0 -0
- package/src/functions/get-fetch.js +34 -0
- package/src/functions/get-global-this.js +18 -0
- package/src/functions/get-processed-block.js +22 -10
- package/src/functions/get-processed-block.test.js +14 -9
- package/src/functions/if-target.js +11 -3
- package/src/functions/is-browser.js +1 -3
- package/src/functions/is-editing.js +1 -2
- package/src/functions/is-iframe.js +1 -2
- package/src/functions/is-previewing.js +14 -0
- package/src/functions/mark-mutable.js +10 -0
- package/src/functions/on-change.js +0 -1
- package/src/functions/on-change.test.js +1 -3
- package/src/functions/register-component.js +46 -27
- package/src/functions/register.js +29 -0
- package/src/functions/sanitize-styles.js +32 -0
- package/src/functions/set-editor-settings.js +15 -0
- package/src/functions/set.js +0 -1
- package/src/functions/set.test.js +1 -3
- package/src/functions/track.js +109 -13
- package/src/functions/transform-block.js +37 -0
- package/src/helpers/cookie.js +59 -0
- package/src/helpers/css.js +12 -0
- package/src/helpers/flatten.js +34 -0
- package/src/helpers/localStorage.js +34 -0
- package/src/helpers/nullable.js +4 -0
- package/src/helpers/sessionId.js +26 -0
- package/src/helpers/time.js +5 -0
- package/src/helpers/url.js +10 -0
- package/src/helpers/url.test.js +15 -0
- package/src/helpers/uuid.js +13 -0
- package/src/helpers/visitorId.js +33 -0
- package/src/index-helpers/blocks-exports.js +18 -0
- package/src/index-helpers/top-of-file.js +1 -0
- package/src/index.js +10 -26
- package/src/scripts/init-editing.js +73 -51
- package/src/types/builder-block.js +0 -1
- package/src/types/builder-content.js +0 -1
- package/src/types/can-track.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
- package/src/blocks/button.js +0 -37
- package/src/blocks/button.lite.tsx +0 -29
- package/src/blocks/columns.js +0 -42
- package/src/blocks/columns.lite.tsx +0 -41
- package/src/blocks/custom-code.js +0 -56
- package/src/blocks/embed.js +0 -56
- package/src/blocks/embed.lite.tsx +0 -65
- package/src/blocks/form.js +0 -229
- package/src/blocks/form.lite.tsx +0 -257
- package/src/blocks/fragment.js +0 -16
- package/src/blocks/fragment.lite.tsx +0 -8
- package/src/blocks/image.js +0 -123
- package/src/blocks/image.lite.tsx +0 -35
- package/src/blocks/img.js +0 -41
- package/src/blocks/img.lite.tsx +0 -19
- package/src/blocks/input.js +0 -41
- package/src/blocks/input.lite.tsx +0 -23
- package/src/blocks/raw-text.js +0 -17
- package/src/blocks/raw-text.lite.tsx +0 -12
- package/src/blocks/section.js +0 -36
- package/src/blocks/section.lite.tsx +0 -20
- package/src/blocks/select.js +0 -40
- package/src/blocks/select.lite.tsx +0 -24
- package/src/blocks/submit-button.js +0 -34
- package/src/blocks/submit-button.lite.tsx +0 -11
- package/src/blocks/symbol.js +0 -20
- package/src/blocks/symbol.lite.tsx +0 -20
- package/src/blocks/text.lite.tsx +0 -12
- package/src/blocks/textarea.js +0 -37
- package/src/blocks/textarea.lite.tsx +0 -15
- package/src/blocks/video.js +0 -49
- package/src/blocks/video.lite.tsx +0 -28
- package/src/components/render-block.js +0 -84
- package/src/components/render-block.lite.tsx +0 -92
- package/src/components/render-blocks.lite.tsx +0 -56
- package/src/components/render-content.js +0 -66
- package/src/components/render-content.lite.tsx +0 -95
- package/src/functions/get-content.js +0 -103
- package/src/functions/get-target.js +0 -7
- package/src/functions/is-react-native.js +0 -7
- package/src/functions/macro-eval.js +0 -6
- package/src/package.json +0 -18
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function removeProtocol(path) {
|
|
2
|
+
return path.replace(/http(s)?:/, "");
|
|
3
|
+
}
|
|
4
|
+
function updateQueryParam(uri = "", key, value) {
|
|
5
|
+
const re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
|
6
|
+
const separator = uri.indexOf("?") !== -1 ? "&" : "?";
|
|
7
|
+
if (uri.match(re)) {
|
|
8
|
+
return uri.replace(re, "$1" + key + "=" + encodeURIComponent(value) + "$2");
|
|
9
|
+
}
|
|
10
|
+
return uri + separator + key + "=" + encodeURIComponent(value);
|
|
11
|
+
}
|
|
12
|
+
function getShopifyImageUrl(src, size) {
|
|
13
|
+
if (!src || !(src == null ? void 0 : src.match(/cdn\.shopify\.com/)) || !size) {
|
|
14
|
+
return src;
|
|
15
|
+
}
|
|
16
|
+
if (size === "master") {
|
|
17
|
+
return removeProtocol(src);
|
|
18
|
+
}
|
|
19
|
+
const match = src.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
20
|
+
if (match) {
|
|
21
|
+
const prefix = src.split(match[0]);
|
|
22
|
+
const suffix = match[3];
|
|
23
|
+
const useSize = size.match("x") ? size : `${size}x`;
|
|
24
|
+
return removeProtocol(`${prefix[0]}_${useSize}${suffix}`);
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function getSrcSet(url) {
|
|
29
|
+
if (!url) {
|
|
30
|
+
return url;
|
|
31
|
+
}
|
|
32
|
+
const sizes = [100, 200, 400, 800, 1200, 1600, 2e3];
|
|
33
|
+
if (url.match(/builder\.io/)) {
|
|
34
|
+
let srcUrl = url;
|
|
35
|
+
const widthInSrc = Number(url.split("?width=")[1]);
|
|
36
|
+
if (!isNaN(widthInSrc)) {
|
|
37
|
+
srcUrl = `${srcUrl} ${widthInSrc}w`;
|
|
38
|
+
}
|
|
39
|
+
return sizes.filter((size) => size !== widthInSrc).map((size) => `${updateQueryParam(url, "width", size)} ${size}w`).concat([srcUrl]).join(", ");
|
|
40
|
+
}
|
|
41
|
+
if (url.match(/cdn\.shopify\.com/)) {
|
|
42
|
+
return sizes.map((size) => [getShopifyImageUrl(url, `${size}x${size}`), size]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([url]).join(", ");
|
|
43
|
+
}
|
|
44
|
+
return url;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
getSrcSet
|
|
48
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet, Text } from "react-native";
|
|
3
|
+
import { getSrcSet } from "./image.helpers.js";
|
|
4
|
+
function Image(props) {
|
|
5
|
+
var _a, _b, _c, _d;
|
|
6
|
+
function srcSetToUse() {
|
|
7
|
+
var _a2;
|
|
8
|
+
const imageToUse = props.image || props.src;
|
|
9
|
+
const url = imageToUse;
|
|
10
|
+
if (!url || !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
11
|
+
return props.srcset;
|
|
12
|
+
}
|
|
13
|
+
if (props.srcset && ((_a2 = props.image) == null ? void 0 : _a2.includes("builder.io/api/v1/image"))) {
|
|
14
|
+
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
15
|
+
console.debug("Removed given srcset");
|
|
16
|
+
return getSrcSet(url);
|
|
17
|
+
}
|
|
18
|
+
} else if (props.image && !props.srcset) {
|
|
19
|
+
return getSrcSet(url);
|
|
20
|
+
}
|
|
21
|
+
return getSrcSet(url);
|
|
22
|
+
}
|
|
23
|
+
function webpSrcSet() {
|
|
24
|
+
var _a2;
|
|
25
|
+
if (((_a2 = srcSetToUse == null ? void 0 : srcSetToUse()) == null ? void 0 : _a2.match(/builder\.io/)) && !props.noWebp) {
|
|
26
|
+
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
27
|
+
} else {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ React.createElement(View, {
|
|
32
|
+
style: styles.view1
|
|
33
|
+
}, /* @__PURE__ */ React.createElement(View, null, webpSrcSet() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
|
|
34
|
+
type: "image/webp",
|
|
35
|
+
srcset: webpSrcSet()
|
|
36
|
+
})) : null, /* @__PURE__ */ React.createElement(View, {
|
|
37
|
+
loading: "lazy",
|
|
38
|
+
alt: props.altText,
|
|
39
|
+
role: props.altText ? "presentation" : void 0,
|
|
40
|
+
style: styles.view2,
|
|
41
|
+
src: props.image,
|
|
42
|
+
srcset: srcSetToUse(),
|
|
43
|
+
sizes: props.sizes
|
|
44
|
+
}), /* @__PURE__ */ React.createElement(View, {
|
|
45
|
+
srcset: srcSetToUse()
|
|
46
|
+
})), props.aspectRatio && !(props.fitContent && ((_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.length)) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
|
|
47
|
+
style: styles.view3
|
|
48
|
+
})) : null, ((_d = (_c = props.builderBlock) == null ? void 0 : _c.children) == null ? void 0 : _d.length) && props.fitContent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, null, props.children)) : null, !props.fitContent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
|
|
49
|
+
style: styles.view4
|
|
50
|
+
}, /* @__PURE__ */ React.createElement(Text, null, props.children))) : null);
|
|
51
|
+
}
|
|
52
|
+
const styles = StyleSheet.create({
|
|
53
|
+
view1: { position: "relative" },
|
|
54
|
+
view2: {
|
|
55
|
+
opacity: 1,
|
|
56
|
+
transition: "opacity 0.2s ease-in-out",
|
|
57
|
+
position: "absolute",
|
|
58
|
+
height: 100,
|
|
59
|
+
width: 100,
|
|
60
|
+
top: 0,
|
|
61
|
+
left: 0
|
|
62
|
+
},
|
|
63
|
+
view3: { width: 100, pointerEvents: "none", fontSize: 0 },
|
|
64
|
+
view4: {
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexDirection: "column",
|
|
67
|
+
alignItems: "stretch",
|
|
68
|
+
position: "absolute",
|
|
69
|
+
top: 0,
|
|
70
|
+
left: 0,
|
|
71
|
+
width: 100,
|
|
72
|
+
height: 100
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
Image as default
|
|
77
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Raw:Img",
|
|
3
|
+
hideFromInsertMenu: true,
|
|
4
|
+
builtIn: true,
|
|
5
|
+
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",
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "image",
|
|
9
|
+
bubble: true,
|
|
10
|
+
type: "file",
|
|
11
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
12
|
+
required: true
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
noWrap: true,
|
|
16
|
+
static: true
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
componentInfo
|
|
20
|
+
};
|
|
@@ -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 || props.image
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
ImgComponent as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Form:Input",
|
|
3
|
+
builtIn: true,
|
|
4
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
name: "type",
|
|
8
|
+
type: "text",
|
|
9
|
+
enum: [
|
|
10
|
+
"text",
|
|
11
|
+
"number",
|
|
12
|
+
"email",
|
|
13
|
+
"url",
|
|
14
|
+
"checkbox",
|
|
15
|
+
"radio",
|
|
16
|
+
"range",
|
|
17
|
+
"date",
|
|
18
|
+
"datetime-local",
|
|
19
|
+
"search",
|
|
20
|
+
"tel",
|
|
21
|
+
"time",
|
|
22
|
+
"file",
|
|
23
|
+
"month",
|
|
24
|
+
"week",
|
|
25
|
+
"password",
|
|
26
|
+
"color",
|
|
27
|
+
"hidden"
|
|
28
|
+
],
|
|
29
|
+
defaultValue: "text"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "name",
|
|
33
|
+
type: "string",
|
|
34
|
+
required: true,
|
|
35
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "placeholder",
|
|
39
|
+
type: "string",
|
|
40
|
+
defaultValue: "Hello there",
|
|
41
|
+
helperText: "Text to display when there is no value"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "defaultValue",
|
|
45
|
+
type: "string"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "value",
|
|
49
|
+
type: "string",
|
|
50
|
+
advanced: true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "required",
|
|
54
|
+
type: "boolean",
|
|
55
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
56
|
+
defaultValue: false
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
noWrap: true,
|
|
60
|
+
static: true,
|
|
61
|
+
defaultStyles: {
|
|
62
|
+
paddingTop: "10px",
|
|
63
|
+
paddingBottom: "10px",
|
|
64
|
+
paddingLeft: "10px",
|
|
65
|
+
paddingRight: "10px",
|
|
66
|
+
borderRadius: "3px",
|
|
67
|
+
borderWidth: "1px",
|
|
68
|
+
borderStyle: "solid",
|
|
69
|
+
borderColor: "#ccc"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
componentInfo
|
|
74
|
+
};
|
|
@@ -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 FormInputComponent(props) {
|
|
24
|
+
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
25
|
+
key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
|
|
26
|
+
placeholder: props.placeholder,
|
|
27
|
+
type: props.type,
|
|
28
|
+
name: props.name,
|
|
29
|
+
value: props.value,
|
|
30
|
+
defaultValue: props.defaultValue,
|
|
31
|
+
required: props.required
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
FormInputComponent as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Core:Section",
|
|
3
|
+
static: true,
|
|
4
|
+
builtIn: true,
|
|
5
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "maxWidth",
|
|
9
|
+
type: "number",
|
|
10
|
+
defaultValue: 1200
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "lazyLoad",
|
|
14
|
+
type: "boolean",
|
|
15
|
+
defaultValue: false,
|
|
16
|
+
advanced: true,
|
|
17
|
+
description: "Only render this section when in view"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
defaultStyles: {
|
|
21
|
+
paddingLeft: "20px",
|
|
22
|
+
paddingRight: "20px",
|
|
23
|
+
paddingTop: "50px",
|
|
24
|
+
paddingBottom: "50px",
|
|
25
|
+
marginTop: "0px",
|
|
26
|
+
width: "100vw",
|
|
27
|
+
marginLeft: "calc(50% - 50vw)"
|
|
28
|
+
},
|
|
29
|
+
canHaveChildren: true,
|
|
30
|
+
defaultChildren: [
|
|
31
|
+
{
|
|
32
|
+
"@type": "@builder.io/sdk:Element",
|
|
33
|
+
responsiveStyles: {
|
|
34
|
+
large: {
|
|
35
|
+
textAlign: "center"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
component: {
|
|
39
|
+
name: "Text",
|
|
40
|
+
options: {
|
|
41
|
+
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>"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
componentInfo
|
|
49
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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, Text } from "react-native";
|
|
22
|
+
function SectionComponent(props) {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
24
|
+
style: props.maxWidth && typeof props.maxWidth === "number" ? {
|
|
25
|
+
maxWidth: props.maxWidth
|
|
26
|
+
} : void 0
|
|
27
|
+
}), /* @__PURE__ */ React.createElement(Text, null, props.children));
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
SectionComponent as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Form:Select",
|
|
3
|
+
builtIn: true,
|
|
4
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
5
|
+
defaultStyles: {
|
|
6
|
+
alignSelf: "flex-start"
|
|
7
|
+
},
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: "options",
|
|
11
|
+
type: "list",
|
|
12
|
+
required: true,
|
|
13
|
+
subFields: [
|
|
14
|
+
{
|
|
15
|
+
name: "value",
|
|
16
|
+
type: "text",
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "name",
|
|
21
|
+
type: "text"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
defaultValue: [
|
|
25
|
+
{
|
|
26
|
+
value: "option 1"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "option 2"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "name",
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true,
|
|
37
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "defaultValue",
|
|
41
|
+
type: "string"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "value",
|
|
45
|
+
type: "string",
|
|
46
|
+
advanced: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "required",
|
|
50
|
+
type: "boolean",
|
|
51
|
+
defaultValue: false
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
static: true,
|
|
55
|
+
noWrap: true
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
componentInfo
|
|
59
|
+
};
|
|
@@ -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, Text } from "react-native";
|
|
22
|
+
import { isEditing } from "../../functions/is-editing.js";
|
|
23
|
+
function SelectComponent(props) {
|
|
24
|
+
var _a;
|
|
25
|
+
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
26
|
+
value: props.value,
|
|
27
|
+
key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
|
|
28
|
+
defaultValue: props.defaultValue,
|
|
29
|
+
name: props.name
|
|
30
|
+
}), (_a = props.options) == null ? void 0 : _a.map((option) => /* @__PURE__ */ React.createElement(View, {
|
|
31
|
+
value: option.value
|
|
32
|
+
}, /* @__PURE__ */ React.createElement(Text, null, option.name || option.value))));
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
SelectComponent as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Form:SubmitButton",
|
|
3
|
+
builtIn: true,
|
|
4
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
5
|
+
defaultStyles: {
|
|
6
|
+
appearance: "none",
|
|
7
|
+
paddingTop: "15px",
|
|
8
|
+
paddingBottom: "15px",
|
|
9
|
+
paddingLeft: "25px",
|
|
10
|
+
paddingRight: "25px",
|
|
11
|
+
backgroundColor: "#3898EC",
|
|
12
|
+
color: "white",
|
|
13
|
+
borderRadius: "4px",
|
|
14
|
+
cursor: "pointer"
|
|
15
|
+
},
|
|
16
|
+
inputs: [
|
|
17
|
+
{
|
|
18
|
+
name: "text",
|
|
19
|
+
type: "text",
|
|
20
|
+
defaultValue: "Click me"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
static: true,
|
|
24
|
+
noWrap: true
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
componentInfo
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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, Text } from "react-native";
|
|
22
|
+
function SubmitButton(props) {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
24
|
+
type: "submit"
|
|
25
|
+
}), /* @__PURE__ */ React.createElement(Text, null, props.text));
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
SubmitButton as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Symbol",
|
|
3
|
+
noWrap: true,
|
|
4
|
+
static: true,
|
|
5
|
+
builtIn: true,
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "symbol",
|
|
9
|
+
type: "uiSymbol"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "dataOnly",
|
|
13
|
+
helperText: "Make this a data symbol that doesn't display any UI",
|
|
14
|
+
type: "boolean",
|
|
15
|
+
defaultValue: false,
|
|
16
|
+
advanced: true,
|
|
17
|
+
hideFromUI: true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "inheritState",
|
|
21
|
+
helperText: "Inherit the parent component state and data",
|
|
22
|
+
type: "boolean",
|
|
23
|
+
defaultValue: false,
|
|
24
|
+
advanced: true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "renderToLiquid",
|
|
28
|
+
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
29
|
+
type: "boolean",
|
|
30
|
+
defaultValue: false,
|
|
31
|
+
advanced: true,
|
|
32
|
+
hideFromUI: true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "useChildren",
|
|
36
|
+
hideFromUI: true,
|
|
37
|
+
type: "boolean"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
componentInfo
|
|
43
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { useState, useContext, useEffect } from "react";
|
|
23
|
+
import RenderContent from "../../components/render-content/render-content.js";
|
|
24
|
+
import BuilderContext from "../../context/builder.context.js";
|
|
25
|
+
import { getContent } from "../../functions/get-content/index.js";
|
|
26
|
+
import { markMutable } from "../../functions/mark-mutable";
|
|
27
|
+
function Symbol(props) {
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
29
|
+
const [className, setClassName] = useState(() => "builder-symbol");
|
|
30
|
+
const [content, setContent] = useState(() => null);
|
|
31
|
+
const builderContext = useContext(BuilderContext);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
var _a2;
|
|
34
|
+
setContent((_a2 = props.symbol) == null ? void 0 : _a2.content);
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const symbolToUse = props.symbol;
|
|
38
|
+
if (symbolToUse && !symbolToUse.content && !content && symbolToUse.model) {
|
|
39
|
+
getContent({
|
|
40
|
+
model: symbolToUse.model,
|
|
41
|
+
apiKey: builderContext.apiKey,
|
|
42
|
+
query: {
|
|
43
|
+
id: symbolToUse.entry
|
|
44
|
+
}
|
|
45
|
+
}).then((response) => {
|
|
46
|
+
setContent(response);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [props.symbol, content]);
|
|
50
|
+
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
51
|
+
dataSet: {
|
|
52
|
+
class: className
|
|
53
|
+
}
|
|
54
|
+
}), /* @__PURE__ */ React.createElement(RenderContent, {
|
|
55
|
+
apiKey: builderContext.apiKey,
|
|
56
|
+
context: builderContext.context,
|
|
57
|
+
customComponents: markMutable(Object.values(builderContext.registeredComponents)),
|
|
58
|
+
data: markMutable(__spreadValues(__spreadValues(__spreadValues({}, (_a = props.symbol) == null ? void 0 : _a.data), builderContext.state), (_d = (_c = (_b = props.symbol) == null ? void 0 : _b.content) == null ? void 0 : _c.data) == null ? void 0 : _d.state)),
|
|
59
|
+
model: (_e = props.symbol) == null ? void 0 : _e.model,
|
|
60
|
+
content: markMutable(content)
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
Symbol as default
|
|
65
|
+
};
|