@builder.io/sdk-react-native 0.0.1-5 → 0.0.1-52

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 (138) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +15 -0
  3. package/package.json +6 -4
  4. package/src/blocks/button/button.js +31 -0
  5. package/src/blocks/{button.lite.tsx → button/button.lite.tsx} +7 -11
  6. package/src/blocks/button/component-info.js +42 -0
  7. package/src/blocks/columns/columns.js +59 -0
  8. package/src/blocks/columns/columns.lite.tsx +70 -0
  9. package/src/blocks/columns/component-info.js +218 -0
  10. package/src/blocks/custom-code/component-info.js +32 -0
  11. package/src/blocks/custom-code/custom-code.js +50 -0
  12. package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.lite.tsx} +2 -10
  13. package/src/blocks/embed/component-info.js +25 -0
  14. package/src/blocks/embed/embed.js +50 -0
  15. package/src/blocks/{embed.lite.tsx → embed/embed.lite.tsx} +2 -6
  16. package/src/blocks/form/component-info.js +263 -0
  17. package/src/blocks/form/form.js +221 -0
  18. package/src/blocks/{form.lite.tsx → form/form.lite.tsx} +24 -27
  19. package/src/blocks/fragment/component-info.js +12 -0
  20. package/src/blocks/fragment/fragment.js +8 -0
  21. package/src/blocks/fragment/fragment.lite.tsx +10 -0
  22. package/src/blocks/{image.js → image/component-info.js} +5 -23
  23. package/src/blocks/image/image.js +41 -0
  24. package/src/blocks/image/image.lite.tsx +67 -0
  25. package/src/blocks/img/component-info.js +21 -0
  26. package/src/blocks/img/img.js +36 -0
  27. package/src/blocks/{img.lite.tsx → img/img.lite.tsx} +2 -3
  28. package/src/blocks/input/component-info.js +75 -0
  29. package/src/blocks/input/input.js +36 -0
  30. package/src/blocks/{input.lite.tsx → input/input.lite.tsx} +2 -5
  31. package/src/blocks/raw-text/component-info.js +17 -0
  32. package/src/blocks/raw-text/raw-text.js +10 -0
  33. package/src/blocks/raw-text/raw-text.lite.tsx +6 -0
  34. package/src/blocks/section/component-info.js +50 -0
  35. package/src/blocks/section/section.js +31 -0
  36. package/src/blocks/{section.lite.tsx → section/section.lite.tsx} +1 -2
  37. package/src/blocks/select/component-info.js +60 -0
  38. package/src/blocks/select/select.js +36 -0
  39. package/src/blocks/{select.lite.tsx → select/select.lite.tsx} +6 -7
  40. package/src/blocks/submit-button/component-info.js +29 -0
  41. package/src/blocks/submit-button/submit-button.js +29 -0
  42. package/src/blocks/{submit-button.lite.tsx → submit-button/submit-button.lite.tsx} +1 -2
  43. package/src/blocks/symbol/component-info.js +43 -0
  44. package/src/blocks/symbol/symbol.js +68 -0
  45. package/src/blocks/symbol/symbol.lite.tsx +60 -0
  46. package/src/blocks/{text.js → text/component-info.js} +4 -10
  47. package/src/blocks/text/text.js +65 -0
  48. package/src/blocks/text/text.lite.tsx +6 -0
  49. package/src/blocks/textarea/component-info.js +48 -0
  50. package/src/blocks/textarea/textarea.js +32 -0
  51. package/src/blocks/{textarea.lite.tsx → textarea/textarea.lite.tsx} +0 -1
  52. package/src/blocks/video/component-info.js +107 -0
  53. package/src/blocks/video/video.js +33 -0
  54. package/src/blocks/{video.lite.tsx → video/video.lite.tsx} +0 -1
  55. package/src/components/error-boundary.js +25 -0
  56. package/src/components/error-boundary.lite.tsx +6 -0
  57. package/src/components/render-block/block-styles.js +29 -0
  58. package/src/components/render-block/block-styles.lite.tsx +35 -0
  59. package/src/components/render-block/render-block.helpers.js +24 -0
  60. package/src/components/render-block/render-block.js +116 -0
  61. package/src/components/render-block/render-block.lite.tsx +139 -0
  62. package/src/components/render-blocks.js +14 -7
  63. package/src/components/render-blocks.lite.tsx +18 -9
  64. package/src/components/render-content/components/render-styles.js +58 -0
  65. package/src/components/render-content/components/render-styles.lite.tsx +70 -0
  66. package/src/components/render-content/index.js +5 -0
  67. package/src/components/render-content/render-content.js +254 -0
  68. package/src/components/render-content/render-content.lite.tsx +283 -0
  69. package/src/components/render-inlined-styles.js +18 -0
  70. package/src/components/render-inlined-styles.lite.tsx +31 -0
  71. package/src/constants/builder-registered-components.js +27 -0
  72. package/src/constants/target.js +5 -0
  73. package/src/context/builder.context.js +7 -1
  74. package/src/functions/evaluate.js +17 -8
  75. package/src/functions/event-handler-name.js +8 -0
  76. package/src/functions/fast-clone.js +5 -0
  77. package/src/functions/get-block-actions.js +14 -13
  78. package/src/functions/get-block-component-options.js +17 -1
  79. package/src/functions/get-block-properties.js +7 -4
  80. package/src/functions/get-block-styles.js +31 -1
  81. package/src/functions/get-builder-search-params/fn.test.js +14 -0
  82. package/src/functions/get-builder-search-params/index.js +23 -0
  83. package/src/functions/get-content/fn.test.js +32 -0
  84. package/src/functions/get-content/index.js +139 -0
  85. package/src/functions/get-fetch.js +35 -0
  86. package/src/functions/get-global-this.js +19 -0
  87. package/src/functions/get-processed-block.js +5 -3
  88. package/src/functions/get-processed-block.test.js +13 -8
  89. package/src/functions/if-target.js +11 -2
  90. package/src/functions/is-browser.js +1 -2
  91. package/src/functions/is-editing.js +1 -1
  92. package/src/functions/is-iframe.js +1 -1
  93. package/src/functions/is-previewing.js +15 -0
  94. package/src/functions/is-react-native.js +1 -1
  95. package/src/functions/on-change.test.js +1 -2
  96. package/src/functions/previewing-model-name.js +12 -0
  97. package/src/functions/register-component.js +31 -13
  98. package/src/functions/register.js +30 -0
  99. package/src/functions/set-editor-settings.js +16 -0
  100. package/src/functions/set.test.js +1 -2
  101. package/src/functions/track.js +7 -3
  102. package/src/functions/transform-block.js +38 -0
  103. package/src/index-helpers/blocks-exports.js +19 -0
  104. package/src/index-helpers/top-of-file.js +2 -0
  105. package/src/index.js +10 -23
  106. package/src/scripts/init-editing.js +73 -47
  107. package/src/types/components.js +1 -0
  108. package/src/types/deep-partial.js +1 -0
  109. package/src/types/element.js +1 -0
  110. package/src/types/targets.js +1 -0
  111. package/src/types/typescript.js +1 -0
  112. package/index.js +0 -11
  113. package/src/blocks/button.js +0 -37
  114. package/src/blocks/columns.js +0 -47
  115. package/src/blocks/columns.lite.tsx +0 -46
  116. package/src/blocks/custom-code.js +0 -56
  117. package/src/blocks/embed.js +0 -56
  118. package/src/blocks/form.js +0 -229
  119. package/src/blocks/image.lite.tsx +0 -35
  120. package/src/blocks/img.js +0 -41
  121. package/src/blocks/input.js +0 -41
  122. package/src/blocks/raw-text.js +0 -17
  123. package/src/blocks/raw-text.lite.tsx +0 -12
  124. package/src/blocks/section.js +0 -36
  125. package/src/blocks/select.js +0 -40
  126. package/src/blocks/submit-button.js +0 -34
  127. package/src/blocks/symbol.js +0 -20
  128. package/src/blocks/symbol.lite.tsx +0 -20
  129. package/src/blocks/text.lite.tsx +0 -12
  130. package/src/blocks/textarea.js +0 -37
  131. package/src/blocks/video.js +0 -49
  132. package/src/components/render-block.js +0 -84
  133. package/src/components/render-block.lite.tsx +0 -92
  134. package/src/components/render-content.js +0 -66
  135. package/src/components/render-content.lite.tsx +0 -95
  136. package/src/functions/get-content.js +0 -103
  137. package/src/functions/get-target.js +0 -7
  138. package/src/package.json +0 -18
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Form:SubmitButton",
4
+ builtIn: true,
5
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
6
+ defaultStyles: {
7
+ appearance: "none",
8
+ paddingTop: "15px",
9
+ paddingBottom: "15px",
10
+ paddingLeft: "25px",
11
+ paddingRight: "25px",
12
+ backgroundColor: "#3898EC",
13
+ color: "white",
14
+ borderRadius: "4px",
15
+ cursor: "pointer"
16
+ },
17
+ inputs: [
18
+ {
19
+ name: "text",
20
+ type: "text",
21
+ defaultValue: "Click me"
22
+ }
23
+ ],
24
+ static: true,
25
+ noWrap: true
26
+ };
27
+ export {
28
+ componentInfo
29
+ };
@@ -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
+ };
@@ -1,11 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
3
 
5
4
  export default function SubmitButton(props) {
6
5
  return (
7
6
  <View {...props.attributes} type="submit">
8
- {props.text}
7
+ <Text>{props.text}</Text>
9
8
  </View>
10
9
  );
11
10
  }
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Symbol",
4
+ noWrap: true,
5
+ static: 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,68 @@
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";
25
+ import { getContent } from "../../functions/get-content/index.js";
26
+ function Symbol(props) {
27
+ var _a, _b, _c, _d, _e, _f, _g, _h;
28
+ const [className, setClassName] = useState(() => "builder-symbol");
29
+ const [content, setContent] = useState(() => null);
30
+ const builderContext = useContext(BuilderContext);
31
+ useEffect(() => {
32
+ var _a2;
33
+ setContent((_a2 = props.symbol) == null ? void 0 : _a2.content);
34
+ }, []);
35
+ useEffect(() => {
36
+ const symbolToUse = props.symbol;
37
+ if (symbolToUse && !symbolToUse.content && !content && symbolToUse.model) {
38
+ getContent({
39
+ model: symbolToUse.model,
40
+ apiKey: builderContext.apiKey,
41
+ options: {
42
+ entry: symbolToUse.entry
43
+ }
44
+ }).then((response) => {
45
+ setContent(response);
46
+ });
47
+ }
48
+ }, [
49
+ (_a = props.symbol) == null ? void 0 : _a.content,
50
+ (_b = props.symbol) == null ? void 0 : _b.model,
51
+ (_c = props.symbol) == null ? void 0 : _c.entry,
52
+ content
53
+ ]);
54
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
55
+ dataSet: {
56
+ class: className
57
+ }
58
+ }), /* @__PURE__ */ React.createElement(RenderContent, {
59
+ apiKey: builderContext.apiKey,
60
+ context: builderContext.context,
61
+ data: __spreadValues(__spreadValues(__spreadValues({}, (_d = props.symbol) == null ? void 0 : _d.data), builderContext.state), (_g = (_f = (_e = props.symbol) == null ? void 0 : _e.content) == null ? void 0 : _f.data) == null ? void 0 : _g.state),
62
+ model: (_h = props.symbol) == null ? void 0 : _h.model,
63
+ content
64
+ }));
65
+ }
66
+ export {
67
+ Symbol as default
68
+ };
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useState, useContext, useEffect } from "react";
4
+ import RenderContent from "../../components/render-content/render-content.lite";
5
+ import BuilderContext from "../../context/builder.context";
6
+ import { getContent } from "../../functions/get-content/index.js";
7
+
8
+ export default function Symbol(props) {
9
+ const [className, setClassName] = useState(() => "builder-symbol");
10
+
11
+ const [content, setContent] = useState(() => null);
12
+
13
+ const builderContext = useContext(BuilderContext);
14
+
15
+ useEffect(() => {
16
+ setContent(props.symbol?.content);
17
+ }, []);
18
+
19
+ useEffect(() => {
20
+ const symbolToUse = props.symbol;
21
+
22
+ if (symbolToUse && !symbolToUse.content && !content && symbolToUse.model) {
23
+ getContent({
24
+ model: symbolToUse.model,
25
+ apiKey: builderContext.apiKey,
26
+ options: {
27
+ entry: symbolToUse.entry,
28
+ },
29
+ }).then((response) => {
30
+ setContent(response);
31
+ });
32
+ }
33
+ }, [
34
+ props.symbol?.content,
35
+ props.symbol?.model,
36
+ props.symbol?.entry,
37
+ content,
38
+ ]);
39
+
40
+ return (
41
+ <View
42
+ {...props.attributes}
43
+ dataSet={{
44
+ class: className,
45
+ }}
46
+ >
47
+ <RenderContent
48
+ apiKey={builderContext.apiKey}
49
+ context={builderContext.context}
50
+ data={{
51
+ ...props.symbol?.data,
52
+ ...builderContext.state,
53
+ ...props.symbol?.content?.data?.state,
54
+ }}
55
+ model={props.symbol?.model}
56
+ content={content}
57
+ />
58
+ </View>
59
+ );
60
+ }
@@ -1,14 +1,8 @@
1
1
  import * as React from 'react';
2
- import HTML from "react-native-render-html";
3
- import { registerComponent } from "../functions/register-component";
4
- function Text(props) {
5
- return /* @__PURE__ */ React.createElement(HTML, {
6
- source: { html: props.text }
7
- });
8
- }
9
- registerComponent(Text, {
2
+ const componentInfo = {
10
3
  name: "Text",
11
4
  static: true,
5
+ builtIn: true,
12
6
  image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
13
7
  inputs: [
14
8
  {
@@ -25,7 +19,7 @@ registerComponent(Text, {
25
19
  height: "auto",
26
20
  textAlign: "center"
27
21
  }
28
- });
22
+ };
29
23
  export {
30
- Text as default
24
+ componentInfo
31
25
  };
@@ -0,0 +1,65 @@
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 HTML from "react-native-render-html";
19
+ function camelToKebabCase(string) {
20
+ return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
21
+ }
22
+ function pick(object, keys) {
23
+ return keys.reduce((obj, key) => {
24
+ if (object && object.hasOwnProperty(key)) {
25
+ obj[key] = object[key];
26
+ }
27
+ return obj;
28
+ }, {});
29
+ }
30
+ const PICK_STYLES = ["textAlign"];
31
+ function getBlockStyles(block) {
32
+ var _a, _b, _c;
33
+ const styles = __spreadValues(__spreadValues({}, (_a = block.responsiveStyles) == null ? void 0 : _a.large), block.styles);
34
+ if ((_b = block.responsiveStyles) == null ? void 0 : _b.medium) {
35
+ Object.assign(styles, block.responsiveStyles.medium);
36
+ }
37
+ if ((_c = block.responsiveStyles) == null ? void 0 : _c.small) {
38
+ Object.assign(styles, block.responsiveStyles.small);
39
+ }
40
+ return styles;
41
+ }
42
+ function getCss(block) {
43
+ const styleObject = pick(getBlockStyles(block), PICK_STYLES);
44
+ if (!styleObject) {
45
+ return "";
46
+ }
47
+ let str = ``;
48
+ for (const key in styleObject) {
49
+ const value = styleObject[key];
50
+ if (typeof value === "string") {
51
+ str += `${camelToKebabCase(key)}: ${value};`;
52
+ }
53
+ }
54
+ return str;
55
+ }
56
+ function Text(props) {
57
+ return /* @__PURE__ */ React.createElement(HTML, {
58
+ source: {
59
+ html: `<div style="${getCss(props.builderBlock)}">${props.text || ""}</div>`
60
+ }
61
+ });
62
+ }
63
+ export {
64
+ Text as default
65
+ };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+
4
+ export default function Text(props) {
5
+ return <View dangerouslySetInnerHTML={{ __html: props.text }} />;
6
+ }
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Form:TextArea",
4
+ builtIn: true,
5
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
6
+ inputs: [
7
+ {
8
+ advanced: true,
9
+ name: "value",
10
+ type: "string"
11
+ },
12
+ {
13
+ name: "name",
14
+ type: "string",
15
+ required: true,
16
+ helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
17
+ },
18
+ {
19
+ name: "defaultValue",
20
+ type: "string"
21
+ },
22
+ {
23
+ name: "placeholder",
24
+ type: "string",
25
+ defaultValue: "Hello there"
26
+ },
27
+ {
28
+ name: "required",
29
+ type: "boolean",
30
+ defaultValue: false
31
+ }
32
+ ],
33
+ defaultStyles: {
34
+ paddingTop: "10px",
35
+ paddingBottom: "10px",
36
+ paddingLeft: "10px",
37
+ paddingRight: "10px",
38
+ borderRadius: "3px",
39
+ borderWidth: "1px",
40
+ borderStyle: "solid",
41
+ borderColor: "#ccc"
42
+ },
43
+ static: true,
44
+ noWrap: true
45
+ };
46
+ export {
47
+ componentInfo
48
+ };
@@ -0,0 +1,32 @@
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
+ function Textarea(props) {
23
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
24
+ placeholder: props.placeholder,
25
+ name: props.name,
26
+ value: props.value,
27
+ defaultValue: props.defaultValue
28
+ }));
29
+ }
30
+ export {
31
+ Textarea as default
32
+ };
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
3
 
5
4
  export default function Textarea(props) {
6
5
  return (
@@ -0,0 +1,107 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Video",
4
+ canHaveChildren: true,
5
+ builtIn: true,
6
+ defaultStyles: {
7
+ minHeight: "20px",
8
+ minWidth: "20px"
9
+ },
10
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
11
+ inputs: [
12
+ {
13
+ name: "video",
14
+ type: "file",
15
+ allowedFileTypes: ["mp4"],
16
+ bubble: true,
17
+ defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
18
+ required: true
19
+ },
20
+ {
21
+ name: "posterImage",
22
+ type: "file",
23
+ allowedFileTypes: ["jpeg", "png"],
24
+ helperText: "Image to show before the video plays"
25
+ },
26
+ {
27
+ name: "autoPlay",
28
+ type: "boolean",
29
+ defaultValue: true
30
+ },
31
+ {
32
+ name: "controls",
33
+ type: "boolean",
34
+ defaultValue: false
35
+ },
36
+ {
37
+ name: "muted",
38
+ type: "boolean",
39
+ defaultValue: true
40
+ },
41
+ {
42
+ name: "loop",
43
+ type: "boolean",
44
+ defaultValue: true
45
+ },
46
+ {
47
+ name: "playsInline",
48
+ type: "boolean",
49
+ defaultValue: true
50
+ },
51
+ {
52
+ name: "fit",
53
+ type: "text",
54
+ defaultValue: "cover",
55
+ enum: ["contain", "cover", "fill", "auto"]
56
+ },
57
+ {
58
+ name: "fitContent",
59
+ type: "boolean",
60
+ helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
61
+ defaultValue: true,
62
+ advanced: true
63
+ },
64
+ {
65
+ name: "position",
66
+ type: "text",
67
+ defaultValue: "center",
68
+ enum: [
69
+ "center",
70
+ "top",
71
+ "left",
72
+ "right",
73
+ "bottom",
74
+ "top left",
75
+ "top right",
76
+ "bottom left",
77
+ "bottom right"
78
+ ]
79
+ },
80
+ {
81
+ name: "height",
82
+ type: "number",
83
+ advanced: true
84
+ },
85
+ {
86
+ name: "width",
87
+ type: "number",
88
+ advanced: true
89
+ },
90
+ {
91
+ name: "aspectRatio",
92
+ type: "number",
93
+ advanced: true,
94
+ defaultValue: 0.7004048582995948
95
+ },
96
+ {
97
+ name: "lazyLoad",
98
+ type: "boolean",
99
+ helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
100
+ defaultValue: true,
101
+ advanced: true
102
+ }
103
+ ]
104
+ };
105
+ export {
106
+ componentInfo
107
+ };
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import { View } from "react-native";
3
+ import ReactVideo from "react-native-video";
4
+ function Video(props) {
5
+ return /* @__PURE__ */ React.createElement(View, {
6
+ style: { position: "relative" }
7
+ }, /* @__PURE__ */ React.createElement(ReactVideo, {
8
+ paused: !props.autoPlay,
9
+ controls: props.controls,
10
+ muted: props.muted,
11
+ repeat: props.loop,
12
+ poster: props.posterImage,
13
+ posterResizeMode: props.fit || "contain",
14
+ resizeMode: props.fit || "contain",
15
+ style: {
16
+ position: "absolute",
17
+ top: 0,
18
+ bottom: 0,
19
+ left: 0,
20
+ right: 0,
21
+ zIndex: 1
22
+ },
23
+ source: { uri: props.video }
24
+ }), /* @__PURE__ */ React.createElement(View, {
25
+ style: {
26
+ width: "100%",
27
+ paddingTop: `${props.aspectRatio * 100}%`
28
+ }
29
+ }));
30
+ }
31
+ export {
32
+ Video as default
33
+ };
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
3
 
5
4
  export default function Video(props) {
6
5
  return (
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { Text } from "react-native";
3
+ class ErrorBoundary extends React.Component {
4
+ constructor(props) {
5
+ super(props);
6
+ this.state = { hasError: false };
7
+ }
8
+ static getDerivedStateFromError(error) {
9
+ return { hasError: true };
10
+ }
11
+ componentDidCatch(error, errorInfo) {
12
+ console.error("Error rendering Builder.io block", error, errorInfo);
13
+ }
14
+ render() {
15
+ if (this.state.hasError) {
16
+ return /* @__PURE__ */ React.createElement(Text, {
17
+ style: { color: "gray" }
18
+ }, "Error rendering Builder.io block");
19
+ }
20
+ return this.props.children;
21
+ }
22
+ }
23
+ export {
24
+ ErrorBoundary as default
25
+ };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+
4
+ export default function ErrorBoundary(props) {
5
+ return <></>;
6
+ }
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import RenderInlinedStyles from "../render-inlined-styles.js";
3
+ function BlockStyles(props) {
4
+ function camelToKebabCase(string) {
5
+ return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
6
+ }
7
+ function css() {
8
+ var _a;
9
+ const styleObject = (_a = props.block.responsiveStyles) == null ? void 0 : _a.large;
10
+ if (!styleObject) {
11
+ return "";
12
+ }
13
+ let str = `.${props.block.id} {`;
14
+ for (const key in styleObject) {
15
+ const value = styleObject[key];
16
+ if (typeof value === "string") {
17
+ str += `${camelToKebabCase(key)}: ${value};`;
18
+ }
19
+ }
20
+ str += "}";
21
+ return str;
22
+ }
23
+ return /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
24
+ styles: css()
25
+ });
26
+ }
27
+ export {
28
+ BlockStyles as default
29
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import RenderInlinedStyles from "../render-inlined-styles.lite";
4
+
5
+ export default function BlockStyles(props) {
6
+ function camelToKebabCase(string) {
7
+ return string
8
+ .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
9
+ .toLowerCase();
10
+ }
11
+
12
+ function css() {
13
+ // TODO: media queries
14
+ const styleObject = props.block.responsiveStyles?.large;
15
+
16
+ if (!styleObject) {
17
+ return "";
18
+ }
19
+
20
+ let str = `.${props.block.id} {`;
21
+
22
+ for (const key in styleObject) {
23
+ const value = styleObject[key];
24
+
25
+ if (typeof value === "string") {
26
+ str += `${camelToKebabCase(key)}: ${value};`;
27
+ }
28
+ }
29
+
30
+ str += "}";
31
+ return str;
32
+ }
33
+
34
+ return <RenderInlinedStyles styles={css()} />;
35
+ }