@webstudio-is/sdk-components-react 0.95.0 → 0.96.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.
- package/lib/components.js +754 -33
- package/lib/metas.js +3635 -33
- package/lib/props.js +16274 -33
- package/package.json +8 -8
- package/lib/__generated__/blockquote.props.js +0 -514
- package/lib/__generated__/body.props.js +0 -508
- package/lib/__generated__/bold.props.js +0 -508
- package/lib/__generated__/box.props.js +0 -527
- package/lib/__generated__/button.props.js +0 -564
- package/lib/__generated__/checkbox.props.js +0 -666
- package/lib/__generated__/code-text.props.js +0 -508
- package/lib/__generated__/form.props.js +0 -556
- package/lib/__generated__/fragment.props.js +0 -2
- package/lib/__generated__/heading.props.js +0 -516
- package/lib/__generated__/html-embed.props.js +0 -9
- package/lib/__generated__/image.props.js +0 -581
- package/lib/__generated__/input.props.js +0 -673
- package/lib/__generated__/italic.props.js +0 -508
- package/lib/__generated__/label.props.js +0 -520
- package/lib/__generated__/link.props.js +0 -562
- package/lib/__generated__/list-item.props.js +0 -508
- package/lib/__generated__/list.props.js +0 -534
- package/lib/__generated__/paragraph.props.js +0 -508
- package/lib/__generated__/radio-button.props.js +0 -666
- package/lib/__generated__/rich-text-link.props.js +0 -562
- package/lib/__generated__/separator.props.js +0 -508
- package/lib/__generated__/slot.props.js +0 -2
- package/lib/__generated__/span.props.js +0 -508
- package/lib/__generated__/subscript.props.js +0 -508
- package/lib/__generated__/superscript.props.js +0 -508
- package/lib/__generated__/text.props.js +0 -516
- package/lib/__generated__/textarea.props.js +0 -575
- package/lib/__generated__/vimeo-play-button.props.js +0 -563
- package/lib/__generated__/vimeo-preview-image.props.js +0 -580
- package/lib/__generated__/vimeo-spinner.props.js +0 -508
- package/lib/__generated__/vimeo.props.js +0 -665
- package/lib/blockquote.js +0 -12
- package/lib/blockquote.stories.js +0 -11
- package/lib/blockquote.ws.js +0 -75
- package/lib/body.js +0 -6
- package/lib/body.stories.js +0 -11
- package/lib/body.ws.js +0 -31
- package/lib/bold.js +0 -6
- package/lib/bold.stories.js +0 -11
- package/lib/bold.ws.js +0 -21
- package/lib/box.js +0 -12
- package/lib/box.stories.js +0 -11
- package/lib/box.ws.js +0 -44
- package/lib/button.js +0 -8
- package/lib/button.stories.js +0 -11
- package/lib/button.ws.js +0 -36
- package/lib/checkbox.js +0 -6
- package/lib/checkbox.ws.js +0 -57
- package/lib/code-text.js +0 -10
- package/lib/code-text.stories.js +0 -11
- package/lib/code-text.ws.js +0 -54
- package/lib/form.js +0 -6
- package/lib/form.stories.js +0 -11
- package/lib/form.ws.js +0 -63
- package/lib/fragment.js +0 -7
- package/lib/fragment.ws.js +0 -10
- package/lib/heading.js +0 -12
- package/lib/heading.stories.js +0 -11
- package/lib/heading.ws.js +0 -37
- package/lib/html-embed.js +0 -63
- package/lib/html-embed.stories.js +0 -11
- package/lib/html-embed.ws.js +0 -28
- package/lib/image.js +0 -74
- package/lib/image.stories.js +0 -7
- package/lib/image.ws.js +0 -48
- package/lib/input.js +0 -6
- package/lib/input.stories.js +0 -9
- package/lib/input.ws.js +0 -43
- package/lib/italic.js +0 -6
- package/lib/italic.stories.js +0 -11
- package/lib/italic.ws.js +0 -27
- package/lib/label.js +0 -6
- package/lib/label.ws.js +0 -40
- package/lib/link.js +0 -33
- package/lib/link.stories.js +0 -11
- package/lib/link.ws.js +0 -60
- package/lib/list-item.js +0 -12
- package/lib/list-item.stories.js +0 -11
- package/lib/list-item.ws.js +0 -32
- package/lib/list.js +0 -12
- package/lib/list.stories.js +0 -13
- package/lib/list.ws.js +0 -53
- package/lib/paragraph.js +0 -6
- package/lib/paragraph.stories.js +0 -11
- package/lib/paragraph.ws.js +0 -32
- package/lib/radio-button.js +0 -6
- package/lib/radio-button.ws.js +0 -58
- package/lib/rich-text-link.js +0 -6
- package/lib/rich-text-link.stories.js +0 -11
- package/lib/rich-text-link.ws.js +0 -9
- package/lib/separator.js +0 -12
- package/lib/separator.stories.js +0 -7
- package/lib/separator.ws.js +0 -50
- package/lib/slot.js +0 -14
- package/lib/slot.stories.js +0 -11
- package/lib/slot.ws.js +0 -14
- package/lib/span.js +0 -6
- package/lib/span.stories.js +0 -11
- package/lib/span.ws.js +0 -21
- package/lib/subscript.js +0 -6
- package/lib/subscript.stories.js +0 -11
- package/lib/subscript.ws.js +0 -21
- package/lib/superscript.js +0 -6
- package/lib/superscript.stories.js +0 -11
- package/lib/superscript.ws.js +0 -21
- package/lib/text.js +0 -12
- package/lib/text.stories.js +0 -11
- package/lib/text.ws.js +0 -37
- package/lib/textarea.js +0 -6
- package/lib/textarea.ws.js +0 -44
- package/lib/vimeo-play-button.js +0 -19
- package/lib/vimeo-play-button.stories.js +0 -11
- package/lib/vimeo-play-button.ws.js +0 -25
- package/lib/vimeo-preview-image.js +0 -21
- package/lib/vimeo-preview-image.stories.js +0 -11
- package/lib/vimeo-preview-image.ws.js +0 -19
- package/lib/vimeo-spinner.js +0 -18
- package/lib/vimeo-spinner.stories.js +0 -11
- package/lib/vimeo-spinner.ws.js +0 -23
- package/lib/vimeo.js +0 -279
- package/lib/vimeo.stories.js +0 -11
- package/lib/vimeo.ws.js +0 -327
package/lib/blockquote.ws.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { BlockquoteIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { props } from "./__generated__/blockquote.props";
|
|
7
|
-
const presetStyle = {
|
|
8
|
-
blockquote: [
|
|
9
|
-
{
|
|
10
|
-
property: "marginTop",
|
|
11
|
-
value: { type: "unit", value: 0, unit: "number" }
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
property: "marginRight",
|
|
15
|
-
value: { type: "unit", value: 0, unit: "number" }
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
property: "marginBottom",
|
|
19
|
-
value: { type: "unit", value: 10, unit: "px" }
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
property: "marginLeft",
|
|
23
|
-
value: { type: "unit", value: 0, unit: "number" }
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
property: "paddingTop",
|
|
27
|
-
value: { type: "unit", value: 10, unit: "px" }
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
property: "paddingBottom",
|
|
31
|
-
value: { type: "unit", value: 10, unit: "px" }
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
property: "paddingLeft",
|
|
35
|
-
value: { type: "unit", value: 20, unit: "px" }
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
property: "paddingRight",
|
|
39
|
-
value: { type: "unit", value: 20, unit: "px" }
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
property: "borderLeftWidth",
|
|
43
|
-
value: { type: "unit", value: 5, unit: "px" }
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
property: "borderLeftStyle",
|
|
47
|
-
value: { type: "keyword", value: "solid" }
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
property: "borderLeftColor",
|
|
51
|
-
value: { type: "rgb", r: 226, g: 226, b: 226, alpha: 1 }
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
};
|
|
55
|
-
export const meta = {
|
|
56
|
-
category: "text",
|
|
57
|
-
type: "container",
|
|
58
|
-
label: "Blockquote",
|
|
59
|
-
description: "Use to style a quote from an external source like an article or book.",
|
|
60
|
-
icon: BlockquoteIcon,
|
|
61
|
-
states: defaultStates,
|
|
62
|
-
presetStyle,
|
|
63
|
-
template: [
|
|
64
|
-
{
|
|
65
|
-
type: "instance",
|
|
66
|
-
component: "Blockquote",
|
|
67
|
-
children: [{ type: "text", value: "Blockquote you can edit" }]
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
order: 3
|
|
71
|
-
};
|
|
72
|
-
export const propsMeta = {
|
|
73
|
-
props,
|
|
74
|
-
initialProps: ["id", "cite"]
|
|
75
|
-
};
|
package/lib/body.js
DELETED
package/lib/body.stories.js
DELETED
package/lib/body.ws.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { BodyIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { body } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/body.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
body: [
|
|
10
|
-
...body,
|
|
11
|
-
{
|
|
12
|
-
property: "WebkitFontSmoothing",
|
|
13
|
-
value: { type: "keyword", value: "antialiased" }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
property: "MozOsxFontSmoothing",
|
|
17
|
-
value: { type: "keyword", value: "grayscale" }
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
};
|
|
21
|
-
export const meta = {
|
|
22
|
-
type: "container",
|
|
23
|
-
label: "Body",
|
|
24
|
-
icon: BodyIcon,
|
|
25
|
-
states: defaultStates,
|
|
26
|
-
presetStyle
|
|
27
|
-
};
|
|
28
|
-
export const propsMeta = {
|
|
29
|
-
props,
|
|
30
|
-
initialProps: ["id"]
|
|
31
|
-
};
|
package/lib/bold.js
DELETED
package/lib/bold.stories.js
DELETED
package/lib/bold.ws.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { BoldIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { b } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/bold.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
b
|
|
10
|
-
};
|
|
11
|
-
export const meta = {
|
|
12
|
-
type: "rich-text-child",
|
|
13
|
-
label: "Bold Text",
|
|
14
|
-
icon: BoldIcon,
|
|
15
|
-
states: defaultStates,
|
|
16
|
-
presetStyle
|
|
17
|
-
};
|
|
18
|
-
export const propsMeta = {
|
|
19
|
-
props,
|
|
20
|
-
initialProps: ["id"]
|
|
21
|
-
};
|
package/lib/box.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
createElement,
|
|
4
|
-
forwardRef
|
|
5
|
-
} from "react";
|
|
6
|
-
export const defaultTag = "div";
|
|
7
|
-
export const Box = forwardRef(
|
|
8
|
-
({ tag = defaultTag, ...props }, ref) => {
|
|
9
|
-
return createElement(tag, { ...props, ref });
|
|
10
|
-
}
|
|
11
|
-
);
|
|
12
|
-
Box.displayName = "Box";
|
package/lib/box.stories.js
DELETED
package/lib/box.ws.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { BoxIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import {
|
|
7
|
-
div,
|
|
8
|
-
address,
|
|
9
|
-
article,
|
|
10
|
-
aside,
|
|
11
|
-
figure,
|
|
12
|
-
footer,
|
|
13
|
-
header,
|
|
14
|
-
main,
|
|
15
|
-
nav,
|
|
16
|
-
section
|
|
17
|
-
} from "@webstudio-is/react-sdk/css-normalize";
|
|
18
|
-
import { props } from "./__generated__/box.props";
|
|
19
|
-
const presetStyle = {
|
|
20
|
-
div,
|
|
21
|
-
address,
|
|
22
|
-
article,
|
|
23
|
-
aside,
|
|
24
|
-
figure,
|
|
25
|
-
footer,
|
|
26
|
-
header,
|
|
27
|
-
main,
|
|
28
|
-
nav,
|
|
29
|
-
section
|
|
30
|
-
};
|
|
31
|
-
export const meta = {
|
|
32
|
-
category: "general",
|
|
33
|
-
type: "container",
|
|
34
|
-
label: "Box",
|
|
35
|
-
description: "A container for content. By default this is a Div, but the tag can be changed in settings.",
|
|
36
|
-
icon: BoxIcon,
|
|
37
|
-
states: defaultStates,
|
|
38
|
-
presetStyle,
|
|
39
|
-
order: 0
|
|
40
|
-
};
|
|
41
|
-
export const propsMeta = {
|
|
42
|
-
props,
|
|
43
|
-
initialProps: ["id", "tag"]
|
|
44
|
-
};
|
package/lib/button.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export const defaultTag = "button";
|
|
5
|
-
export const Button = forwardRef(
|
|
6
|
-
({ type = "submit", children, ...props }, ref) => /* @__PURE__ */ jsx("button", { type, ...props, ref, children })
|
|
7
|
-
);
|
|
8
|
-
Button.displayName = "Button";
|
package/lib/button.stories.js
DELETED
package/lib/button.ws.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { ButtonElementIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { button } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/button.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
button
|
|
10
|
-
};
|
|
11
|
-
export const meta = {
|
|
12
|
-
category: "forms",
|
|
13
|
-
type: "container",
|
|
14
|
-
invalidAncestors: ["Button"],
|
|
15
|
-
label: "Button",
|
|
16
|
-
description: "Use a button to submit forms or trigger actions within a page. Do not use a button to navigate users to another resource or another page - that\u2019s what a link is used for.",
|
|
17
|
-
icon: ButtonElementIcon,
|
|
18
|
-
presetStyle,
|
|
19
|
-
states: [
|
|
20
|
-
...defaultStates,
|
|
21
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
22
|
-
{ selector: ":enabled", label: "Enabled" }
|
|
23
|
-
],
|
|
24
|
-
order: 1,
|
|
25
|
-
template: [
|
|
26
|
-
{
|
|
27
|
-
type: "instance",
|
|
28
|
-
component: "Button",
|
|
29
|
-
children: [{ type: "text", value: "Button you can edit" }]
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
};
|
|
33
|
-
export const propsMeta = {
|
|
34
|
-
props,
|
|
35
|
-
initialProps: ["id", "type", "aria-label"]
|
|
36
|
-
};
|
package/lib/checkbox.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export const defaultTag = "input";
|
|
5
|
-
export const Checkbox = forwardRef(({ children: _children, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, type: "checkbox", ref }));
|
|
6
|
-
Checkbox.displayName = "Checkbox";
|
package/lib/checkbox.ws.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { CheckboxCheckedIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { input } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/checkbox.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
input: [
|
|
10
|
-
...input,
|
|
11
|
-
{
|
|
12
|
-
property: "marginRight",
|
|
13
|
-
value: { type: "unit", unit: "em", value: 0.5 }
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
};
|
|
17
|
-
export const meta = {
|
|
18
|
-
category: "forms",
|
|
19
|
-
invalidAncestors: ["Button"],
|
|
20
|
-
type: "control",
|
|
21
|
-
label: "Checkbox",
|
|
22
|
-
description: "Use within a form to allow your users to toggle between checked and not checked. Group checkboxes by matching their \u201CName\u201D properties. Unlike radios, any number of checkboxes in a group can be checked.",
|
|
23
|
-
icon: CheckboxCheckedIcon,
|
|
24
|
-
presetStyle,
|
|
25
|
-
order: 6,
|
|
26
|
-
states: [
|
|
27
|
-
...defaultStates,
|
|
28
|
-
{ selector: ":checked", label: "Checked" },
|
|
29
|
-
{ selector: ":required", label: "Required" },
|
|
30
|
-
{ selector: ":optional", label: "Optional" },
|
|
31
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
32
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
33
|
-
{ selector: ":read-only", label: "Read Only" },
|
|
34
|
-
{ selector: ":read-write", label: "Read Write" }
|
|
35
|
-
],
|
|
36
|
-
template: [
|
|
37
|
-
{
|
|
38
|
-
type: "instance",
|
|
39
|
-
component: "Label",
|
|
40
|
-
label: "Checkbox Field",
|
|
41
|
-
children: [
|
|
42
|
-
{ type: "instance", component: "Checkbox", children: [] },
|
|
43
|
-
{
|
|
44
|
-
type: "instance",
|
|
45
|
-
component: "Text",
|
|
46
|
-
label: "Checkbox Label",
|
|
47
|
-
props: [{ type: "string", name: "tag", value: "span" }],
|
|
48
|
-
children: [{ type: "text", value: "Checkbox" }]
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
export const propsMeta = {
|
|
55
|
-
props,
|
|
56
|
-
initialProps: ["id", "name"]
|
|
57
|
-
};
|
package/lib/code-text.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
createElement
|
|
5
|
-
} from "react";
|
|
6
|
-
export const defaultTag = "code";
|
|
7
|
-
export const CodeText = forwardRef((props, ref) => {
|
|
8
|
-
return createElement(defaultTag, { ...props, ref });
|
|
9
|
-
});
|
|
10
|
-
CodeText.displayName = "CodeText";
|
package/lib/code-text.stories.js
DELETED
package/lib/code-text.ws.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { CodeTextIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { code } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/code-text.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
code: [
|
|
10
|
-
...code,
|
|
11
|
-
{
|
|
12
|
-
property: "display",
|
|
13
|
-
value: { type: "keyword", value: "block" }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
property: "whiteSpace",
|
|
17
|
-
value: { type: "keyword", value: "pre-wrap" }
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
property: "paddingLeft",
|
|
21
|
-
value: { type: "unit", value: 0.2, unit: "em" }
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
property: "paddingRight",
|
|
25
|
-
value: { type: "unit", value: 0.2, unit: "em" }
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
property: "backgroundColor",
|
|
29
|
-
value: { type: "rgb", r: 238, g: 238, b: 238, alpha: 1 }
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
};
|
|
33
|
-
export const meta = {
|
|
34
|
-
category: "general",
|
|
35
|
-
type: "container",
|
|
36
|
-
label: "Code Text",
|
|
37
|
-
description: "Use this component when you want to display code as text on the page.",
|
|
38
|
-
icon: CodeTextIcon,
|
|
39
|
-
invalidAncestors: ["CodeText"],
|
|
40
|
-
states: defaultStates,
|
|
41
|
-
presetStyle,
|
|
42
|
-
template: [
|
|
43
|
-
{
|
|
44
|
-
type: "instance",
|
|
45
|
-
component: "CodeText",
|
|
46
|
-
children: [{ type: "text", value: "Code you can edit" }]
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
order: 8
|
|
50
|
-
};
|
|
51
|
-
export const propsMeta = {
|
|
52
|
-
props,
|
|
53
|
-
initialProps: ["id", "lang"]
|
|
54
|
-
};
|
package/lib/form.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export const defaultTag = "form";
|
|
5
|
-
export const Form = forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx("form", { ...props, ref, children }));
|
|
6
|
-
Form.displayName = "Form";
|
package/lib/form.stories.js
DELETED
package/lib/form.ws.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { FormIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { form } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/form.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
form: [
|
|
10
|
-
...form,
|
|
11
|
-
{ property: "minHeight", value: { type: "unit", unit: "px", value: 20 } }
|
|
12
|
-
]
|
|
13
|
-
};
|
|
14
|
-
export const meta = {
|
|
15
|
-
category: "forms",
|
|
16
|
-
type: "container",
|
|
17
|
-
invalidAncestors: ["Form"],
|
|
18
|
-
label: "Form",
|
|
19
|
-
description: "Collect information from your users using validation rules.",
|
|
20
|
-
icon: FormIcon,
|
|
21
|
-
states: defaultStates,
|
|
22
|
-
presetStyle,
|
|
23
|
-
order: 0,
|
|
24
|
-
template: [
|
|
25
|
-
{
|
|
26
|
-
type: "instance",
|
|
27
|
-
component: "Form",
|
|
28
|
-
children: [
|
|
29
|
-
{
|
|
30
|
-
type: "instance",
|
|
31
|
-
component: "Label",
|
|
32
|
-
children: [{ type: "text", value: "Name" }]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: "instance",
|
|
36
|
-
component: "Input",
|
|
37
|
-
props: [{ type: "string", name: "name", value: "name" }],
|
|
38
|
-
children: []
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: "instance",
|
|
42
|
-
component: "Label",
|
|
43
|
-
children: [{ type: "text", value: "Email" }]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
type: "instance",
|
|
47
|
-
component: "Input",
|
|
48
|
-
props: [{ type: "string", name: "name", value: "email" }],
|
|
49
|
-
children: []
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
type: "instance",
|
|
53
|
-
component: "Button",
|
|
54
|
-
children: [{ type: "text", value: "Submit" }]
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
};
|
|
60
|
-
export const propsMeta = {
|
|
61
|
-
props,
|
|
62
|
-
initialProps: ["id", "action"]
|
|
63
|
-
};
|
package/lib/fragment.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export const Fragment = forwardRef((props, ref) => {
|
|
5
|
-
return /* @__PURE__ */ jsx("div", { ...props, ref, style: { display: "contents" } });
|
|
6
|
-
});
|
|
7
|
-
Fragment.displayName = "Fragment";
|
package/lib/fragment.ws.js
DELETED
package/lib/heading.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
createElement
|
|
5
|
-
} from "react";
|
|
6
|
-
const defaultTag = "h1";
|
|
7
|
-
export const Heading = forwardRef(
|
|
8
|
-
({ tag = defaultTag, ...props }, ref) => {
|
|
9
|
-
return createElement(tag, { ...props, ref });
|
|
10
|
-
}
|
|
11
|
-
);
|
|
12
|
-
Heading.displayName = "Heading";
|
package/lib/heading.stories.js
DELETED
package/lib/heading.ws.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { HeadingIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { h1, h2, h3, h4, h5, h6 } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/heading.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
h1,
|
|
10
|
-
h2,
|
|
11
|
-
h3,
|
|
12
|
-
h4,
|
|
13
|
-
h5,
|
|
14
|
-
h6
|
|
15
|
-
};
|
|
16
|
-
export const meta = {
|
|
17
|
-
category: "text",
|
|
18
|
-
type: "container",
|
|
19
|
-
label: "Heading",
|
|
20
|
-
description: "Use HTML headings to structure and organize content. Use the Tag property in settings to change the heading level (h1-h6).",
|
|
21
|
-
icon: HeadingIcon,
|
|
22
|
-
invalidAncestors: ["Heading"],
|
|
23
|
-
states: defaultStates,
|
|
24
|
-
presetStyle,
|
|
25
|
-
template: [
|
|
26
|
-
{
|
|
27
|
-
type: "instance",
|
|
28
|
-
component: "Heading",
|
|
29
|
-
children: [{ type: "text", value: "Heading you can edit" }]
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
order: 1
|
|
33
|
-
};
|
|
34
|
-
export const propsMeta = {
|
|
35
|
-
props,
|
|
36
|
-
initialProps: ["id", "tag"]
|
|
37
|
-
};
|
package/lib/html-embed.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
forwardRef,
|
|
5
|
-
useContext,
|
|
6
|
-
useEffect,
|
|
7
|
-
useRef
|
|
8
|
-
} from "react";
|
|
9
|
-
import { mergeRefs } from "@react-aria/utils";
|
|
10
|
-
import { ReactSdkContext } from "@webstudio-is/react-sdk";
|
|
11
|
-
const ExecutableHtml = (props) => {
|
|
12
|
-
const { code, innerRef, ...rest } = props;
|
|
13
|
-
const containerRef = useRef(null);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const container = containerRef.current;
|
|
16
|
-
if (container === null || code === void 0) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const range = document.createRange();
|
|
20
|
-
range.setStart(container, 0);
|
|
21
|
-
const fragment = range.createContextualFragment(code);
|
|
22
|
-
while (container.firstChild) {
|
|
23
|
-
container.removeChild(container.firstChild);
|
|
24
|
-
}
|
|
25
|
-
container.append(fragment);
|
|
26
|
-
}, [code]);
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
28
|
-
"div",
|
|
29
|
-
{
|
|
30
|
-
...rest,
|
|
31
|
-
ref: mergeRefs(innerRef, containerRef),
|
|
32
|
-
style: { display: "contents" }
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
const InnerHtml = (props) => {
|
|
37
|
-
const { code, innerRef, ...rest } = props;
|
|
38
|
-
return /* @__PURE__ */ jsx(
|
|
39
|
-
"div",
|
|
40
|
-
{
|
|
41
|
-
...rest,
|
|
42
|
-
ref: innerRef,
|
|
43
|
-
style: { display: "contents" },
|
|
44
|
-
dangerouslySetInnerHTML: { __html: props.code ?? "" }
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
const Placeholder = (props) => {
|
|
49
|
-
const { code, innerRef, ...rest } = props;
|
|
50
|
-
return /* @__PURE__ */ jsx("div", { ref: innerRef, ...rest, style: { padding: "20px" }, children: 'Open the "Settings" panel to insert HTML code' });
|
|
51
|
-
};
|
|
52
|
-
export const HtmlEmbed = forwardRef((props, ref) => {
|
|
53
|
-
const { renderer } = useContext(ReactSdkContext);
|
|
54
|
-
const { code, executeScriptOnCanvas, ...rest } = props;
|
|
55
|
-
if (code === void 0 || code.trim().length === 0) {
|
|
56
|
-
return /* @__PURE__ */ jsx(Placeholder, { innerRef: ref, ...rest });
|
|
57
|
-
}
|
|
58
|
-
if (renderer === "canvas" && executeScriptOnCanvas === true || renderer === "preview") {
|
|
59
|
-
return /* @__PURE__ */ jsx(ExecutableHtml, { innerRef: ref, code, ...rest });
|
|
60
|
-
}
|
|
61
|
-
return /* @__PURE__ */ jsx(InnerHtml, { innerRef: ref, code, ...rest });
|
|
62
|
-
});
|
|
63
|
-
HtmlEmbed.displayName = "HtmlEmbed";
|