@builder.io/sdk-solid 0.0.5 → 0.0.8-0

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 (128) hide show
  1. package/package.json +9 -2
  2. package/src/blocks/button/button.jsx +13 -0
  3. package/src/blocks/button/button.lite.tsx +20 -0
  4. package/src/blocks/button/component-info.js +41 -0
  5. package/src/blocks/button/index.js +7 -0
  6. package/src/blocks/columns/columns.jsx +91 -0
  7. package/src/blocks/{columns.lite.tsx → columns/columns.lite.tsx} +32 -26
  8. package/src/blocks/columns/component-info.js +217 -0
  9. package/src/blocks/columns/index.js +7 -0
  10. package/src/blocks/custom-code/component-info.js +31 -0
  11. package/src/blocks/{custom-code.js → custom-code/custom-code.jsx} +5 -26
  12. package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.lite.tsx} +3 -1
  13. package/src/blocks/custom-code/index.js +7 -0
  14. package/src/blocks/embed/component-info.js +24 -0
  15. package/src/blocks/embed/embed.jsx +51 -0
  16. package/src/blocks/{embed.lite.tsx → embed/embed.lite.tsx} +3 -1
  17. package/src/blocks/embed/index.js +7 -0
  18. package/src/blocks/form/component-info.js +262 -0
  19. package/src/blocks/form/form.jsx +253 -0
  20. package/src/blocks/{form.lite.tsx → form/form.lite.tsx} +14 -8
  21. package/src/blocks/form/index.js +7 -0
  22. package/src/blocks/fragment/component-info.js +11 -0
  23. package/src/blocks/fragment/fragment.jsx +5 -0
  24. package/src/blocks/fragment/fragment.lite.tsx +5 -0
  25. package/src/blocks/fragment/index.js +7 -0
  26. package/src/blocks/image/component-info.js +104 -0
  27. package/src/blocks/image/image.jsx +54 -0
  28. package/src/blocks/image/image.lite.tsx +83 -0
  29. package/src/blocks/image/index.js +7 -0
  30. package/src/blocks/img/component-info.js +20 -0
  31. package/src/blocks/img/img.jsx +10 -0
  32. package/src/blocks/{img.lite.tsx → img/img.lite.tsx} +4 -2
  33. package/src/blocks/img/index.js +7 -0
  34. package/src/blocks/input/component-info.js +74 -0
  35. package/src/blocks/input/index.js +7 -0
  36. package/src/blocks/input/input.jsx +7 -0
  37. package/src/blocks/{input.lite.tsx → input/input.lite.tsx} +4 -2
  38. package/src/blocks/raw-text/component-info.js +16 -0
  39. package/src/blocks/raw-text/index.js +7 -0
  40. package/src/blocks/raw-text/raw-text.jsx +5 -0
  41. package/src/blocks/{raw-text.lite.tsx → raw-text/raw-text.lite.tsx} +3 -1
  42. package/src/blocks/section/component-info.js +49 -0
  43. package/src/blocks/section/index.js +7 -0
  44. package/src/blocks/section/section.jsx +9 -0
  45. package/src/blocks/{section.lite.tsx → section/section.lite.tsx} +3 -1
  46. package/src/blocks/select/component-info.js +59 -0
  47. package/src/blocks/select/index.js +7 -0
  48. package/src/blocks/select/select.jsx +16 -0
  49. package/src/blocks/{select.lite.tsx → select/select.lite.tsx} +10 -5
  50. package/src/blocks/submit-button/component-info.js +28 -0
  51. package/src/blocks/submit-button/index.js +7 -0
  52. package/src/blocks/submit-button/submit-button.jsx +7 -0
  53. package/src/blocks/{submit-button.lite.tsx → submit-button/submit-button.lite.tsx} +3 -1
  54. package/src/blocks/symbol/component-info.js +42 -0
  55. package/src/blocks/symbol/index.js +7 -0
  56. package/src/blocks/symbol/symbol.jsx +24 -0
  57. package/src/blocks/{symbol.lite.tsx → symbol/symbol.lite.tsx} +6 -4
  58. package/src/blocks/text/component-info.js +24 -0
  59. package/src/blocks/text/index.js +7 -0
  60. package/src/blocks/{text.lite.tsx → text/text.jsx} +3 -1
  61. package/src/blocks/text/text.lite.tsx +5 -0
  62. package/src/blocks/textarea/component-info.js +47 -0
  63. package/src/blocks/textarea/index.js +7 -0
  64. package/src/blocks/textarea/textarea.jsx +5 -0
  65. package/src/blocks/{textarea.lite.tsx → textarea/textarea.lite.tsx} +3 -1
  66. package/src/blocks/video/component-info.js +106 -0
  67. package/src/blocks/video/index.js +7 -0
  68. package/src/blocks/video/video.jsx +14 -0
  69. package/src/blocks/{video.lite.tsx → video/video.lite.tsx} +3 -1
  70. package/src/components/error-boundary.jsx +5 -0
  71. package/src/components/error-boundary.lite.tsx +3 -1
  72. package/src/components/render-block/block-styles.jsx +36 -0
  73. package/src/components/render-block/block-styles.lite.tsx +38 -0
  74. package/src/components/render-block/render-block.jsx +117 -0
  75. package/src/components/{render-block.lite.tsx → render-block/render-block.lite.tsx} +24 -13
  76. package/src/components/render-blocks.jsx +57 -0
  77. package/src/components/render-blocks.lite.tsx +9 -6
  78. package/src/components/render-content/components/{render-styles.js → render-styles.jsx} +8 -15
  79. package/src/components/render-content/components/render-styles.lite.tsx +10 -4
  80. package/src/components/render-content/{render-content.js → render-content.jsx} +42 -94
  81. package/src/components/render-content/render-content.lite.tsx +23 -20
  82. package/src/components/render-inlined-styles.jsx +23 -0
  83. package/src/components/render-inlined-styles.lite.tsx +26 -0
  84. package/src/functions/evaluate.js +2 -2
  85. package/src/functions/get-block-actions.js +2 -2
  86. package/src/functions/get-builder-search-params/fn.test.js +1 -1
  87. package/src/functions/get-content/index.js +3 -2
  88. package/src/functions/get-fetch.js +29 -7
  89. package/src/functions/get-processed-block.js +3 -3
  90. package/src/functions/get-processed-block.test.js +1 -1
  91. package/src/functions/if-target.js +1 -1
  92. package/src/functions/is-editing.js +1 -1
  93. package/src/functions/is-iframe.js +1 -1
  94. package/src/functions/is-previewing.js +2 -2
  95. package/src/functions/on-change.test.js +1 -1
  96. package/src/functions/previewing-model-name.js +1 -1
  97. package/src/functions/register-component.js +1 -1
  98. package/src/functions/register.js +1 -1
  99. package/src/functions/set-editor-settings.js +1 -1
  100. package/src/functions/set.test.js +1 -1
  101. package/src/functions/track.js +3 -3
  102. package/src/index-helpers/blocks-exports.js +8 -8
  103. package/src/index.js +10 -13
  104. package/src/scripts/init-editing.js +72 -63
  105. package/src/blocks/button.js +0 -32
  106. package/src/blocks/button.lite.tsx +0 -12
  107. package/src/blocks/columns.js +0 -133
  108. package/src/blocks/embed.js +0 -62
  109. package/src/blocks/form.js +0 -355
  110. package/src/blocks/fragment.js +0 -15
  111. package/src/blocks/fragment.lite.tsx +0 -3
  112. package/src/blocks/image.js +0 -211
  113. package/src/blocks/image.lite.tsx +0 -169
  114. package/src/blocks/img.js +0 -39
  115. package/src/blocks/input.js +0 -45
  116. package/src/blocks/raw-text.js +0 -25
  117. package/src/blocks/section.js +0 -24
  118. package/src/blocks/select.js +0 -57
  119. package/src/blocks/submit-button.js +0 -18
  120. package/src/blocks/symbol.js +0 -69
  121. package/src/blocks/text.js +0 -15
  122. package/src/blocks/textarea.js +0 -34
  123. package/src/blocks/video.js +0 -54
  124. package/src/components/block-styles.js +0 -3
  125. package/src/components/block-styles.lite.tsx +0 -3
  126. package/src/components/error-boundary.js +0 -3
  127. package/src/components/render-block.js +0 -154
  128. package/src/components/render-blocks.js +0 -104
@@ -0,0 +1,104 @@
1
+ const componentInfo = {
2
+ name: "Image",
3
+ static: true,
4
+ builtIn: true,
5
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
6
+ defaultStyles: {
7
+ position: "relative",
8
+ minHeight: "20px",
9
+ minWidth: "20px",
10
+ overflow: "hidden"
11
+ },
12
+ canHaveChildren: true,
13
+ inputs: [
14
+ {
15
+ name: "image",
16
+ type: "file",
17
+ bubble: true,
18
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
19
+ required: true,
20
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
21
+ onChange: " const DEFAULT_ASPECT_RATIO = 0.7041; options.delete('srcset'); options.delete('noWebp'); function loadImage(url, timeout) { return new Promise((resolve, reject) => { const img = document.createElement('img'); let loaded = false; img.onload = () => { loaded = true; resolve(img); }; img.addEventListener('error', event => { console.warn('Image load failed', event.error); reject(event.error); }); img.src = url; setTimeout(() => { if (!loaded) { reject(new Error('Image load timed out')); } }, timeout); }); } function round(num) { return Math.round(num * 1000) / 1000; } const value = options.get('image'); const aspectRatio = options.get('aspectRatio'); // For SVG images - don't render as webp, keep them as SVG fetch(value) .then(res => res.blob()) .then(blob => { if (blob.type.includes('svg')) { options.set('noWebp', true); } }); if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) { return loadImage(value).then(img => { const possiblyUpdatedAspectRatio = options.get('aspectRatio'); if ( options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO) ) { if (img.width && img.height) { options.set('aspectRatio', round(img.height / img.width)); options.set('height', img.height); options.set('width', img.width); } } }); }"
22
+ },
23
+ {
24
+ name: "backgroundSize",
25
+ type: "text",
26
+ defaultValue: "cover",
27
+ enum: [
28
+ {
29
+ label: "contain",
30
+ value: "contain",
31
+ helperText: "The image should never get cropped"
32
+ },
33
+ {
34
+ label: "cover",
35
+ value: "cover",
36
+ helperText: "The image should fill it's box, cropping when needed"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ name: "backgroundPosition",
42
+ type: "text",
43
+ defaultValue: "center",
44
+ enum: [
45
+ "center",
46
+ "top",
47
+ "left",
48
+ "right",
49
+ "bottom",
50
+ "top left",
51
+ "top right",
52
+ "bottom left",
53
+ "bottom right"
54
+ ]
55
+ },
56
+ {
57
+ name: "altText",
58
+ type: "string",
59
+ helperText: "Text to display when the user has images off"
60
+ },
61
+ {
62
+ name: "height",
63
+ type: "number",
64
+ hideFromUI: true
65
+ },
66
+ {
67
+ name: "width",
68
+ type: "number",
69
+ hideFromUI: true
70
+ },
71
+ {
72
+ name: "sizes",
73
+ type: "string",
74
+ hideFromUI: true
75
+ },
76
+ {
77
+ name: "srcset",
78
+ type: "string",
79
+ hideFromUI: true
80
+ },
81
+ {
82
+ name: "lazy",
83
+ type: "boolean",
84
+ defaultValue: true,
85
+ hideFromUI: true
86
+ },
87
+ {
88
+ name: "fitContent",
89
+ type: "boolean",
90
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
91
+ defaultValue: true
92
+ },
93
+ {
94
+ name: "aspectRatio",
95
+ type: "number",
96
+ 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",
97
+ advanced: true,
98
+ defaultValue: 0.7041
99
+ }
100
+ ]
101
+ };
102
+ export {
103
+ componentInfo
104
+ };
@@ -0,0 +1,54 @@
1
+ import { Show } from "solid-js";
2
+ import { css } from "solid-styled-components";
3
+
4
+ function Image(props) {
5
+ return <div class={css({
6
+ position: "relative"
7
+ })}>
8
+ <picture>
9
+ <img class={"builder-image" + (props.className ? " " + props.className : "") + " " + css({
10
+ opacity: "1",
11
+ transition: "opacity 0.2s ease-in-out",
12
+ position: "absolute",
13
+ height: "100%",
14
+ width: "100%",
15
+ top: "0px",
16
+ left: "0px"
17
+ })} loading="lazy" alt={props.altText} aria-role={props.altText ? "presentation" : undefined} style={{
18
+ "object-position": props.backgroundSize || "center",
19
+ "object-fit": props.backgroundSize || "cover"
20
+ }} src={props.image} srcset={props.srcset} sizes={props.sizes} />
21
+ <source srcSet={props.srcset} />
22
+ </picture>
23
+ <Show when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}>
24
+ <div class={css({
25
+ width: "100%",
26
+ pointerEvents: "none",
27
+ fontSize: "0"
28
+ })} style={{
29
+ "padding-top": props.aspectRatio * 100 + "%"
30
+ }}>
31
+ {" "}
32
+ </div>
33
+ </Show>
34
+ <Show when={props.builderBlock?.children?.length && props.fitContent}>
35
+ {props.children}
36
+ </Show>
37
+ <Show when={!props.fitContent}>
38
+ <div class={css({
39
+ display: "flex",
40
+ flexDirection: "column",
41
+ alignItems: "stretch",
42
+ position: "absolute",
43
+ top: "0",
44
+ left: "0",
45
+ width: "100%",
46
+ height: "100%"
47
+ })}>
48
+ {props.children}
49
+ </div>
50
+ </Show>
51
+ </div>;
52
+ }
53
+
54
+ export default Image;
@@ -0,0 +1,83 @@
1
+ import { Show } from "solid-js";
2
+
3
+ import { css } from "solid-styled-components";
4
+
5
+ function Image(props) {
6
+ return (
7
+ <div
8
+ class={css({
9
+ position: "relative",
10
+ })}
11
+ >
12
+ <picture>
13
+ <img
14
+ class={
15
+ "builder-image" +
16
+ (props.className ? " " + props.className : "") +
17
+ " " +
18
+ css({
19
+ opacity: "1",
20
+ transition: "opacity 0.2s ease-in-out",
21
+ position: "absolute",
22
+ height: "100%",
23
+ width: "100%",
24
+ top: "0px",
25
+ left: "0px",
26
+ })
27
+ }
28
+ loading="lazy"
29
+ alt={props.altText}
30
+ aria-role={props.altText ? "presentation" : undefined}
31
+ style={{
32
+ "object-position": props.backgroundSize || "center",
33
+ "object-fit": props.backgroundSize || "cover",
34
+ }}
35
+ src={props.image}
36
+ srcset={props.srcset}
37
+ sizes={props.sizes}
38
+ />
39
+ <source srcSet={props.srcset} />
40
+ </picture>
41
+ <Show
42
+ when={
43
+ props.aspectRatio &&
44
+ !(props.fitContent && props.builderBlock?.children?.length)
45
+ }
46
+ >
47
+ <div
48
+ class={css({
49
+ width: "100%",
50
+ pointerEvents: "none",
51
+ fontSize: "0",
52
+ })}
53
+ style={{
54
+ "padding-top": props.aspectRatio * 100 + "%",
55
+ }}
56
+ >
57
+ {" "}
58
+ </div>
59
+ </Show>
60
+ <Show when={props.builderBlock?.children?.length && props.fitContent}>
61
+ {props.children}
62
+ </Show>
63
+ <Show when={!props.fitContent}>
64
+ <div
65
+ class={css({
66
+ display: "flex",
67
+ flexDirection: "column",
68
+ alignItems: "stretch",
69
+ position: "absolute",
70
+ top: "0",
71
+ left: "0",
72
+ width: "100%",
73
+ height: "100%",
74
+ })}
75
+ >
76
+ {props.children}
77
+ </div>
78
+ </Show>
79
+ </div>
80
+ );
81
+ }
82
+
83
+ export default Image;
@@ -0,0 +1,7 @@
1
+ import { registerComponent } from "../../functions/register-component.js";
2
+ import { componentInfo } from "./component-info.js";
3
+ import component from "./image";
4
+ var stdin_default = registerComponent(component, componentInfo);
5
+ export {
6
+ stdin_default as default
7
+ };
@@ -0,0 +1,20 @@
1
+ const componentInfo = {
2
+ name: "Raw:Img",
3
+ hideFromInsertMenu: true,
4
+ builtIn: true,
5
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
6
+ inputs: [
7
+ {
8
+ name: "image",
9
+ bubble: true,
10
+ type: "file",
11
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
12
+ required: true
13
+ }
14
+ ],
15
+ noWrap: true,
16
+ static: true
17
+ };
18
+ export {
19
+ componentInfo
20
+ };
@@ -0,0 +1,10 @@
1
+ import { isEditing } from "../../functions/is-editing.js";
2
+
3
+ function ImgComponent(props) {
4
+ return <img {...props.attributes} style={{
5
+ "object-fit": props.backgroundSize || "cover",
6
+ "object-position": props.backgroundPosition || "center"
7
+ }} key={isEditing() && props.imgSrc || "default-key"} alt={props.altText} src={props.imgSrc} />;
8
+ }
9
+
10
+ export default ImgComponent;
@@ -1,6 +1,6 @@
1
- import { isEditing } from "../functions/is-editing";
1
+ import { isEditing } from "../../functions/is-editing.js";
2
2
 
3
- export default function ImgComponent(props) {
3
+ function ImgComponent(props) {
4
4
  return (
5
5
  <img
6
6
  {...props.attributes}
@@ -14,3 +14,5 @@ export default function ImgComponent(props) {
14
14
  />
15
15
  );
16
16
  }
17
+
18
+ export default ImgComponent;
@@ -0,0 +1,7 @@
1
+ import { registerComponent } from "../../functions/register-component.js";
2
+ import { componentInfo } from "./component-info.js";
3
+ import component from "./img";
4
+ var stdin_default = registerComponent(component, componentInfo);
5
+ export {
6
+ stdin_default as default
7
+ };
@@ -0,0 +1,74 @@
1
+ const componentInfo = {
2
+ name: "Form:Input",
3
+ builtIn: true,
4
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
5
+ inputs: [
6
+ {
7
+ name: "type",
8
+ type: "text",
9
+ enum: [
10
+ "text",
11
+ "number",
12
+ "email",
13
+ "url",
14
+ "checkbox",
15
+ "radio",
16
+ "range",
17
+ "date",
18
+ "datetime-local",
19
+ "search",
20
+ "tel",
21
+ "time",
22
+ "file",
23
+ "month",
24
+ "week",
25
+ "password",
26
+ "color",
27
+ "hidden"
28
+ ],
29
+ defaultValue: "text"
30
+ },
31
+ {
32
+ name: "name",
33
+ type: "string",
34
+ required: true,
35
+ helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
36
+ },
37
+ {
38
+ name: "placeholder",
39
+ type: "string",
40
+ defaultValue: "Hello there",
41
+ helperText: "Text to display when there is no value"
42
+ },
43
+ {
44
+ name: "defaultValue",
45
+ type: "string"
46
+ },
47
+ {
48
+ name: "value",
49
+ type: "string",
50
+ advanced: true
51
+ },
52
+ {
53
+ name: "required",
54
+ type: "boolean",
55
+ helperText: "Is this input required to be filled out to submit a form",
56
+ defaultValue: false
57
+ }
58
+ ],
59
+ noWrap: true,
60
+ static: true,
61
+ defaultStyles: {
62
+ paddingTop: "10px",
63
+ paddingBottom: "10px",
64
+ paddingLeft: "10px",
65
+ paddingRight: "10px",
66
+ borderRadius: "3px",
67
+ borderWidth: "1px",
68
+ borderStyle: "solid",
69
+ borderColor: "#ccc"
70
+ }
71
+ };
72
+ export {
73
+ componentInfo
74
+ };
@@ -0,0 +1,7 @@
1
+ import { registerComponent } from "../../functions/register-component.js";
2
+ import { componentInfo } from "./component-info.js";
3
+ import component from "./input";
4
+ var stdin_default = registerComponent(component, componentInfo);
5
+ export {
6
+ stdin_default as default
7
+ };
@@ -0,0 +1,7 @@
1
+ import { isEditing } from "../../functions/is-editing.js";
2
+
3
+ function FormInputComponent(props) {
4
+ return <input {...props.attributes} key={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} />;
5
+ }
6
+
7
+ export default FormInputComponent;
@@ -1,6 +1,6 @@
1
- import { isEditing } from "../functions/is-editing";
1
+ import { isEditing } from "../../functions/is-editing.js";
2
2
 
3
- export default function FormInputComponent(props) {
3
+ function FormInputComponent(props) {
4
4
  return (
5
5
  <input
6
6
  {...props.attributes}
@@ -16,3 +16,5 @@ export default function FormInputComponent(props) {
16
16
  />
17
17
  );
18
18
  }
19
+
20
+ export default FormInputComponent;
@@ -0,0 +1,16 @@
1
+ const componentInfo = {
2
+ name: "Builder:RawText",
3
+ hideFromInsertMenu: true,
4
+ builtIn: true,
5
+ inputs: [
6
+ {
7
+ name: "text",
8
+ bubble: true,
9
+ type: "longText",
10
+ required: true
11
+ }
12
+ ]
13
+ };
14
+ export {
15
+ componentInfo
16
+ };
@@ -0,0 +1,7 @@
1
+ import { registerComponent } from "../../functions/register-component.js";
2
+ import { componentInfo } from "./component-info.js";
3
+ import component from "./raw-text";
4
+ var stdin_default = registerComponent(component, componentInfo);
5
+ export {
6
+ stdin_default as default
7
+ };
@@ -0,0 +1,5 @@
1
+ function RawText(props) {
2
+ return <span class={props.attributes?.class || props.attributes?.className} innerHTML={props.text || ""}></span>;
3
+ }
4
+
5
+ export default RawText;
@@ -1,4 +1,4 @@
1
- export default function RawText(props) {
1
+ function RawText(props) {
2
2
  return (
3
3
  <span
4
4
  class={props.attributes?.class || props.attributes?.className}
@@ -6,3 +6,5 @@ export default function RawText(props) {
6
6
  ></span>
7
7
  );
8
8
  }
9
+
10
+ export default RawText;
@@ -0,0 +1,49 @@
1
+ const componentInfo = {
2
+ name: "Core:Section",
3
+ static: true,
4
+ builtIn: true,
5
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
6
+ inputs: [
7
+ {
8
+ name: "maxWidth",
9
+ type: "number",
10
+ defaultValue: 1200
11
+ },
12
+ {
13
+ name: "lazyLoad",
14
+ type: "boolean",
15
+ defaultValue: false,
16
+ advanced: true,
17
+ description: "Only render this section when in view"
18
+ }
19
+ ],
20
+ defaultStyles: {
21
+ paddingLeft: "20px",
22
+ paddingRight: "20px",
23
+ paddingTop: "50px",
24
+ paddingBottom: "50px",
25
+ marginTop: "0px",
26
+ width: "100vw",
27
+ marginLeft: "calc(50% - 50vw)"
28
+ },
29
+ canHaveChildren: true,
30
+ defaultChildren: [
31
+ {
32
+ "@type": "@builder.io/sdk:Element",
33
+ responsiveStyles: {
34
+ large: {
35
+ textAlign: "center"
36
+ }
37
+ },
38
+ component: {
39
+ name: "Text",
40
+ options: {
41
+ text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
42
+ }
43
+ }
44
+ }
45
+ ]
46
+ };
47
+ export {
48
+ componentInfo
49
+ };
@@ -0,0 +1,7 @@
1
+ import { registerComponent } from "../../functions/register-component.js";
2
+ import { componentInfo } from "./component-info.js";
3
+ import component from "./section";
4
+ var stdin_default = registerComponent(component, componentInfo);
5
+ export {
6
+ stdin_default as default
7
+ };
@@ -0,0 +1,9 @@
1
+ function SectionComponent(props) {
2
+ return <section {...props.attributes} style={props.maxWidth && typeof props.maxWidth === "number" ? {
3
+ "max-width": props.maxWidth
4
+ } : undefined}>
5
+ {props.children}
6
+ </section>;
7
+ }
8
+
9
+ export default SectionComponent;
@@ -1,4 +1,4 @@
1
- export default function SectionComponent(props) {
1
+ function SectionComponent(props) {
2
2
  return (
3
3
  <section
4
4
  {...props.attributes}
@@ -14,3 +14,5 @@ export default function SectionComponent(props) {
14
14
  </section>
15
15
  );
16
16
  }
17
+
18
+ export default SectionComponent;
@@ -0,0 +1,59 @@
1
+ const componentInfo = {
2
+ name: "Form:Select",
3
+ builtIn: true,
4
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
5
+ defaultStyles: {
6
+ alignSelf: "flex-start"
7
+ },
8
+ inputs: [
9
+ {
10
+ name: "options",
11
+ type: "list",
12
+ required: true,
13
+ subFields: [
14
+ {
15
+ name: "value",
16
+ type: "text",
17
+ required: true
18
+ },
19
+ {
20
+ name: "name",
21
+ type: "text"
22
+ }
23
+ ],
24
+ defaultValue: [
25
+ {
26
+ value: "option 1"
27
+ },
28
+ {
29
+ value: "option 2"
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ name: "name",
35
+ type: "string",
36
+ required: true,
37
+ helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
38
+ },
39
+ {
40
+ name: "defaultValue",
41
+ type: "string"
42
+ },
43
+ {
44
+ name: "value",
45
+ type: "string",
46
+ advanced: true
47
+ },
48
+ {
49
+ name: "required",
50
+ type: "boolean",
51
+ defaultValue: false
52
+ }
53
+ ],
54
+ static: true,
55
+ noWrap: true
56
+ };
57
+ export {
58
+ componentInfo
59
+ };
@@ -0,0 +1,7 @@
1
+ import { registerComponent } from "../../functions/register-component.js";
2
+ import { componentInfo } from "./component-info.js";
3
+ import component from "./select";
4
+ var stdin_default = registerComponent(component, componentInfo);
5
+ export {
6
+ stdin_default as default
7
+ };
@@ -0,0 +1,16 @@
1
+ import { For } from "solid-js";
2
+ import { isEditing } from "../../functions/is-editing.js";
3
+
4
+ function SelectComponent(props) {
5
+ return <select {...props.attributes} value={props.value} key={isEditing() && props.defaultValue ? props.defaultValue : "default-key"} defaultValue={props.defaultValue} name={props.name}>
6
+ <For each={props.options}>
7
+ {(option, _index) => {
8
+ const index = _index();
9
+
10
+ return <option value={option.value}>{option.name || option.value}</option>;
11
+ }}
12
+ </For>
13
+ </select>;
14
+ }
15
+
16
+ export default SelectComponent;
@@ -1,8 +1,8 @@
1
1
  import { For } from "solid-js";
2
2
 
3
- import { isEditing } from "../functions/is-editing";
3
+ import { isEditing } from "../../functions/is-editing.js";
4
4
 
5
- export default function SelectComponent(props) {
5
+ function SelectComponent(props) {
6
6
  return (
7
7
  <select
8
8
  {...props.attributes}
@@ -14,10 +14,15 @@ export default function SelectComponent(props) {
14
14
  name={props.name}
15
15
  >
16
16
  <For each={props.options}>
17
- {(option, index) => (
18
- <option value={option.value}>{option.name || option.value}</option>
19
- )}
17
+ {(option, _index) => {
18
+ const index = _index();
19
+ return (
20
+ <option value={option.value}>{option.name || option.value}</option>
21
+ );
22
+ }}
20
23
  </For>
21
24
  </select>
22
25
  );
23
26
  }
27
+
28
+ export default SelectComponent;