@builder.io/sdk-react-native 0.0.1-44 → 0.0.1-50

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 (88) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/src/blocks/button.js +23 -73
  4. package/src/blocks/button.lite.tsx +3 -3
  5. package/src/blocks/columns.js +56 -288
  6. package/src/blocks/columns.lite.tsx +22 -22
  7. package/src/blocks/custom-code.js +46 -76
  8. package/src/blocks/custom-code.lite.tsx +11 -19
  9. package/src/blocks/embed.js +46 -69
  10. package/src/blocks/embed.lite.tsx +11 -15
  11. package/src/blocks/form.js +194 -491
  12. package/src/blocks/form.lite.tsx +51 -51
  13. package/src/blocks/fragment.js +8 -16
  14. package/src/blocks/fragment.lite.tsx +2 -2
  15. package/src/blocks/image.js +91 -113
  16. package/src/blocks/image.lite.tsx +12 -13
  17. package/src/blocks/img.js +28 -51
  18. package/src/blocks/img.lite.tsx +6 -6
  19. package/src/blocks/input.js +28 -100
  20. package/src/blocks/input.lite.tsx +4 -4
  21. package/src/blocks/raw-text.js +10 -16
  22. package/src/blocks/raw-text.lite.tsx +3 -8
  23. package/src/blocks/section.js +23 -71
  24. package/src/blocks/section.lite.tsx +3 -3
  25. package/src/blocks/select.js +28 -78
  26. package/src/blocks/select.lite.tsx +5 -5
  27. package/src/blocks/submit-button.js +21 -47
  28. package/src/blocks/submit-button.lite.tsx +2 -2
  29. package/src/blocks/symbol.js +71 -20
  30. package/src/blocks/symbol.lite.tsx +48 -8
  31. package/src/blocks/text.js +27 -40
  32. package/src/blocks/text.lite.tsx +3 -8
  33. package/src/blocks/textarea.js +24 -60
  34. package/src/blocks/textarea.lite.tsx +2 -2
  35. package/src/blocks/video.js +66 -71
  36. package/src/blocks/video.lite.tsx +5 -5
  37. package/src/components/block-styles.js +4 -2
  38. package/src/components/block-styles.lite.tsx +2 -2
  39. package/src/components/error-boundary.js +9 -11
  40. package/src/components/error-boundary.lite.tsx +2 -2
  41. package/src/components/render-block.js +44 -100
  42. package/src/components/render-block.lite.tsx +23 -28
  43. package/src/components/render-blocks.js +41 -60
  44. package/src/components/render-blocks.lite.tsx +20 -14
  45. package/src/components/render-content.js +189 -142
  46. package/src/components/render-content.lite.tsx +166 -60
  47. package/src/constants/device-sizes.js +11 -8
  48. package/src/context/builder.context.js +10 -3
  49. package/src/functions/evaluate.js +20 -20
  50. package/src/functions/event-handler-name.js +3 -1
  51. package/src/functions/get-block-actions.js +17 -16
  52. package/src/functions/get-block-component-options.js +9 -16
  53. package/src/functions/get-block-properties.js +14 -18
  54. package/src/functions/get-block-styles.js +17 -34
  55. package/src/functions/get-block-tag.js +4 -2
  56. package/src/functions/get-builder-search-params/fn.test.js +14 -0
  57. package/src/functions/get-builder-search-params/index.js +23 -0
  58. package/src/functions/get-content/fn.test.js +32 -0
  59. package/src/functions/get-content/index.js +138 -0
  60. package/src/functions/get-fetch.js +7 -5
  61. package/src/functions/get-global-this.js +7 -5
  62. package/src/functions/get-processed-block.js +13 -17
  63. package/src/functions/get-processed-block.test.js +17 -16
  64. package/src/functions/get-target.js +4 -2
  65. package/src/functions/if-target.js +3 -1
  66. package/src/functions/is-browser.js +4 -2
  67. package/src/functions/is-editing.js +5 -5
  68. package/src/functions/is-iframe.js +4 -2
  69. package/src/functions/is-previewing.js +6 -4
  70. package/src/functions/is-react-native.js +3 -1
  71. package/src/functions/macro-eval.js +5 -2
  72. package/src/functions/on-change.js +7 -4
  73. package/src/functions/on-change.test.js +9 -10
  74. package/src/functions/previewing-model-name.js +5 -3
  75. package/src/functions/register-component.js +27 -38
  76. package/src/functions/register.js +10 -8
  77. package/src/functions/set-editor-settings.js +7 -5
  78. package/src/functions/set.js +5 -14
  79. package/src/functions/set.test.js +13 -14
  80. package/src/functions/track.js +12 -6
  81. package/src/functions/transform-block.js +13 -17
  82. package/src/index-helpers/blocks-exports.js +19 -0
  83. package/src/index-helpers/top-of-file.js +2 -0
  84. package/src/index.js +11 -26
  85. package/src/scripts/init-editing.js +40 -64
  86. package/src/types/typescript.js +1 -0
  87. package/src/functions/get-content.js +0 -152
  88. package/src/functions/get-content.test.js +0 -58
package/src/blocks/img.js CHANGED
@@ -1,64 +1,41 @@
1
1
  import { registerComponent } from '../functions/register-component';
2
2
 
3
- var __defProp = Object.defineProperty;
3
+ var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
5
5
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
6
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) =>
10
- key in obj
11
- ? __defProp(obj, key, {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value,
16
- })
17
- : (obj[key] = value);
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
10
  var __spreadValues = (a, b) => {
19
- for (var prop in b || (b = {}))
20
- if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
26
20
  };
27
21
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- import * as React from 'react';
29
- import { View } from 'react-native';
30
- import { isEditing } from '../functions/is-editing';
22
+ import * as React from "react";
23
+ import { View } from "react-native";
24
+ import { isEditing } from "../functions/is-editing";
31
25
  function ImgComponent(props) {
32
- return /* @__PURE__ */ React.createElement(
33
- View,
34
- __spreadProps(__spreadValues({}, props.attributes), {
35
- style: {
36
- objectFit: props.backgroundSize || 'cover',
37
- objectPosition: props.backgroundPosition || 'center',
38
- },
39
- key: (isEditing() && props.imgSrc) || 'default-key',
40
- alt: props.altText,
41
- src: props.imgSrc,
42
- })
43
- );
26
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
+ style: {
28
+ objectFit: props.backgroundSize || "cover",
29
+ objectPosition: props.backgroundPosition || "center"
30
+ },
31
+ key: isEditing() && props.imgSrc || "default-key",
32
+ alt: props.altText,
33
+ src: props.imgSrc
34
+ }));
44
35
  }
45
- export { ImgComponent as default };
36
+ export {
37
+ ImgComponent as default
38
+ };
39
+
46
40
 
47
- registerComponent(ImgComponent, {
48
- name: 'Raw:Img',
49
- hideFromInsertMenu: true,
50
- builtIn: true,
51
- image:
52
- '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',
53
- inputs: [
54
- {
55
- name: 'image',
56
- bubble: true,
57
- type: 'file',
58
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
59
- required: true,
60
- },
61
- ],
62
- noWrap: true,
63
- static: true,
64
- });
41
+ registerComponent(ImgComponent, {name:'Raw:Img',hideFromInsertMenu:true,builtIn:true,image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',inputs:[{name:'image',bubble:true,type:'file',allowedFileTypes:['jpeg','jpg','png','svg'],required:true}],noWrap:true,static:true});
@@ -1,16 +1,16 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { isEditing } from '../functions/is-editing';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { isEditing } from "../functions/is-editing";
4
4
 
5
5
  export default function ImgComponent(props) {
6
6
  return (
7
7
  <View
8
8
  {...props.attributes}
9
9
  style={{
10
- objectFit: props.backgroundSize || 'cover',
11
- objectPosition: props.backgroundPosition || 'center',
10
+ objectFit: props.backgroundSize || "cover",
11
+ objectPosition: props.backgroundPosition || "center",
12
12
  }}
13
- key={(isEditing() && props.imgSrc) || 'default-key'}
13
+ key={(isEditing() && props.imgSrc) || "default-key"}
14
14
  alt={props.altText}
15
15
  src={props.imgSrc}
16
16
  />
@@ -1,113 +1,41 @@
1
1
  import { registerComponent } from '../functions/register-component';
2
2
 
3
- var __defProp = Object.defineProperty;
3
+ var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
5
5
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
6
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) =>
10
- key in obj
11
- ? __defProp(obj, key, {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value,
16
- })
17
- : (obj[key] = value);
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
10
  var __spreadValues = (a, b) => {
19
- for (var prop in b || (b = {}))
20
- if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
26
20
  };
27
21
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- import * as React from 'react';
29
- import { View } from 'react-native';
30
- import { isEditing } from '../functions/is-editing';
22
+ import * as React from "react";
23
+ import { View } from "react-native";
24
+ import { isEditing } from "../functions/is-editing";
31
25
  function FormInputComponent(props) {
32
- return /* @__PURE__ */ React.createElement(
33
- View,
34
- __spreadProps(__spreadValues({}, props.attributes), {
35
- key:
36
- isEditing() && props.defaultValue ? props.defaultValue : 'default-key',
37
- placeholder: props.placeholder,
38
- type: props.type,
39
- name: props.name,
40
- value: props.value,
41
- defaultValue: props.defaultValue,
42
- required: props.required,
43
- })
44
- );
26
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
+ key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
28
+ placeholder: props.placeholder,
29
+ type: props.type,
30
+ name: props.name,
31
+ value: props.value,
32
+ defaultValue: props.defaultValue,
33
+ required: props.required
34
+ }));
45
35
  }
46
- export { FormInputComponent as default };
36
+ export {
37
+ FormInputComponent as default
38
+ };
39
+
47
40
 
48
- registerComponent(FormInputComponent, {
49
- name: 'Form:Input',
50
- builtIn: true,
51
- image:
52
- 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',
53
- inputs: [
54
- {
55
- name: 'type',
56
- type: 'text',
57
- enum: [
58
- 'text',
59
- 'number',
60
- 'email',
61
- 'url',
62
- 'checkbox',
63
- 'radio',
64
- 'range',
65
- 'date',
66
- 'datetime-local',
67
- 'search',
68
- 'tel',
69
- 'time',
70
- 'file',
71
- 'month',
72
- 'week',
73
- 'password',
74
- 'color',
75
- 'hidden',
76
- ],
77
- defaultValue: 'text',
78
- },
79
- {
80
- name: 'name',
81
- type: 'string',
82
- required: true,
83
- helperText:
84
- 'Every input in a form needs a unique name describing what it takes, e.g. "email"',
85
- },
86
- {
87
- name: 'placeholder',
88
- type: 'string',
89
- defaultValue: 'Hello there',
90
- helperText: 'Text to display when there is no value',
91
- },
92
- { name: 'defaultValue', type: 'string' },
93
- { name: 'value', type: 'string', advanced: true },
94
- {
95
- name: 'required',
96
- type: 'boolean',
97
- helperText: 'Is this input required to be filled out to submit a form',
98
- defaultValue: false,
99
- },
100
- ],
101
- noWrap: true,
102
- static: true,
103
- defaultStyles: {
104
- paddingTop: '10px',
105
- paddingBottom: '10px',
106
- paddingLeft: '10px',
107
- paddingRight: '10px',
108
- borderRadius: '3px',
109
- borderWidth: '1px',
110
- borderStyle: 'solid',
111
- borderColor: '#ccc',
112
- },
113
- });
41
+ registerComponent(FormInputComponent, {name:'Form:Input',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',inputs:[{name:'type',type:'text',enum:['text','number','email','url','checkbox','radio','range','date','datetime-local','search','tel','time','file','month','week','password','color','hidden'],defaultValue:'text'},{name:'name',type:'string',required:true,helperText:'Every input in a form needs a unique name describing what it takes, e.g. "email"'},{name:'placeholder',type:'string',defaultValue:'Hello there',helperText:'Text to display when there is no value'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',helperText:'Is this input required to be filled out to submit a form',defaultValue:false}],noWrap:true,static:true,defaultStyles:{paddingTop:'10px',paddingBottom:'10px',paddingLeft:'10px',paddingRight:'10px',borderRadius:'3px',borderWidth:'1px',borderStyle:'solid',borderColor:'#ccc'}});
@@ -1,13 +1,13 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { isEditing } from '../functions/is-editing';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { isEditing } from "../functions/is-editing";
4
4
 
5
5
  export default function FormInputComponent(props) {
6
6
  return (
7
7
  <View
8
8
  {...props.attributes}
9
9
  key={
10
- isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
10
+ isEditing() && props.defaultValue ? props.defaultValue : "default-key"
11
11
  }
12
12
  placeholder={props.placeholder}
13
13
  type={props.type}
@@ -1,21 +1,15 @@
1
1
  import { registerComponent } from '../functions/register-component';
2
2
 
3
- import * as React from 'react';
4
- import { View } from 'react-native';
3
+ import * as React from "react";
4
+ import { View } from "react-native";
5
5
  function RawText(props) {
6
- var _a, _b;
7
- return /* @__PURE__ */ React.createElement(View, {
8
- className:
9
- ((_a = props.attributes) == null ? void 0 : _a.class) ||
10
- ((_b = props.attributes) == null ? void 0 : _b.className),
11
- dangerouslySetInnerHTML: { __html: "props.text || ''" },
12
- });
6
+ return /* @__PURE__ */ React.createElement(View, {
7
+ dangerouslySetInnerHTML: { __html: "props.text || ''" }
8
+ });
13
9
  }
14
- export { RawText as default };
10
+ export {
11
+ RawText as default
12
+ };
15
13
 
16
- registerComponent(RawText, {
17
- name: 'Builder:RawText',
18
- hideFromInsertMenu: true,
19
- builtIn: true,
20
- inputs: [{ name: 'text', bubble: true, type: 'longText', required: true }],
21
- });
14
+
15
+ registerComponent(RawText, {name:'Builder:RawText',hideFromInsertMenu:true,builtIn:true,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
@@ -1,11 +1,6 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
3
 
4
4
  export default function RawText(props) {
5
- return (
6
- <View
7
- className={props.attributes?.class || props.attributes?.className}
8
- dangerouslySetInnerHTML={{ __html: "props.text || ''" }}
9
- />
10
- );
5
+ return <View dangerouslySetInnerHTML={{ __html: "props.text || ''" }} />;
11
6
  }
@@ -1,84 +1,36 @@
1
1
  import { registerComponent } from '../functions/register-component';
2
2
 
3
- var __defProp = Object.defineProperty;
3
+ var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
5
5
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
6
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) =>
10
- key in obj
11
- ? __defProp(obj, key, {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value,
16
- })
17
- : (obj[key] = value);
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
10
  var __spreadValues = (a, b) => {
19
- for (var prop in b || (b = {}))
20
- if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
26
20
  };
27
21
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- import * as React from 'react';
29
- import { View, Text } from 'react-native';
22
+ import * as React from "react";
23
+ import { View, Text } from "react-native";
30
24
  function SectionComponent(props) {
31
- return /* @__PURE__ */ React.createElement(
32
- View,
33
- __spreadProps(__spreadValues({}, props.attributes), {
34
- style:
35
- props.maxWidth && typeof props.maxWidth === 'number'
36
- ? {
37
- maxWidth: props.maxWidth,
38
- }
39
- : void 0,
40
- }),
41
- /* @__PURE__ */ React.createElement(Text, null, props.children)
42
- );
25
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
26
+ style: props.maxWidth && typeof props.maxWidth === "number" ? {
27
+ maxWidth: props.maxWidth
28
+ } : void 0
29
+ }), /* @__PURE__ */ React.createElement(Text, null, props.children));
43
30
  }
44
- export { SectionComponent as default };
31
+ export {
32
+ SectionComponent as default
33
+ };
34
+
45
35
 
46
- registerComponent(SectionComponent, {
47
- name: 'Core:Section',
48
- static: true,
49
- builtIn: true,
50
- image:
51
- 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a',
52
- inputs: [
53
- { name: 'maxWidth', type: 'number', defaultValue: 1200 },
54
- {
55
- name: 'lazyLoad',
56
- type: 'boolean',
57
- defaultValue: false,
58
- advanced: true,
59
- description: 'Only render this section when in view',
60
- },
61
- ],
62
- defaultStyles: {
63
- paddingLeft: '20px',
64
- paddingRight: '20px',
65
- paddingTop: '50px',
66
- paddingBottom: '50px',
67
- marginTop: '0px',
68
- width: '100vw',
69
- marginLeft: 'calc(50% - 50vw)',
70
- },
71
- canHaveChildren: true,
72
- defaultChildren: [
73
- {
74
- '@type': '@builder.io/sdk:Element',
75
- responsiveStyles: { large: { textAlign: 'center' } },
76
- component: {
77
- name: 'Text',
78
- options: {
79
- 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>",
80
- },
81
- },
82
- },
83
- ],
84
- });
36
+ registerComponent(SectionComponent, {name:'Core:Section',static:true,builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a',inputs:[{name:'maxWidth',type:'number',defaultValue:1200},{name:'lazyLoad',type:'boolean',defaultValue:false,advanced:true,description:'Only render this section when in view'}],defaultStyles:{paddingLeft:'20px',paddingRight:'20px',paddingTop:'50px',paddingBottom:'50px',marginTop:'0px',width:'100vw',marginLeft:'calc(50% - 50vw)'},canHaveChildren:true,defaultChildren:[{'@type':'@builder.io/sdk:Element',responsiveStyles:{large:{textAlign:'center'}},component:{name:'Text',options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]});
@@ -1,12 +1,12 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
3
 
4
4
  export default function SectionComponent(props) {
5
5
  return (
6
6
  <View
7
7
  {...props.attributes}
8
8
  style={
9
- props.maxWidth && typeof props.maxWidth === 'number'
9
+ props.maxWidth && typeof props.maxWidth === "number"
10
10
  ? {
11
11
  maxWidth: props.maxWidth,
12
12
  }
@@ -1,91 +1,41 @@
1
1
  import { registerComponent } from '../functions/register-component';
2
2
 
3
- var __defProp = Object.defineProperty;
3
+ var __defProp = Object.defineProperty;
4
4
  var __defProps = Object.defineProperties;
5
5
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
6
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) =>
10
- key in obj
11
- ? __defProp(obj, key, {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value,
16
- })
17
- : (obj[key] = value);
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18
10
  var __spreadValues = (a, b) => {
19
- for (var prop in b || (b = {}))
20
- if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
24
- }
25
- return a;
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
26
20
  };
27
21
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- import * as React from 'react';
29
- import { View, Text } from 'react-native';
30
- import { isEditing } from '../functions/is-editing';
22
+ import * as React from "react";
23
+ import { View, Text } from "react-native";
24
+ import { isEditing } from "../functions/is-editing";
31
25
  function SelectComponent(props) {
32
- var _a;
33
- return /* @__PURE__ */ React.createElement(
34
- View,
35
- __spreadProps(__spreadValues({}, props.attributes), {
36
- value: props.value,
37
- key:
38
- isEditing() && props.defaultValue ? props.defaultValue : 'default-key',
39
- defaultValue: props.defaultValue,
40
- name: props.name,
41
- }),
42
- (_a = props.options) == null
43
- ? void 0
44
- : _a.map((option) =>
45
- /* @__PURE__ */ React.createElement(
46
- View,
47
- {
48
- value: option.value,
49
- },
50
- /* @__PURE__ */ React.createElement(
51
- Text,
52
- null,
53
- option.name || option.value
54
- )
55
- )
56
- )
57
- );
26
+ var _a;
27
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
28
+ value: props.value,
29
+ key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
30
+ defaultValue: props.defaultValue,
31
+ name: props.name
32
+ }), (_a = props.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ React.createElement(View, {
33
+ value: option.value
34
+ }, /* @__PURE__ */ React.createElement(Text, null, option.name || option.value))));
58
35
  }
59
- export { SelectComponent as default };
36
+ export {
37
+ SelectComponent as default
38
+ };
39
+
60
40
 
61
- registerComponent(SelectComponent, {
62
- name: 'Form:Select',
63
- builtIn: true,
64
- image:
65
- 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',
66
- defaultStyles: { alignSelf: 'flex-start' },
67
- inputs: [
68
- {
69
- name: 'options',
70
- type: 'list',
71
- required: true,
72
- subFields: [
73
- { name: 'value', type: 'text', required: true },
74
- { name: 'name', type: 'text' },
75
- ],
76
- defaultValue: [{ value: 'option 1' }, { value: 'option 2' }],
77
- },
78
- {
79
- name: 'name',
80
- type: 'string',
81
- required: true,
82
- helperText:
83
- 'Every select in a form needs a unique name describing what it gets, e.g. "email"',
84
- },
85
- { name: 'defaultValue', type: 'string' },
86
- { name: 'value', type: 'string', advanced: true },
87
- { name: 'required', type: 'boolean', defaultValue: false },
88
- ],
89
- static: true,
90
- noWrap: true,
91
- });
41
+ registerComponent(SelectComponent, {name:'Form:Select',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',defaultStyles:{alignSelf:'flex-start'},inputs:[{name:'options',type:'list',required:true,subFields:[{name:'value',type:'text',required:true},{name:'name',type:'text'}],defaultValue:[{value:'option 1'},{value:'option 2'}]},{name:'name',type:'string',required:true,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',defaultValue:false}],static:true,noWrap:true});
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { isEditing } from '../functions/is-editing';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { isEditing } from "../functions/is-editing";
4
4
 
5
5
  export default function SelectComponent(props) {
6
6
  return (
@@ -8,12 +8,12 @@ export default function SelectComponent(props) {
8
8
  {...props.attributes}
9
9
  value={props.value}
10
10
  key={
11
- isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
11
+ isEditing() && props.defaultValue ? props.defaultValue : "default-key"
12
12
  }
13
13
  defaultValue={props.defaultValue}
14
14
  name={props.name}
15
15
  >
16
- {props.options?.map((option) => (
16
+ {props.options?.map((option, index) => (
17
17
  <View value={option.value}>
18
18
  <Text>{option.name || option.value}</Text>
19
19
  </View>