@builder.io/sdk-react-native 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/BaseText.js +40 -0
- package/dist/blocks/button/button.js +39 -0
- package/dist/blocks/button/component-info.js +42 -0
- package/dist/blocks/columns/columns.js +149 -0
- package/dist/blocks/columns/component-info.js +244 -0
- package/dist/blocks/custom-code/component-info.js +32 -0
- package/dist/blocks/custom-code/custom-code.js +76 -0
- package/dist/blocks/embed/component-info.js +47 -0
- package/dist/blocks/embed/embed.js +67 -0
- package/dist/blocks/embed/helpers.js +10 -0
- package/dist/blocks/form/component-info.js +263 -0
- package/dist/blocks/form/form.js +232 -0
- package/dist/blocks/fragment/component-info.js +12 -0
- package/dist/blocks/fragment/fragment.js +36 -0
- package/dist/blocks/image/component-info.js +152 -0
- package/dist/blocks/image/image.helpers.js +49 -0
- package/dist/blocks/image/image.js +81 -0
- package/dist/blocks/img/component-info.js +21 -0
- package/dist/blocks/img/img.js +35 -0
- package/dist/blocks/input/component-info.js +75 -0
- package/dist/blocks/input/input.js +32 -0
- package/dist/blocks/raw-text/component-info.js +17 -0
- package/dist/blocks/raw-text/raw-text.js +31 -0
- package/dist/blocks/section/component-info.js +50 -0
- package/dist/blocks/section/section.js +49 -0
- package/dist/blocks/select/component-info.js +60 -0
- package/dist/blocks/select/select.js +38 -0
- package/dist/blocks/submit-button/component-info.js +29 -0
- package/dist/blocks/submit-button/submit-button.js +36 -0
- package/dist/blocks/symbol/component-info.js +44 -0
- package/dist/blocks/symbol/symbol.js +97 -0
- package/dist/blocks/text/component-info.js +25 -0
- package/dist/blocks/text/text.js +112 -0
- package/dist/blocks/textarea/component-info.js +48 -0
- package/dist/blocks/textarea/textarea.js +31 -0
- package/dist/blocks/util.js +9 -0
- package/dist/blocks/video/component-info.js +107 -0
- package/dist/blocks/video/video.js +81 -0
- package/dist/components/render-block/block-styles.js +79 -0
- package/dist/components/render-block/render-block.helpers.js +109 -0
- package/dist/components/render-block/render-block.js +154 -0
- package/dist/components/render-block/render-component-with-context.js +45 -0
- package/dist/components/render-block/render-component.js +50 -0
- package/dist/components/render-block/render-repeated-block.js +45 -0
- package/dist/components/render-block/types.js +1 -0
- package/dist/components/render-blocks.js +76 -0
- package/dist/components/render-content/builder-editing.js +31 -0
- package/dist/components/render-content/components/render-styles.js +91 -0
- package/dist/components/render-content/index.js +8 -0
- package/dist/components/render-content/render-content.js +325 -0
- package/dist/components/render-inlined-styles.js +42 -0
- package/dist/constants/builder-registered-components.js +46 -0
- package/dist/constants/device-sizes.js +49 -0
- package/dist/constants/target.js +5 -0
- package/dist/context/builder.context.js +13 -0
- package/dist/context/types.js +1 -0
- package/dist/functions/camel-to-kebab-case.js +5 -0
- package/dist/functions/evaluate.js +25 -0
- package/dist/functions/event-handler-name.js +8 -0
- package/dist/functions/extract-text-styles.js +23 -0
- package/dist/functions/fast-clone.js +5 -0
- package/dist/functions/get-block-actions-handler.js +12 -0
- package/dist/functions/get-block-actions.js +19 -0
- package/dist/functions/get-block-component-options.js +29 -0
- package/dist/functions/get-block-properties.js +51 -0
- package/dist/functions/get-block-tag.js +8 -0
- package/dist/functions/get-builder-search-params/fn.test.js +15 -0
- package/dist/functions/get-builder-search-params/index.js +39 -0
- package/dist/functions/get-content/ab-testing.js +89 -0
- package/dist/functions/get-content/generate-content-url.js +44 -0
- package/dist/functions/get-content/generate-content-url.test.js +33 -0
- package/dist/functions/get-content/index.js +68 -0
- package/dist/functions/get-content/types.js +1 -0
- package/dist/functions/get-fetch.js +15 -0
- package/dist/functions/get-global-this.js +19 -0
- package/dist/functions/get-processed-block.js +52 -0
- package/dist/functions/get-processed-block.test.js +34 -0
- package/dist/functions/get-react-native-block-styles.js +30 -0
- package/dist/functions/if-target.js +13 -0
- package/dist/functions/is-browser.js +7 -0
- package/dist/functions/is-editing.js +8 -0
- package/dist/functions/is-iframe.js +8 -0
- package/dist/functions/is-previewing.js +15 -0
- package/dist/functions/on-change.js +28 -0
- package/dist/functions/on-change.test.js +21 -0
- package/dist/functions/register-component.js +65 -0
- package/dist/functions/register.js +31 -0
- package/dist/functions/sanitize-react-native-block-styles.js +71 -0
- package/dist/functions/set-editor-settings.js +16 -0
- package/dist/functions/set.js +12 -0
- package/dist/functions/set.test.js +18 -0
- package/dist/functions/track/helpers.js +53 -0
- package/dist/functions/track/index.js +124 -0
- package/dist/functions/track/interaction.js +51 -0
- package/dist/functions/track.js +120 -0
- package/dist/functions/transform-block-properties.js +18 -0
- package/dist/functions/transform-block.js +38 -0
- package/dist/helpers/ab-tests.js +10 -0
- package/dist/helpers/cookie.js +70 -0
- package/dist/helpers/css.js +33 -0
- package/dist/helpers/flatten.js +35 -0
- package/dist/helpers/localStorage.js +31 -0
- package/dist/helpers/nullable.js +5 -0
- package/dist/helpers/sessionId.js +51 -0
- package/dist/helpers/time.js +6 -0
- package/dist/helpers/url.js +14 -0
- package/dist/helpers/url.test.js +23 -0
- package/dist/helpers/uuid.js +14 -0
- package/dist/helpers/visitorId.js +33 -0
- package/dist/index-helpers/blocks-exports.js +22 -0
- package/dist/index-helpers/top-of-file.js +3 -0
- package/dist/index.js +29 -0
- package/dist/scripts/init-editing.js +97 -0
- package/dist/types/builder-block.js +1 -0
- package/dist/types/builder-content.js +1 -0
- package/dist/types/can-track.js +1 -0
- package/dist/types/components.js +1 -0
- package/dist/types/deep-partial.js +1 -0
- package/dist/types/element.js +1 -0
- package/dist/types/targets.js +1 -0
- package/dist/types/typescript.js +1 -0
- package/package.json +13 -5
- package/src/blocks/BaseText.jsx +17 -0
- package/src/blocks/button/button.jsx +28 -0
- package/src/blocks/columns/{columns.js → columns.jsx} +59 -36
- package/src/blocks/custom-code/{custom-code.js → custom-code.jsx} +22 -15
- package/src/blocks/embed/{embed.js → embed.jsx} +12 -11
- package/src/blocks/form/form.jsx +251 -0
- package/src/blocks/fragment/fragment.jsx +11 -0
- package/src/blocks/image/image.jsx +78 -0
- package/src/blocks/img/img.jsx +18 -0
- package/src/blocks/input/input.jsx +20 -0
- package/src/blocks/raw-text/raw-text.jsx +6 -0
- package/src/blocks/section/section.jsx +29 -0
- package/src/blocks/select/select.jsx +24 -0
- package/src/blocks/submit-button/submit-button.jsx +11 -0
- package/src/blocks/symbol/symbol.jsx +86 -0
- package/src/blocks/text/text.jsx +100 -0
- package/src/blocks/textarea/textarea.jsx +14 -0
- package/src/blocks/video/video.jsx +70 -0
- package/src/components/render-block/block-styles.jsx +70 -0
- package/src/components/render-block/render-block.helpers.js +90 -0
- package/src/components/render-block/render-block.jsx +183 -0
- package/src/components/render-block/render-component.jsx +45 -0
- package/src/components/render-block/render-repeated-block.jsx +22 -0
- package/src/components/render-blocks.jsx +86 -0
- package/src/components/render-content/builder-editing.jsx +6 -0
- package/src/components/render-content/components/{render-styles.js → render-styles.jsx} +21 -14
- package/src/components/render-content/render-content.jsx +373 -0
- package/src/components/render-inlined-styles.jsx +29 -0
- package/src/functions/track/helpers.js +50 -0
- package/src/functions/{track.js → track/index.js} +10 -6
- package/src/functions/track/interaction.js +53 -0
- package/src/index.js +1 -1
- package/src/blocks/BaseText.js +0 -31
- package/src/blocks/button/button.js +0 -36
- package/src/blocks/form/form.js +0 -222
- package/src/blocks/fragment/fragment.js +0 -9
- package/src/blocks/image/image.js +0 -55
- package/src/blocks/img/img.js +0 -33
- package/src/blocks/input/input.js +0 -36
- package/src/blocks/raw-text/raw-text.js +0 -10
- package/src/blocks/section/section.js +0 -41
- package/src/blocks/select/select.js +0 -37
- package/src/blocks/submit-button/submit-button.js +0 -27
- package/src/blocks/symbol/symbol.js +0 -73
- package/src/blocks/text/text.js +0 -67
- package/src/blocks/textarea/textarea.js +0 -32
- package/src/blocks/video/video.js +0 -55
- package/src/components/render-block/block-styles.js +0 -50
- package/src/components/render-block/render-block.js +0 -202
- package/src/components/render-block/render-component-with-context.js +0 -35
- package/src/components/render-block/render-component.js +0 -35
- package/src/components/render-block/render-repeated-block.js +0 -33
- package/src/components/render-blocks.js +0 -63
- package/src/components/render-content/builder-editing.js +0 -8
- package/src/components/render-content/render-content.js +0 -297
- package/src/components/render-inlined-styles.js +0 -17
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const util_js_1 = require("../util.js");
|
|
5
|
+
const componentInfo = {
|
|
6
|
+
name: "Image",
|
|
7
|
+
static: true,
|
|
8
|
+
builtIn: true,
|
|
9
|
+
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",
|
|
10
|
+
defaultStyles: {
|
|
11
|
+
position: "relative",
|
|
12
|
+
minHeight: "20px",
|
|
13
|
+
minWidth: "20px",
|
|
14
|
+
overflow: "hidden"
|
|
15
|
+
},
|
|
16
|
+
canHaveChildren: true,
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
name: "image",
|
|
20
|
+
type: "file",
|
|
21
|
+
bubble: true,
|
|
22
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
23
|
+
required: true,
|
|
24
|
+
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
25
|
+
onChange: (0, util_js_1.serializeFn)((options) => {
|
|
26
|
+
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
27
|
+
options.delete("srcset");
|
|
28
|
+
options.delete("noWebp");
|
|
29
|
+
function loadImage(url, timeout = 6e4) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const img = document.createElement("img");
|
|
32
|
+
let loaded = false;
|
|
33
|
+
img.onload = () => {
|
|
34
|
+
loaded = true;
|
|
35
|
+
resolve(img);
|
|
36
|
+
};
|
|
37
|
+
img.addEventListener("error", (event) => {
|
|
38
|
+
console.warn("Image load failed", event.error);
|
|
39
|
+
reject(event.error);
|
|
40
|
+
});
|
|
41
|
+
img.src = url;
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
if (!loaded) {
|
|
44
|
+
reject(new Error("Image load timed out"));
|
|
45
|
+
}
|
|
46
|
+
}, timeout);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function round(num) {
|
|
50
|
+
return Math.round(num * 1e3) / 1e3;
|
|
51
|
+
}
|
|
52
|
+
const value = options.get("image");
|
|
53
|
+
const aspectRatio = options.get("aspectRatio");
|
|
54
|
+
fetch(value).then((res) => res.blob()).then((blob) => {
|
|
55
|
+
if (blob.type.includes("svg")) {
|
|
56
|
+
options.set("noWebp", true);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
60
|
+
return loadImage(value).then((img) => {
|
|
61
|
+
const possiblyUpdatedAspectRatio = options.get("aspectRatio");
|
|
62
|
+
if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
|
|
63
|
+
if (img.width && img.height) {
|
|
64
|
+
options.set("aspectRatio", round(img.height / img.width));
|
|
65
|
+
options.set("height", img.height);
|
|
66
|
+
options.set("width", img.width);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "backgroundSize",
|
|
75
|
+
type: "text",
|
|
76
|
+
defaultValue: "cover",
|
|
77
|
+
enum: [
|
|
78
|
+
{
|
|
79
|
+
label: "contain",
|
|
80
|
+
value: "contain",
|
|
81
|
+
helperText: "The image should never get cropped"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "cover",
|
|
85
|
+
value: "cover",
|
|
86
|
+
helperText: "The image should fill it's box, cropping when needed"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "backgroundPosition",
|
|
92
|
+
type: "text",
|
|
93
|
+
defaultValue: "center",
|
|
94
|
+
enum: [
|
|
95
|
+
"center",
|
|
96
|
+
"top",
|
|
97
|
+
"left",
|
|
98
|
+
"right",
|
|
99
|
+
"bottom",
|
|
100
|
+
"top left",
|
|
101
|
+
"top right",
|
|
102
|
+
"bottom left",
|
|
103
|
+
"bottom right"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "altText",
|
|
108
|
+
type: "string",
|
|
109
|
+
helperText: "Text to display when the user has images off"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "height",
|
|
113
|
+
type: "number",
|
|
114
|
+
hideFromUI: true
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "width",
|
|
118
|
+
type: "number",
|
|
119
|
+
hideFromUI: true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "sizes",
|
|
123
|
+
type: "string",
|
|
124
|
+
hideFromUI: true
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "srcset",
|
|
128
|
+
type: "string",
|
|
129
|
+
hideFromUI: true
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "lazy",
|
|
133
|
+
type: "boolean",
|
|
134
|
+
defaultValue: true,
|
|
135
|
+
hideFromUI: true
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "fitContent",
|
|
139
|
+
type: "boolean",
|
|
140
|
+
helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
|
|
141
|
+
defaultValue: true
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "aspectRatio",
|
|
145
|
+
type: "number",
|
|
146
|
+
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",
|
|
147
|
+
advanced: true,
|
|
148
|
+
defaultValue: 0.7041
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSrcSet = void 0;
|
|
4
|
+
function removeProtocol(path) {
|
|
5
|
+
return path.replace(/http(s)?:/, "");
|
|
6
|
+
}
|
|
7
|
+
function updateQueryParam(uri = "", key, value) {
|
|
8
|
+
const re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
|
9
|
+
const separator = uri.indexOf("?") !== -1 ? "&" : "?";
|
|
10
|
+
if (uri.match(re)) {
|
|
11
|
+
return uri.replace(re, "$1" + key + "=" + encodeURIComponent(value) + "$2");
|
|
12
|
+
}
|
|
13
|
+
return uri + separator + key + "=" + encodeURIComponent(value);
|
|
14
|
+
}
|
|
15
|
+
function getShopifyImageUrl(src, size) {
|
|
16
|
+
if (!src || !(src == null ? void 0 : src.match(/cdn\.shopify\.com/)) || !size) {
|
|
17
|
+
return src;
|
|
18
|
+
}
|
|
19
|
+
if (size === "master") {
|
|
20
|
+
return removeProtocol(src);
|
|
21
|
+
}
|
|
22
|
+
const match = src.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
23
|
+
if (match) {
|
|
24
|
+
const prefix = src.split(match[0]);
|
|
25
|
+
const suffix = match[3];
|
|
26
|
+
const useSize = size.match("x") ? size : `${size}x`;
|
|
27
|
+
return removeProtocol(`${prefix[0]}_${useSize}${suffix}`);
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function getSrcSet(url) {
|
|
32
|
+
if (!url) {
|
|
33
|
+
return url;
|
|
34
|
+
}
|
|
35
|
+
const sizes = [100, 200, 400, 800, 1200, 1600, 2e3];
|
|
36
|
+
if (url.match(/builder\.io/)) {
|
|
37
|
+
let srcUrl = url;
|
|
38
|
+
const widthInSrc = Number(url.split("?width=")[1]);
|
|
39
|
+
if (!isNaN(widthInSrc)) {
|
|
40
|
+
srcUrl = `${srcUrl} ${widthInSrc}w`;
|
|
41
|
+
}
|
|
42
|
+
return sizes.filter((size) => size !== widthInSrc).map((size) => `${updateQueryParam(url, "width", size)} ${size}w`).concat([srcUrl]).join(", ");
|
|
43
|
+
}
|
|
44
|
+
if (url.match(/cdn\.shopify\.com/)) {
|
|
45
|
+
return sizes.map((size) => [getShopifyImageUrl(url, `${size}x${size}`), size]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([url]).join(", ");
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
exports.getSrcSet = getSrcSet;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
// Subset of Image props, many are irrelevant for native (such as altText, etc)
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {{
|
|
31
|
+
* image: string;
|
|
32
|
+
* backgroundSize?: 'cover' | 'contain';
|
|
33
|
+
* backgroundPosition?: string;
|
|
34
|
+
* aspectRatio?: number;
|
|
35
|
+
* width?: number;
|
|
36
|
+
* height?: number;
|
|
37
|
+
* children?: any;
|
|
38
|
+
* }} ImageProps
|
|
39
|
+
*/
|
|
40
|
+
// TODO: support children by wrapping in a View
|
|
41
|
+
/**
|
|
42
|
+
* @param {ImageProps} props
|
|
43
|
+
*/
|
|
44
|
+
function Image(props) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
const shouldRenderUnwrappedChildren = props.fitContent && ((_b = (_a = props.builderBlock) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length);
|
|
47
|
+
const imageStyle = props.aspectRatio
|
|
48
|
+
? {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: 0,
|
|
51
|
+
bottom: 0,
|
|
52
|
+
left: 0,
|
|
53
|
+
right: 0,
|
|
54
|
+
}
|
|
55
|
+
: {
|
|
56
|
+
position: 'relative',
|
|
57
|
+
...(props.width ? { width: props.width } : {}),
|
|
58
|
+
...(props.height ? { height: props.height } : {}),
|
|
59
|
+
};
|
|
60
|
+
return (React.createElement(React.Fragment, null,
|
|
61
|
+
React.createElement(React.Fragment, null,
|
|
62
|
+
React.createElement(react_native_1.Image, { resizeMode: props.backgroundSize || 'contain', style: imageStyle, source: { uri: props.image } }),
|
|
63
|
+
props.aspectRatio && !shouldRenderUnwrappedChildren ? (React.createElement(react_native_1.View, { style: {
|
|
64
|
+
width: '100%',
|
|
65
|
+
paddingTop: props.aspectRatio * 100 + '%',
|
|
66
|
+
} })) : null),
|
|
67
|
+
shouldRenderUnwrappedChildren && props.children,
|
|
68
|
+
!props.fitContent && props.children && (
|
|
69
|
+
// When `fitContent: false`, we wrap image children ssuch that they stretch across the entire image
|
|
70
|
+
React.createElement(react_native_1.View, { css: {
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
alignItems: 'stretch',
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
top: '0',
|
|
76
|
+
left: '0',
|
|
77
|
+
width: '100%',
|
|
78
|
+
height: '100%',
|
|
79
|
+
} }, props.children))));
|
|
80
|
+
}
|
|
81
|
+
exports.default = Image;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Raw:Img",
|
|
6
|
+
hideFromInsertMenu: true,
|
|
7
|
+
builtIn: true,
|
|
8
|
+
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",
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: "image",
|
|
12
|
+
bubble: true,
|
|
13
|
+
type: "file",
|
|
14
|
+
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
noWrap: true,
|
|
19
|
+
static: true
|
|
20
|
+
};
|
|
21
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
const is_editing_js_1 = require("../../functions/is-editing.js");
|
|
29
|
+
function ImgComponent(props) {
|
|
30
|
+
return (React.createElement(react_native_1.View, { style: {
|
|
31
|
+
objectFit: props.backgroundSize || "cover",
|
|
32
|
+
objectPosition: props.backgroundPosition || "center",
|
|
33
|
+
}, key: ((0, is_editing_js_1.isEditing)() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...props.attributes }));
|
|
34
|
+
}
|
|
35
|
+
exports.default = ImgComponent;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Form:Input",
|
|
6
|
+
builtIn: true,
|
|
7
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: "type",
|
|
11
|
+
type: "text",
|
|
12
|
+
enum: [
|
|
13
|
+
"text",
|
|
14
|
+
"number",
|
|
15
|
+
"email",
|
|
16
|
+
"url",
|
|
17
|
+
"checkbox",
|
|
18
|
+
"radio",
|
|
19
|
+
"range",
|
|
20
|
+
"date",
|
|
21
|
+
"datetime-local",
|
|
22
|
+
"search",
|
|
23
|
+
"tel",
|
|
24
|
+
"time",
|
|
25
|
+
"file",
|
|
26
|
+
"month",
|
|
27
|
+
"week",
|
|
28
|
+
"password",
|
|
29
|
+
"color",
|
|
30
|
+
"hidden"
|
|
31
|
+
],
|
|
32
|
+
defaultValue: "text"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "name",
|
|
36
|
+
type: "string",
|
|
37
|
+
required: true,
|
|
38
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "placeholder",
|
|
42
|
+
type: "string",
|
|
43
|
+
defaultValue: "Hello there",
|
|
44
|
+
helperText: "Text to display when there is no value"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "defaultValue",
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "value",
|
|
52
|
+
type: "string",
|
|
53
|
+
advanced: true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "required",
|
|
57
|
+
type: "boolean",
|
|
58
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
59
|
+
defaultValue: false
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
noWrap: true,
|
|
63
|
+
static: true,
|
|
64
|
+
defaultStyles: {
|
|
65
|
+
paddingTop: "10px",
|
|
66
|
+
paddingBottom: "10px",
|
|
67
|
+
paddingLeft: "10px",
|
|
68
|
+
paddingRight: "10px",
|
|
69
|
+
borderRadius: "3px",
|
|
70
|
+
borderWidth: "1px",
|
|
71
|
+
borderStyle: "solid",
|
|
72
|
+
borderColor: "#ccc"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
const is_editing_js_1 = require("../../functions/is-editing.js");
|
|
29
|
+
function FormInputComponent(props) {
|
|
30
|
+
return (React.createElement(react_native_1.View, { ...props.attributes, key: (0, is_editing_js_1.isEditing)() && props.defaultValue ? props.defaultValue : "default-key", placeholder: props.placeholder, type: props.type, name: props.name, value: props.value, defaultValue: props.defaultValue, required: props.required }));
|
|
31
|
+
}
|
|
32
|
+
exports.default = FormInputComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Builder:RawText",
|
|
6
|
+
hideFromInsertMenu: true,
|
|
7
|
+
builtIn: true,
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: "text",
|
|
11
|
+
bubble: true,
|
|
12
|
+
type: "longText",
|
|
13
|
+
required: true
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
function RawText(props) {
|
|
29
|
+
return React.createElement(react_native_1.View, { dangerouslySetInnerHTML: { __html: props.text || "" } });
|
|
30
|
+
}
|
|
31
|
+
exports.default = RawText;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Core:Section",
|
|
6
|
+
static: true,
|
|
7
|
+
builtIn: true,
|
|
8
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: "maxWidth",
|
|
12
|
+
type: "number",
|
|
13
|
+
defaultValue: 1200
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "lazyLoad",
|
|
17
|
+
type: "boolean",
|
|
18
|
+
defaultValue: false,
|
|
19
|
+
advanced: true,
|
|
20
|
+
description: "Only render this section when in view"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
defaultStyles: {
|
|
24
|
+
paddingLeft: "20px",
|
|
25
|
+
paddingRight: "20px",
|
|
26
|
+
paddingTop: "50px",
|
|
27
|
+
paddingBottom: "50px",
|
|
28
|
+
marginTop: "0px",
|
|
29
|
+
width: "100vw",
|
|
30
|
+
marginLeft: "calc(50% - 50vw)"
|
|
31
|
+
},
|
|
32
|
+
canHaveChildren: true,
|
|
33
|
+
defaultChildren: [
|
|
34
|
+
{
|
|
35
|
+
"@type": "@builder.io/sdk:Element",
|
|
36
|
+
responsiveStyles: {
|
|
37
|
+
large: {
|
|
38
|
+
textAlign: "center"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
component: {
|
|
42
|
+
name: "Text",
|
|
43
|
+
options: {
|
|
44
|
+
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>"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const BaseText_1 = __importDefault(require("../BaseText"));
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
function SectionComponent(props) {
|
|
33
|
+
return (React.createElement(react_native_1.View, { ...props.attributes, style: {
|
|
34
|
+
width: "100%",
|
|
35
|
+
alignSelf: "stretch",
|
|
36
|
+
flexGrow: "1",
|
|
37
|
+
boxSizing: "border-box",
|
|
38
|
+
maxWidth: `${props.maxWidth && typeof props.maxWidth === "number"
|
|
39
|
+
? props.maxWidth
|
|
40
|
+
: 1200}px`,
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
alignItems: "stretch",
|
|
44
|
+
marginLeft: "auto",
|
|
45
|
+
marginRight: "auto",
|
|
46
|
+
} },
|
|
47
|
+
React.createElement(BaseText_1.default, null, props.children)));
|
|
48
|
+
}
|
|
49
|
+
exports.default = SectionComponent;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Form:Select",
|
|
6
|
+
builtIn: true,
|
|
7
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
8
|
+
defaultStyles: {
|
|
9
|
+
alignSelf: "flex-start"
|
|
10
|
+
},
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
name: "options",
|
|
14
|
+
type: "list",
|
|
15
|
+
required: true,
|
|
16
|
+
subFields: [
|
|
17
|
+
{
|
|
18
|
+
name: "value",
|
|
19
|
+
type: "text",
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "name",
|
|
24
|
+
type: "text"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
defaultValue: [
|
|
28
|
+
{
|
|
29
|
+
value: "option 1"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "option 2"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "name",
|
|
38
|
+
type: "string",
|
|
39
|
+
required: true,
|
|
40
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "defaultValue",
|
|
44
|
+
type: "string"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "value",
|
|
48
|
+
type: "string",
|
|
49
|
+
advanced: true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "required",
|
|
53
|
+
type: "boolean",
|
|
54
|
+
defaultValue: false
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
static: true,
|
|
58
|
+
noWrap: true
|
|
59
|
+
};
|
|
60
|
+
exports.componentInfo = componentInfo;
|