@builder.io/sdk-react-native 0.0.1-4 → 0.0.1-40

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 (83) hide show
  1. package/package.json +6 -4
  2. package/src/blocks/button.js +73 -24
  3. package/src/blocks/button.lite.tsx +10 -14
  4. package/src/blocks/columns.js +258 -40
  5. package/src/blocks/columns.lite.tsx +7 -13
  6. package/src/blocks/custom-code.js +76 -47
  7. package/src/blocks/custom-code.lite.tsx +12 -12
  8. package/src/blocks/embed.js +69 -47
  9. package/src/blocks/embed.lite.tsx +11 -11
  10. package/src/blocks/form.js +491 -198
  11. package/src/blocks/form.lite.tsx +52 -56
  12. package/src/blocks/fragment.js +21 -0
  13. package/src/blocks/fragment.lite.tsx +10 -0
  14. package/src/blocks/image.js +89 -83
  15. package/src/blocks/image.lite.tsx +47 -14
  16. package/src/blocks/img.js +51 -28
  17. package/src/blocks/img.lite.tsx +6 -7
  18. package/src/blocks/input.js +100 -28
  19. package/src/blocks/input.lite.tsx +4 -7
  20. package/src/blocks/raw-text.js +16 -12
  21. package/src/blocks/raw-text.lite.tsx +2 -3
  22. package/src/blocks/section.js +71 -23
  23. package/src/blocks/section.lite.tsx +4 -5
  24. package/src/blocks/select.js +78 -27
  25. package/src/blocks/select.lite.tsx +8 -9
  26. package/src/blocks/submit-button.js +47 -21
  27. package/src/blocks/submit-button.lite.tsx +3 -4
  28. package/src/blocks/symbol.js +18 -16
  29. package/src/blocks/symbol.lite.tsx +5 -5
  30. package/src/blocks/text.js +85 -16
  31. package/src/blocks/text.lite.tsx +3 -4
  32. package/src/blocks/textarea.js +60 -24
  33. package/src/blocks/textarea.lite.tsx +2 -3
  34. package/src/blocks/video.js +97 -46
  35. package/src/blocks/video.lite.tsx +5 -6
  36. package/src/components/block-styles.js +5 -0
  37. package/src/components/block-styles.lite.tsx +6 -0
  38. package/src/components/error-boundary.js +27 -0
  39. package/src/components/error-boundary.lite.tsx +6 -0
  40. package/src/components/render-block.js +123 -38
  41. package/src/components/render-block.lite.tsx +70 -33
  42. package/src/components/render-blocks.js +61 -35
  43. package/src/components/render-blocks.lite.tsx +17 -14
  44. package/src/components/render-content.js +185 -36
  45. package/src/components/render-content.lite.tsx +144 -32
  46. package/src/constants/device-sizes.js +8 -11
  47. package/src/context/builder.context.js +2 -4
  48. package/src/functions/evaluate.js +18 -9
  49. package/src/functions/event-handler-name.js +6 -0
  50. package/src/functions/get-block-actions.js +13 -13
  51. package/src/functions/get-block-component-options.js +27 -4
  52. package/src/functions/get-block-properties.js +24 -16
  53. package/src/functions/get-block-styles.js +56 -9
  54. package/src/functions/get-block-tag.js +2 -4
  55. package/src/functions/get-content.js +72 -25
  56. package/src/functions/get-content.test.js +58 -0
  57. package/src/functions/get-fetch.js +11 -0
  58. package/src/functions/get-global-this.js +17 -0
  59. package/src/functions/get-processed-block.js +19 -13
  60. package/src/functions/get-processed-block.test.js +18 -14
  61. package/src/functions/get-target.js +3 -5
  62. package/src/functions/if-target.js +1 -3
  63. package/src/functions/is-browser.js +7 -5
  64. package/src/functions/is-editing.js +5 -5
  65. package/src/functions/is-iframe.js +2 -4
  66. package/src/functions/is-previewing.js +13 -0
  67. package/src/functions/is-react-native.js +2 -4
  68. package/src/functions/macro-eval.js +2 -5
  69. package/src/functions/on-change.js +4 -7
  70. package/src/functions/on-change.test.js +10 -10
  71. package/src/functions/previewing-model-name.js +10 -0
  72. package/src/functions/register-component.js +39 -27
  73. package/src/functions/register.js +28 -0
  74. package/src/functions/set-editor-settings.js +14 -0
  75. package/src/functions/set.js +14 -5
  76. package/src/functions/set.test.js +14 -14
  77. package/src/functions/track.js +6 -8
  78. package/src/functions/transform-block.js +40 -0
  79. package/src/index.js +18 -16
  80. package/src/scripts/init-editing.js +67 -29
  81. package/src/types/deep-partial.js +1 -0
  82. package/index.js +0 -11
  83. package/src/package.json +0 -18
package/src/blocks/img.js CHANGED
@@ -1,41 +1,64 @@
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) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
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);
10
18
  var __spreadValues = (a, b) => {
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;
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;
20
26
  };
21
27
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- import * as React from "react";
23
- import { View } from "react-native";
24
- import { Builder } from "@builder.io/sdk";
28
+ import * as React from 'react';
29
+ import { View } from 'react-native';
30
+ import { isEditing } from '../functions/is-editing';
25
31
  function ImgComponent(props) {
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: Builder.isEditing && props.imgSrc || "default-key",
32
- alt: props.altText,
33
- src: props.imgSrc
34
- }));
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
+ );
35
44
  }
36
- export {
37
- ImgComponent as default
38
- };
39
-
45
+ export { ImgComponent as default };
40
46
 
41
- registerComponent(ImgComponent, {name:'Raw:Img',hideFromInsertMenu: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});
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
+ });
@@ -1,17 +1,16 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
- import { Builder } from "@builder.io/sdk";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
3
+ import { isEditing } from '../functions/is-editing';
5
4
 
6
5
  export default function ImgComponent(props) {
7
6
  return (
8
7
  <View
9
8
  {...props.attributes}
10
9
  style={{
11
- objectFit: props.backgroundSize || "cover",
12
- objectPosition: props.backgroundPosition || "center",
10
+ objectFit: props.backgroundSize || 'cover',
11
+ objectPosition: props.backgroundPosition || 'center',
13
12
  }}
14
- key={(Builder.isEditing && props.imgSrc) || "default-key"}
13
+ key={(isEditing() && props.imgSrc) || 'default-key'}
15
14
  alt={props.altText}
16
15
  src={props.imgSrc}
17
16
  />
@@ -1,41 +1,113 @@
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) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
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);
10
18
  var __spreadValues = (a, b) => {
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;
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;
20
26
  };
21
27
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- import * as React from "react";
23
- import { View } from "react-native";
24
- import { Builder } from "@builder.io/sdk";
28
+ import * as React from 'react';
29
+ import { View } from 'react-native';
30
+ import { isEditing } from '../functions/is-editing';
25
31
  function FormInputComponent(props) {
26
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
- key: Builder.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
- }));
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
+ );
35
45
  }
36
- export {
37
- FormInputComponent as default
38
- };
39
-
46
+ export { FormInputComponent as default };
40
47
 
41
- registerComponent(FormInputComponent, {name:'Form:Input',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'}});
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
+ });
@@ -1,16 +1,13 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
- import { Builder } from "@builder.io/sdk";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
3
+ import { isEditing } from '../functions/is-editing';
5
4
 
6
5
  export default function FormInputComponent(props) {
7
6
  return (
8
7
  <View
9
8
  {...props.attributes}
10
9
  key={
11
- Builder.isEditing && props.defaultValue
12
- ? props.defaultValue
13
- : "default-key"
10
+ isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
14
11
  }
15
12
  placeholder={props.placeholder}
16
13
  type={props.type}
@@ -1,17 +1,21 @@
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: ((_a = props.attributes) == null ? void 0 : _a.class) || ((_b = props.attributes) == null ? void 0 : _b.className),
9
- dangerouslySetInnerHTML: { __html: "props.text || ''" }
10
- });
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
+ });
11
13
  }
12
- export {
13
- RawText as default
14
- };
15
-
14
+ export { RawText as default };
16
15
 
17
- registerComponent(RawText, {name:'Builder:RawText',hideFromInsertMenu:true,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
16
+ registerComponent(RawText, {
17
+ name: 'Builder:RawText',
18
+ hideFromInsertMenu: true,
19
+ builtIn: true,
20
+ inputs: [{ name: 'text', bubble: true, type: 'longText', required: true }],
21
+ });
@@ -1,6 +1,5 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
4
3
 
5
4
  export default function RawText(props) {
6
5
  return (
@@ -1,36 +1,84 @@
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) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
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);
10
18
  var __spreadValues = (a, b) => {
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;
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;
20
26
  };
21
27
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- import * as React from "react";
23
- import { View } from "react-native";
28
+ import * as React from 'react';
29
+ import { View, Text } from 'react-native';
24
30
  function SectionComponent(props) {
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
- }), props.children);
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
+ );
30
43
  }
31
- export {
32
- SectionComponent as default
33
- };
34
-
44
+ export { SectionComponent as default };
35
45
 
36
- registerComponent(SectionComponent, {name:'Core:Section',static: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>"}}}]});
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
+ });
@@ -1,20 +1,19 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
4
3
 
5
4
  export default function SectionComponent(props) {
6
5
  return (
7
6
  <View
8
7
  {...props.attributes}
9
8
  style={
10
- props.maxWidth && typeof props.maxWidth === "number"
9
+ props.maxWidth && typeof props.maxWidth === 'number'
11
10
  ? {
12
11
  maxWidth: props.maxWidth,
13
12
  }
14
13
  : undefined
15
14
  }
16
15
  >
17
- {props.children}
16
+ <Text>{props.children}</Text>
18
17
  </View>
19
18
  );
20
19
  }
@@ -1,40 +1,91 @@
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) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
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);
10
18
  var __spreadValues = (a, b) => {
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;
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;
20
26
  };
21
27
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- import * as React from "react";
23
- import { View } from "react-native";
24
- import { Builder } from "@builder.io/sdk";
28
+ import * as React from 'react';
29
+ import { View, Text } from 'react-native';
30
+ import { isEditing } from '../functions/is-editing';
25
31
  function SelectComponent(props) {
26
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
- value: props.value,
28
- key: Builder.isEditing && props.defaultValue ? props.defaultValue : "default-key",
29
- defaultValue: props.defaultValue,
30
- name: props.name
31
- }), props.options.map((option) => /* @__PURE__ */ React.createElement(View, {
32
- value: option.value
33
- }, option.name || option.value)));
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
+ );
34
58
  }
35
- export {
36
- SelectComponent as default
37
- };
38
-
59
+ export { SelectComponent as default };
39
60
 
40
- registerComponent(SelectComponent, {name:'Form:Select',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});
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
+ });
@@ -1,7 +1,6 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
4
- import { Builder } from "@builder.io/sdk";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
3
+ import { isEditing } from '../functions/is-editing';
5
4
 
6
5
  export default function SelectComponent(props) {
7
6
  return (
@@ -9,15 +8,15 @@ export default function SelectComponent(props) {
9
8
  {...props.attributes}
10
9
  value={props.value}
11
10
  key={
12
- Builder.isEditing && props.defaultValue
13
- ? props.defaultValue
14
- : "default-key"
11
+ isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
15
12
  }
16
13
  defaultValue={props.defaultValue}
17
14
  name={props.name}
18
15
  >
19
- {props.options.map((option) => (
20
- <View value={option.value}>{option.name || option.value}</View>
16
+ {props.options?.map((option) => (
17
+ <View value={option.value}>
18
+ <Text>{option.name || option.value}</Text>
19
+ </View>
21
20
  ))}
22
21
  </View>
23
22
  );