@builder.io/sdk-react 0.2.3-4 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk/blocks/columns/columns.js +4 -4
- package/dist/sdk/blocks/image/image.js +8 -7
- package/dist/sdk/blocks/symbol/symbol.js +2 -1
- package/dist/sdk/blocks/video/video.js +4 -1
- package/dist/sdk/components/render-block/render-block.js +4 -1
- package/dist/sdk/components/render-content/render-content.js +19 -5
- package/dist/sdk/index.d.ts +1 -0
- package/package.json +4 -1
- package/CHANGELOG.md +0 -25
- package/packages/react/src/blocks/BaseText.tsx +0 -19
- package/packages/react/src/blocks/button/button.tsx +0 -45
- package/packages/react/src/blocks/button/component-info.ts +0 -42
- package/packages/react/src/blocks/columns/columns.tsx +0 -211
- package/packages/react/src/blocks/columns/component-info.ts +0 -254
- package/packages/react/src/blocks/custom-code/component-info.ts +0 -31
- package/packages/react/src/blocks/custom-code/custom-code.tsx +0 -76
- package/packages/react/src/blocks/embed/component-info.ts +0 -55
- package/packages/react/src/blocks/embed/embed.tsx +0 -59
- package/packages/react/src/blocks/embed/helpers.ts +0 -8
- package/packages/react/src/blocks/form/component-info.ts +0 -282
- package/packages/react/src/blocks/form/form.tsx +0 -320
- package/packages/react/src/blocks/fragment/component-info.ts +0 -10
- package/packages/react/src/blocks/fragment/fragment.tsx +0 -14
- package/packages/react/src/blocks/image/component-info.ts +0 -172
- package/packages/react/src/blocks/image/image.helpers.ts +0 -75
- package/packages/react/src/blocks/image/image.tsx +0 -144
- package/packages/react/src/blocks/img/component-info.ts +0 -21
- package/packages/react/src/blocks/img/img.tsx +0 -40
- package/packages/react/src/blocks/input/component-info.ts +0 -78
- package/packages/react/src/blocks/input/input.tsx +0 -33
- package/packages/react/src/blocks/raw-text/component-info.ts +0 -15
- package/packages/react/src/blocks/raw-text/raw-text.tsx +0 -18
- package/packages/react/src/blocks/section/component-info.ts +0 -50
- package/packages/react/src/blocks/section/section.tsx +0 -33
- package/packages/react/src/blocks/select/component-info.ts +0 -61
- package/packages/react/src/blocks/select/select.tsx +0 -35
- package/packages/react/src/blocks/submit-button/component-info.ts +0 -32
- package/packages/react/src/blocks/submit-button/submit-button.tsx +0 -17
- package/packages/react/src/blocks/symbol/component-info.ts +0 -43
- package/packages/react/src/blocks/symbol/symbol.tsx +0 -111
- package/packages/react/src/blocks/text/component-info.ts +0 -24
- package/packages/react/src/blocks/text/text.tsx +0 -20
- package/packages/react/src/blocks/textarea/component-info.ts +0 -48
- package/packages/react/src/blocks/textarea/textarea.tsx +0 -24
- package/packages/react/src/blocks/util.ts +0 -18
- package/packages/react/src/blocks/video/component-info.ts +0 -109
- package/packages/react/src/blocks/video/video.tsx +0 -84
- package/packages/react/src/components/render-block/block-styles.tsx +0 -98
- package/packages/react/src/components/render-block/render-block.helpers.ts +0 -138
- package/packages/react/src/components/render-block/render-block.tsx +0 -216
- package/packages/react/src/components/render-block/render-component.tsx +0 -52
- package/packages/react/src/components/render-block/render-repeated-block.tsx +0 -43
- package/packages/react/src/components/render-block/types.ts +0 -7
- package/packages/react/src/components/render-blocks.tsx +0 -97
- package/packages/react/src/components/render-content/builder-editing.tsx +0 -8
- package/packages/react/src/components/render-content/components/render-styles.helpers.ts +0 -79
- package/packages/react/src/components/render-content/components/render-styles.tsx +0 -45
- package/packages/react/src/components/render-content/index.ts +0 -1
- package/packages/react/src/components/render-content/render-content.helpers.ts +0 -48
- package/packages/react/src/components/render-content/render-content.tsx +0 -410
- package/packages/react/src/components/render-content/render-content.types.ts +0 -33
- package/packages/react/src/components/render-inlined-styles.tsx +0 -36
- package/packages/react/src/constants/builder-registered-components.ts +0 -42
- package/packages/react/src/constants/device-sizes.ts +0 -65
- package/packages/react/src/constants/target.ts +0 -2
- package/packages/react/src/context/builder.context.ts +0 -12
- package/packages/react/src/context/types.ts +0 -26
- package/packages/react/src/functions/camel-to-kebab-case.ts +0 -2
- package/packages/react/src/functions/evaluate.ts +0 -57
- package/packages/react/src/functions/event-handler-name.ts +0 -6
- package/packages/react/src/functions/extract-text-styles.ts +0 -39
- package/packages/react/src/functions/fast-clone.ts +0 -5
- package/packages/react/src/functions/get-block-actions-handler.ts +0 -20
- package/packages/react/src/functions/get-block-actions.ts +0 -25
- package/packages/react/src/functions/get-block-component-options.ts +0 -12
- package/packages/react/src/functions/get-block-properties.ts +0 -75
- package/packages/react/src/functions/get-builder-search-params/fn.test.ts +0 -19
- package/packages/react/src/functions/get-builder-search-params/index.ts +0 -50
- package/packages/react/src/functions/get-content/ab-testing.ts +0 -132
- package/packages/react/src/functions/get-content/generate-content-url.test.ts +0 -95
- package/packages/react/src/functions/get-content/generate-content-url.ts +0 -59
- package/packages/react/src/functions/get-content/index.ts +0 -62
- package/packages/react/src/functions/get-content/types.ts +0 -53
- package/packages/react/src/functions/get-fetch.ts +0 -18
- package/packages/react/src/functions/get-global-this.ts +0 -17
- package/packages/react/src/functions/get-processed-block.test.ts +0 -33
- package/packages/react/src/functions/get-processed-block.ts +0 -54
- package/packages/react/src/functions/get-react-native-block-styles.ts +0 -33
- package/packages/react/src/functions/if-target.ts +0 -20
- package/packages/react/src/functions/is-browser.ts +0 -3
- package/packages/react/src/functions/is-editing.ts +0 -10
- package/packages/react/src/functions/is-iframe.ts +0 -5
- package/packages/react/src/functions/is-previewing.ts +0 -14
- package/packages/react/src/functions/on-change.test.ts +0 -23
- package/packages/react/src/functions/on-change.ts +0 -29
- package/packages/react/src/functions/register-component.ts +0 -50
- package/packages/react/src/functions/register.ts +0 -46
- package/packages/react/src/functions/sanitize-react-native-block-styles.ts +0 -65
- package/packages/react/src/functions/set-editor-settings.ts +0 -16
- package/packages/react/src/functions/set.test.ts +0 -19
- package/packages/react/src/functions/set.ts +0 -26
- package/packages/react/src/functions/track/helpers.ts +0 -67
- package/packages/react/src/functions/track/index.ts +0 -136
- package/packages/react/src/functions/track/interaction.ts +0 -80
- package/packages/react/src/functions/transform-block-properties.ts +0 -3
- package/packages/react/src/functions/transform-block.ts +0 -6
- package/packages/react/src/helpers/ab-tests.ts +0 -22
- package/packages/react/src/helpers/cookie.ts +0 -107
- package/packages/react/src/helpers/css.ts +0 -42
- package/packages/react/src/helpers/flatten.ts +0 -24
- package/packages/react/src/helpers/localStorage.ts +0 -40
- package/packages/react/src/helpers/logger.ts +0 -6
- package/packages/react/src/helpers/nullable.ts +0 -4
- package/packages/react/src/helpers/sessionId.ts +0 -38
- package/packages/react/src/helpers/time.ts +0 -4
- package/packages/react/src/helpers/url.test.ts +0 -23
- package/packages/react/src/helpers/url.ts +0 -16
- package/packages/react/src/helpers/uuid.ts +0 -17
- package/packages/react/src/helpers/visitorId.ts +0 -40
- package/packages/react/src/index-helpers/blocks-exports.ts +0 -10
- package/packages/react/src/index-helpers/top-of-file.ts +0 -4
- package/packages/react/src/index.ts +0 -14
- package/packages/react/src/scripts/init-editing.ts +0 -123
- package/packages/react/src/types/api-version.ts +0 -2
- package/packages/react/src/types/builder-block.ts +0 -69
- package/packages/react/src/types/builder-content.ts +0 -46
- package/packages/react/src/types/can-track.ts +0 -3
- package/packages/react/src/types/components.ts +0 -117
- package/packages/react/src/types/deep-partial.ts +0 -7
- package/packages/react/src/types/element.ts +0 -60
- package/packages/react/src/types/input.ts +0 -125
- package/packages/react/src/types/targets.ts +0 -6
- package/packages/react/src/types/typescript.ts +0 -7
- package/packages/rsc/src/blocks/BaseText.jsx +0 -12
- package/packages/rsc/src/blocks/button/button.jsx +0 -37
- package/packages/rsc/src/blocks/button/component-info.js +0 -40
- package/packages/rsc/src/blocks/columns/columns.jsx +0 -172
- package/packages/rsc/src/blocks/columns/component-info.js +0 -241
- package/packages/rsc/src/blocks/custom-code/component-info.js +0 -30
- package/packages/rsc/src/blocks/custom-code/custom-code.jsx +0 -57
- package/packages/rsc/src/blocks/embed/component-info.js +0 -43
- package/packages/rsc/src/blocks/embed/embed.jsx +0 -45
- package/packages/rsc/src/blocks/embed/helpers.js +0 -9
- package/packages/rsc/src/blocks/form/component-info.js +0 -261
- package/packages/rsc/src/blocks/form/form.jsx +0 -260
- package/packages/rsc/src/blocks/fragment/component-info.js +0 -10
- package/packages/rsc/src/blocks/fragment/fragment.jsx +0 -9
- package/packages/rsc/src/blocks/image/component-info.js +0 -150
- package/packages/rsc/src/blocks/image/image.helpers.js +0 -48
- package/packages/rsc/src/blocks/image/image.jsx +0 -122
- package/packages/rsc/src/blocks/img/component-info.js +0 -19
- package/packages/rsc/src/blocks/img/img.jsx +0 -21
- package/packages/rsc/src/blocks/input/component-info.js +0 -73
- package/packages/rsc/src/blocks/input/input.jsx +0 -23
- package/packages/rsc/src/blocks/raw-text/component-info.js +0 -15
- package/packages/rsc/src/blocks/raw-text/raw-text.jsx +0 -14
- package/packages/rsc/src/blocks/section/component-info.js +0 -48
- package/packages/rsc/src/blocks/section/section.jsx +0 -27
- package/packages/rsc/src/blocks/select/component-info.js +0 -58
- package/packages/rsc/src/blocks/select/select.jsx +0 -24
- package/packages/rsc/src/blocks/submit-button/component-info.js +0 -27
- package/packages/rsc/src/blocks/submit-button/submit-button.jsx +0 -13
- package/packages/rsc/src/blocks/symbol/component-info.js +0 -42
- package/packages/rsc/src/blocks/symbol/symbol.jsx +0 -89
- package/packages/rsc/src/blocks/text/component-info.js +0 -23
- package/packages/rsc/src/blocks/text/text.jsx +0 -17
- package/packages/rsc/src/blocks/textarea/component-info.js +0 -46
- package/packages/rsc/src/blocks/textarea/textarea.jsx +0 -17
- package/packages/rsc/src/blocks/util.js +0 -8
- package/packages/rsc/src/blocks/video/component-info.js +0 -105
- package/packages/rsc/src/blocks/video/video.jsx +0 -63
- package/packages/rsc/src/components/render-block/block-styles.jsx +0 -88
- package/packages/rsc/src/components/render-block/render-block.helpers.js +0 -129
- package/packages/rsc/src/components/render-block/render-block.jsx +0 -201
- package/packages/rsc/src/components/render-block/render-component.jsx +0 -39
- package/packages/rsc/src/components/render-block/render-repeated-block.jsx +0 -27
- package/packages/rsc/src/components/render-block/types.js +0 -0
- package/packages/rsc/src/components/render-blocks.jsx +0 -92
- package/packages/rsc/src/components/render-content/builder-editing.jsx +0 -64
- package/packages/rsc/src/components/render-content/components/render-styles.helpers.js +0 -57
- package/packages/rsc/src/components/render-content/components/render-styles.jsx +0 -39
- package/packages/rsc/src/components/render-content/index.js +0 -4
- package/packages/rsc/src/components/render-content/render-content.helpers.js +0 -48
- package/packages/rsc/src/components/render-content/render-content.jsx +0 -253
- package/packages/rsc/src/components/render-content/render-content.types.js +0 -0
- package/packages/rsc/src/components/render-inlined-styles.jsx +0 -33
- package/packages/rsc/src/constants/builder-registered-components.js +0 -54
- package/packages/rsc/src/constants/device-sizes.js +0 -48
- package/packages/rsc/src/constants/target.js +0 -4
- package/packages/rsc/src/context/builder.context.js +0 -14
- package/packages/rsc/src/context/types.js +0 -0
- package/packages/rsc/src/functions/camel-to-kebab-case.js +0 -4
- package/packages/rsc/src/functions/evaluate.js +0 -6
- package/packages/rsc/src/functions/event-handler-name.js +0 -7
- package/packages/rsc/src/functions/extract-text-styles.js +0 -22
- package/packages/rsc/src/functions/fast-clone.js +0 -4
- package/packages/rsc/src/functions/get-block-actions-handler.js +0 -11
- package/packages/rsc/src/functions/get-block-actions.js +0 -18
- package/packages/rsc/src/functions/get-block-component-options.js +0 -28
- package/packages/rsc/src/functions/get-block-properties.js +0 -53
- package/packages/rsc/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/packages/rsc/src/functions/get-builder-search-params/index.js +0 -38
- package/packages/rsc/src/functions/get-content/ab-testing.js +0 -99
- package/packages/rsc/src/functions/get-content/generate-content-url.js +0 -60
- package/packages/rsc/src/functions/get-content/generate-content-url.test.js +0 -82
- package/packages/rsc/src/functions/get-content/index.js +0 -83
- package/packages/rsc/src/functions/get-content/types.js +0 -0
- package/packages/rsc/src/functions/get-fetch.js +0 -14
- package/packages/rsc/src/functions/get-global-this.js +0 -18
- package/packages/rsc/src/functions/get-processed-block.js +0 -59
- package/packages/rsc/src/functions/get-processed-block.test.js +0 -32
- package/packages/rsc/src/functions/get-react-native-block-styles.js +0 -33
- package/packages/rsc/src/functions/if-target.js +0 -15
- package/packages/rsc/src/functions/is-browser.js +0 -6
- package/packages/rsc/src/functions/is-editing.js +0 -8
- package/packages/rsc/src/functions/is-iframe.js +0 -7
- package/packages/rsc/src/functions/is-previewing.js +0 -14
- package/packages/rsc/src/functions/on-change.js +0 -27
- package/packages/rsc/src/functions/on-change.test.js +0 -19
- package/packages/rsc/src/functions/register-component.js +0 -68
- package/packages/rsc/src/functions/register.js +0 -29
- package/packages/rsc/src/functions/sanitize-react-native-block-styles.js +0 -66
- package/packages/rsc/src/functions/set-editor-settings.js +0 -15
- package/packages/rsc/src/functions/set.js +0 -11
- package/packages/rsc/src/functions/set.test.js +0 -16
- package/packages/rsc/src/functions/track/helpers.js +0 -50
- package/packages/rsc/src/functions/track/index.js +0 -129
- package/packages/rsc/src/functions/track/interaction.js +0 -53
- package/packages/rsc/src/functions/transform-block-properties.js +0 -6
- package/packages/rsc/src/functions/transform-block.js +0 -6
- package/packages/rsc/src/helpers/ab-tests.js +0 -16
- package/packages/rsc/src/helpers/cookie.js +0 -81
- package/packages/rsc/src/helpers/css.js +0 -34
- package/packages/rsc/src/helpers/flatten.js +0 -34
- package/packages/rsc/src/helpers/localStorage.js +0 -35
- package/packages/rsc/src/helpers/logger.js +0 -9
- package/packages/rsc/src/helpers/nullable.js +0 -4
- package/packages/rsc/src/helpers/sessionId.js +0 -52
- package/packages/rsc/src/helpers/time.js +0 -5
- package/packages/rsc/src/helpers/url.js +0 -13
- package/packages/rsc/src/helpers/url.test.js +0 -21
- package/packages/rsc/src/helpers/uuid.js +0 -13
- package/packages/rsc/src/helpers/visitorId.js +0 -34
- package/packages/rsc/src/index-helpers/blocks-exports.js +0 -22
- package/packages/rsc/src/index-helpers/top-of-file.js +0 -2
- package/packages/rsc/src/index.js +0 -13
- package/packages/rsc/src/scripts/init-editing.js +0 -93
- package/packages/rsc/src/types/api-version.js +0 -4
- package/packages/rsc/src/types/builder-block.js +0 -0
- package/packages/rsc/src/types/builder-content.js +0 -0
- package/packages/rsc/src/types/can-track.js +0 -0
- package/packages/rsc/src/types/components.js +0 -0
- package/packages/rsc/src/types/deep-partial.js +0 -0
- package/packages/rsc/src/types/element.js +0 -0
- package/packages/rsc/src/types/input.js +0 -0
- package/packages/rsc/src/types/targets.js +0 -0
- package/packages/rsc/src/types/typescript.js +0 -0
- package/tsconfig.json +0 -28
- package/tsconfig.sdk.json +0 -10
- package/tsconfig.server.json +0 -10
- package/vite.config.ts +0 -91
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
|
|
3
|
-
export const componentInfo: ComponentInfo = {
|
|
4
|
-
name: 'Form:Select',
|
|
5
|
-
|
|
6
|
-
image:
|
|
7
|
-
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',
|
|
8
|
-
defaultStyles: {
|
|
9
|
-
alignSelf: 'flex-start',
|
|
10
|
-
},
|
|
11
|
-
inputs: [
|
|
12
|
-
{
|
|
13
|
-
name: 'options',
|
|
14
|
-
type: 'list',
|
|
15
|
-
required: true,
|
|
16
|
-
subFields: [
|
|
17
|
-
{
|
|
18
|
-
name: 'value',
|
|
19
|
-
type: 'text',
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'name',
|
|
24
|
-
type: 'text',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
defaultValue: [
|
|
28
|
-
{
|
|
29
|
-
value: 'option 1',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
value: 'option 2',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'name',
|
|
38
|
-
type: 'string',
|
|
39
|
-
required: true,
|
|
40
|
-
helperText:
|
|
41
|
-
'Every select in a form needs a unique name describing what it gets, e.g. "email"',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'defaultValue',
|
|
45
|
-
type: 'string',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'value',
|
|
49
|
-
type: 'string',
|
|
50
|
-
advanced: true,
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
name: 'required',
|
|
55
|
-
type: 'boolean',
|
|
56
|
-
defaultValue: false,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
static: true,
|
|
60
|
-
noWrap: true,
|
|
61
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
export interface FormSelectProps {
|
|
5
|
-
options?: {
|
|
6
|
-
name?: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}[];
|
|
9
|
-
attributes?: any;
|
|
10
|
-
name?: string;
|
|
11
|
-
value?: string;
|
|
12
|
-
defaultValue?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
import { isEditing } from "../../functions/is-editing.js";
|
|
16
|
-
|
|
17
|
-
function SelectComponent(props: FormSelectProps) {
|
|
18
|
-
return (
|
|
19
|
-
<select
|
|
20
|
-
{...props.attributes}
|
|
21
|
-
value={props.value}
|
|
22
|
-
key={
|
|
23
|
-
isEditing() && props.defaultValue ? props.defaultValue : "default-key"
|
|
24
|
-
}
|
|
25
|
-
defaultValue={props.defaultValue}
|
|
26
|
-
name={props.name}
|
|
27
|
-
>
|
|
28
|
-
{props.options?.map((option) => (
|
|
29
|
-
<option value={option.value}>{option.name || option.value}</option>
|
|
30
|
-
))}
|
|
31
|
-
</select>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default SelectComponent;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
|
|
3
|
-
export const componentInfo: ComponentInfo = {
|
|
4
|
-
name: 'Form:SubmitButton',
|
|
5
|
-
|
|
6
|
-
image:
|
|
7
|
-
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98',
|
|
8
|
-
defaultStyles: {
|
|
9
|
-
appearance: 'none',
|
|
10
|
-
paddingTop: '15px',
|
|
11
|
-
paddingBottom: '15px',
|
|
12
|
-
paddingLeft: '25px',
|
|
13
|
-
paddingRight: '25px',
|
|
14
|
-
backgroundColor: '#3898EC',
|
|
15
|
-
color: 'white',
|
|
16
|
-
borderRadius: '4px',
|
|
17
|
-
cursor: 'pointer',
|
|
18
|
-
},
|
|
19
|
-
inputs: [
|
|
20
|
-
{
|
|
21
|
-
name: 'text',
|
|
22
|
-
type: 'text',
|
|
23
|
-
defaultValue: 'Click me',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
static: true,
|
|
27
|
-
noWrap: true,
|
|
28
|
-
// TODO: optional children? maybe as optional form input
|
|
29
|
-
// that only shows if advanced setting is flipped
|
|
30
|
-
// TODO: defaultChildren
|
|
31
|
-
// canHaveChildren: true,
|
|
32
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
export interface ButtonProps {
|
|
5
|
-
attributes?: any;
|
|
6
|
-
text?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function SubmitButton(props: ButtonProps) {
|
|
10
|
-
return (
|
|
11
|
-
<button type="submit" {...props.attributes}>
|
|
12
|
-
{props.text}
|
|
13
|
-
</button>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default SubmitButton;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
|
|
3
|
-
export const componentInfo: ComponentInfo = {
|
|
4
|
-
name: 'Symbol',
|
|
5
|
-
noWrap: true,
|
|
6
|
-
static: true,
|
|
7
|
-
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
10
|
-
name: 'symbol',
|
|
11
|
-
type: 'uiSymbol',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: 'dataOnly',
|
|
15
|
-
helperText: "Make this a data symbol that doesn't display any UI",
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
defaultValue: false,
|
|
18
|
-
advanced: true,
|
|
19
|
-
hideFromUI: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'inheritState',
|
|
23
|
-
helperText: 'Inherit the parent component state and data',
|
|
24
|
-
type: 'boolean',
|
|
25
|
-
defaultValue: false,
|
|
26
|
-
advanced: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'renderToLiquid',
|
|
30
|
-
helperText:
|
|
31
|
-
'Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting',
|
|
32
|
-
type: 'boolean',
|
|
33
|
-
defaultValue: false,
|
|
34
|
-
advanced: true,
|
|
35
|
-
hideFromUI: true,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'useChildren',
|
|
39
|
-
hideFromUI: true,
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useState, useContext, useEffect } from "react";
|
|
4
|
-
|
|
5
|
-
export interface SymbolInfo {
|
|
6
|
-
model?: string;
|
|
7
|
-
entry?: string;
|
|
8
|
-
data?: any;
|
|
9
|
-
content?: BuilderContent;
|
|
10
|
-
inline?: boolean;
|
|
11
|
-
dynamic?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface SymbolProps {
|
|
14
|
-
symbol?: SymbolInfo;
|
|
15
|
-
dataOnly?: boolean;
|
|
16
|
-
dynamic?: boolean;
|
|
17
|
-
builderBlock?: BuilderBlock;
|
|
18
|
-
attributes?: any;
|
|
19
|
-
inheritState?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
import RenderContent from "../../components/render-content/render-content";
|
|
23
|
-
import BuilderContext from "../../context/builder.context.js";
|
|
24
|
-
import { getContent } from "../../functions/get-content/index.js";
|
|
25
|
-
import type { BuilderContent } from "../../types/builder-content.js";
|
|
26
|
-
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
27
|
-
import { TARGET } from "../../constants/target";
|
|
28
|
-
import { logger } from "../../helpers/logger";
|
|
29
|
-
|
|
30
|
-
function Symbol(props: SymbolProps) {
|
|
31
|
-
const [className, setClassName] = useState(() =>
|
|
32
|
-
[
|
|
33
|
-
...(TARGET === "vue2" || TARGET === "vue3"
|
|
34
|
-
? Object.keys(props.attributes.class)
|
|
35
|
-
: [props.attributes.class]),
|
|
36
|
-
"builder-symbol",
|
|
37
|
-
props.symbol?.inline ? "builder-inline-symbol" : undefined,
|
|
38
|
-
props.symbol?.dynamic || props.dynamic
|
|
39
|
-
? "builder-dynamic-symbol"
|
|
40
|
-
: undefined,
|
|
41
|
-
]
|
|
42
|
-
.filter(Boolean)
|
|
43
|
-
.join(" ")
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const [contentToUse, setContentToUse] = useState(() => props.symbol?.content);
|
|
47
|
-
|
|
48
|
-
function fetchContent() {
|
|
49
|
-
/**
|
|
50
|
-
* If:
|
|
51
|
-
* - we have a symbol prop
|
|
52
|
-
* - yet it does not have any content
|
|
53
|
-
* - and we have not already stored content from before
|
|
54
|
-
* - and it has a model name
|
|
55
|
-
*
|
|
56
|
-
* then we want to re-fetch the symbol content.
|
|
57
|
-
*/
|
|
58
|
-
if (
|
|
59
|
-
!contentToUse &&
|
|
60
|
-
props.symbol?.model && // This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
61
|
-
builderContext?.apiKey
|
|
62
|
-
) {
|
|
63
|
-
getContent({
|
|
64
|
-
model: props.symbol.model,
|
|
65
|
-
apiKey: builderContext.apiKey,
|
|
66
|
-
apiVersion: builderContext.apiVersion,
|
|
67
|
-
query: {
|
|
68
|
-
id: props.symbol.entry,
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
.then((response) => {
|
|
72
|
-
if (response) {
|
|
73
|
-
setContentToUse(response);
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
.catch((err) => {
|
|
77
|
-
logger.error("Could not fetch symbol content: ", err);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const builderContext = useContext(BuilderContext);
|
|
83
|
-
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
fetchContent();
|
|
86
|
-
}, []);
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
fetchContent();
|
|
90
|
-
}, [props.symbol]);
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<div {...props.attributes} className={className}>
|
|
94
|
-
<RenderContent
|
|
95
|
-
apiVersion={builderContext.apiVersion}
|
|
96
|
-
apiKey={builderContext.apiKey!}
|
|
97
|
-
context={builderContext.context}
|
|
98
|
-
customComponents={Object.values(builderContext.registeredComponents)}
|
|
99
|
-
data={{
|
|
100
|
-
...props.symbol?.data,
|
|
101
|
-
...builderContext.state,
|
|
102
|
-
...contentToUse?.data?.state,
|
|
103
|
-
}}
|
|
104
|
-
model={props.symbol?.model}
|
|
105
|
-
content={contentToUse}
|
|
106
|
-
/>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export default Symbol;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
|
|
3
|
-
export const componentInfo: ComponentInfo = {
|
|
4
|
-
name: 'Text',
|
|
5
|
-
static: true,
|
|
6
|
-
|
|
7
|
-
image:
|
|
8
|
-
'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',
|
|
9
|
-
inputs: [
|
|
10
|
-
{
|
|
11
|
-
name: 'text',
|
|
12
|
-
type: 'html',
|
|
13
|
-
required: true,
|
|
14
|
-
autoFocus: true,
|
|
15
|
-
bubble: true,
|
|
16
|
-
defaultValue: 'Enter some text...',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
defaultStyles: {
|
|
20
|
-
lineHeight: 'normal',
|
|
21
|
-
height: 'auto',
|
|
22
|
-
textAlign: 'center',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
export interface TextProps {
|
|
5
|
-
text: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function Text(props: TextProps) {
|
|
9
|
-
return (
|
|
10
|
-
<span
|
|
11
|
-
className="builder-text"
|
|
12
|
-
dangerouslySetInnerHTML={{ __html: props.text }}
|
|
13
|
-
style={{
|
|
14
|
-
outline: "none",
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default Text;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
|
|
3
|
-
export const componentInfo: ComponentInfo = {
|
|
4
|
-
name: 'Form:TextArea',
|
|
5
|
-
|
|
6
|
-
image:
|
|
7
|
-
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3',
|
|
8
|
-
inputs: [
|
|
9
|
-
{
|
|
10
|
-
advanced: true,
|
|
11
|
-
name: 'value',
|
|
12
|
-
type: 'string',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'name',
|
|
16
|
-
type: 'string',
|
|
17
|
-
required: true,
|
|
18
|
-
helperText:
|
|
19
|
-
'Every input in a form needs a unique name describing what it gets, e.g. "email"',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'defaultValue',
|
|
23
|
-
type: 'string',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: 'placeholder',
|
|
27
|
-
type: 'string',
|
|
28
|
-
defaultValue: 'Hello there',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: 'required',
|
|
32
|
-
type: 'boolean',
|
|
33
|
-
defaultValue: false,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
defaultStyles: {
|
|
37
|
-
paddingTop: '10px',
|
|
38
|
-
paddingBottom: '10px',
|
|
39
|
-
paddingLeft: '10px',
|
|
40
|
-
paddingRight: '10px',
|
|
41
|
-
borderRadius: '3px',
|
|
42
|
-
borderWidth: '1px',
|
|
43
|
-
borderStyle: 'solid',
|
|
44
|
-
borderColor: '#ccc',
|
|
45
|
-
},
|
|
46
|
-
static: true,
|
|
47
|
-
noWrap: true,
|
|
48
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
export interface TextareaProps {
|
|
5
|
-
attributes?: any;
|
|
6
|
-
name?: string;
|
|
7
|
-
value?: string;
|
|
8
|
-
defaultValue?: string;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function Textarea(props: TextareaProps) {
|
|
13
|
-
return (
|
|
14
|
-
<textarea
|
|
15
|
-
{...props.attributes}
|
|
16
|
-
placeholder={props.placeholder}
|
|
17
|
-
name={props.name}
|
|
18
|
-
value={props.value}
|
|
19
|
-
defaultValue={props.defaultValue}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default Textarea;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Input attributes that are functions must be converted to strings before being serialized to JSON.
|
|
3
|
-
*/
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
|
-
export const serializeFn = (fnValue: Function) => {
|
|
6
|
-
const fnStr = fnValue.toString().trim();
|
|
7
|
-
|
|
8
|
-
// we need to account for a few different fn syntaxes:
|
|
9
|
-
// 1. `function name(args) => {code}`
|
|
10
|
-
// 2. `name(args) => {code}`
|
|
11
|
-
// 3. `(args) => {}`
|
|
12
|
-
const appendFunction =
|
|
13
|
-
!fnStr.startsWith('function') && !fnStr.startsWith('(');
|
|
14
|
-
|
|
15
|
-
return `return (${
|
|
16
|
-
appendFunction ? 'function ' : ''
|
|
17
|
-
}${fnStr}).apply(this, arguments)`;
|
|
18
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type { ComponentInfo } from '../../types/components';
|
|
2
|
-
|
|
3
|
-
export const componentInfo: ComponentInfo = {
|
|
4
|
-
name: 'Video',
|
|
5
|
-
canHaveChildren: true,
|
|
6
|
-
|
|
7
|
-
defaultStyles: {
|
|
8
|
-
minHeight: '20px',
|
|
9
|
-
minWidth: '20px',
|
|
10
|
-
},
|
|
11
|
-
image:
|
|
12
|
-
'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',
|
|
13
|
-
inputs: [
|
|
14
|
-
{
|
|
15
|
-
name: 'video',
|
|
16
|
-
type: 'file',
|
|
17
|
-
allowedFileTypes: ['mp4'],
|
|
18
|
-
bubble: true,
|
|
19
|
-
defaultValue:
|
|
20
|
-
'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',
|
|
21
|
-
required: true,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'posterImage',
|
|
25
|
-
type: 'file',
|
|
26
|
-
allowedFileTypes: ['jpeg', 'png'],
|
|
27
|
-
helperText: 'Image to show before the video plays',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'autoPlay',
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
defaultValue: true,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'controls',
|
|
36
|
-
type: 'boolean',
|
|
37
|
-
defaultValue: false,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'muted',
|
|
41
|
-
type: 'boolean',
|
|
42
|
-
defaultValue: true,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'loop',
|
|
46
|
-
type: 'boolean',
|
|
47
|
-
defaultValue: true,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'playsInline',
|
|
51
|
-
type: 'boolean',
|
|
52
|
-
defaultValue: true,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'fit',
|
|
56
|
-
type: 'text',
|
|
57
|
-
defaultValue: 'cover',
|
|
58
|
-
enum: ['contain', 'cover', 'fill', 'auto'],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'fitContent',
|
|
62
|
-
type: 'boolean',
|
|
63
|
-
helperText:
|
|
64
|
-
'When child blocks are provided, fit to them instead of using the aspect ratio',
|
|
65
|
-
defaultValue: true,
|
|
66
|
-
advanced: true,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: 'position',
|
|
70
|
-
type: 'text',
|
|
71
|
-
defaultValue: 'center',
|
|
72
|
-
enum: [
|
|
73
|
-
'center',
|
|
74
|
-
'top',
|
|
75
|
-
'left',
|
|
76
|
-
'right',
|
|
77
|
-
'bottom',
|
|
78
|
-
'top left',
|
|
79
|
-
'top right',
|
|
80
|
-
'bottom left',
|
|
81
|
-
'bottom right',
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'height',
|
|
86
|
-
type: 'number',
|
|
87
|
-
advanced: true,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'width',
|
|
91
|
-
type: 'number',
|
|
92
|
-
advanced: true,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'aspectRatio',
|
|
96
|
-
type: 'number',
|
|
97
|
-
advanced: true,
|
|
98
|
-
defaultValue: 0.7004048582995948,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'lazyLoad',
|
|
102
|
-
type: 'boolean',
|
|
103
|
-
helperText:
|
|
104
|
-
'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
105
|
-
defaultValue: true,
|
|
106
|
-
advanced: true,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
export interface VideoProps {
|
|
5
|
-
attributes?: any;
|
|
6
|
-
video?: string;
|
|
7
|
-
autoPlay?: boolean;
|
|
8
|
-
controls?: boolean;
|
|
9
|
-
muted?: boolean;
|
|
10
|
-
loop?: boolean;
|
|
11
|
-
playsInline?: boolean;
|
|
12
|
-
aspectRatio?: number;
|
|
13
|
-
width?: number;
|
|
14
|
-
height?: number;
|
|
15
|
-
fit?: "contain" | "cover" | "fill";
|
|
16
|
-
position?:
|
|
17
|
-
| "center"
|
|
18
|
-
| "top"
|
|
19
|
-
| "left"
|
|
20
|
-
| "right"
|
|
21
|
-
| "bottom"
|
|
22
|
-
| "top left"
|
|
23
|
-
| "top right"
|
|
24
|
-
| "bottom left"
|
|
25
|
-
| "bottom right";
|
|
26
|
-
posterImage?: string;
|
|
27
|
-
lazyLoad?: boolean;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function Video(props: VideoProps) {
|
|
31
|
-
function videoProps() {
|
|
32
|
-
return {
|
|
33
|
-
...(props.autoPlay === true
|
|
34
|
-
? {
|
|
35
|
-
autoPlay: true,
|
|
36
|
-
}
|
|
37
|
-
: {}),
|
|
38
|
-
...(props.muted === true
|
|
39
|
-
? {
|
|
40
|
-
muted: true,
|
|
41
|
-
}
|
|
42
|
-
: {}),
|
|
43
|
-
...(props.controls === true
|
|
44
|
-
? {
|
|
45
|
-
controls: true,
|
|
46
|
-
}
|
|
47
|
-
: {}),
|
|
48
|
-
...(props.loop === true
|
|
49
|
-
? {
|
|
50
|
-
loop: true,
|
|
51
|
-
}
|
|
52
|
-
: {}),
|
|
53
|
-
...(props.playsInline === true
|
|
54
|
-
? {
|
|
55
|
-
playsInline: true,
|
|
56
|
-
}
|
|
57
|
-
: {}),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function spreadProps() {
|
|
62
|
-
return { ...props.attributes, ...videoProps() };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<video
|
|
67
|
-
{...spreadProps()}
|
|
68
|
-
style={{
|
|
69
|
-
width: "100%",
|
|
70
|
-
height: "100%",
|
|
71
|
-
...props.attributes?.style,
|
|
72
|
-
objectFit: props.fit,
|
|
73
|
-
objectPosition: props.position,
|
|
74
|
-
// Hack to get object fit to work as expected and
|
|
75
|
-
// not have the video overflow
|
|
76
|
-
borderRadius: 1,
|
|
77
|
-
}}
|
|
78
|
-
src={props.video || "no-src"}
|
|
79
|
-
poster={props.posterImage}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default Video;
|