@webstudio-is/react-sdk 0.61.0 → 0.63.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/app/custom-components/__generated__/form.props.js +412 -0
- package/lib/app/custom-components/__generated__/image.props.js +442 -0
- package/lib/app/custom-components/__generated__/link-block.props.js +432 -0
- package/lib/app/custom-components/__generated__/link.props.js +432 -0
- package/lib/app/custom-components/__generated__/rich-text-link.props.js +432 -0
- package/lib/app/custom-components/form.js +54 -0
- package/lib/app/custom-components/form.ws.js +81 -0
- package/lib/app/custom-components/index.js +10 -4
- package/lib/cjs/app/custom-components/__generated__/form.props.js +432 -0
- package/lib/cjs/app/custom-components/__generated__/image.props.js +462 -0
- package/lib/cjs/app/custom-components/__generated__/link-block.props.js +452 -0
- package/lib/cjs/app/custom-components/__generated__/link.props.js +452 -0
- package/lib/cjs/app/custom-components/__generated__/rich-text-link.props.js +452 -0
- package/lib/cjs/app/custom-components/form.js +70 -0
- package/lib/cjs/app/custom-components/form.ws.js +101 -0
- package/lib/cjs/app/custom-components/index.js +12 -6
- package/lib/cjs/components/__generated__/checkbox-field.props.js +419 -0
- package/lib/cjs/components/__generated__/checkbox.props.js +459 -0
- package/lib/cjs/components/__generated__/error-message.props.js +418 -0
- package/lib/cjs/components/__generated__/input.props.js +8 -3
- package/lib/cjs/components/__generated__/label.props.js +420 -0
- package/lib/cjs/components/__generated__/radio-button-field.props.js +419 -0
- package/lib/cjs/components/__generated__/radio-button.props.js +459 -0
- package/lib/cjs/components/__generated__/success-message.props.js +418 -0
- package/lib/cjs/components/__generated__/textarea.props.js +432 -0
- package/lib/cjs/components/blockquote.ws.js +2 -0
- package/lib/cjs/components/body.ws.js +2 -0
- package/lib/cjs/components/bold.ws.js +2 -0
- package/lib/cjs/components/box.ws.js +2 -0
- package/lib/cjs/components/button.ws.js +8 -2
- package/lib/cjs/components/checkbox-field.js +29 -0
- package/lib/cjs/components/checkbox-field.ws.js +55 -0
- package/lib/cjs/components/checkbox.js +29 -0
- package/lib/cjs/components/checkbox.ws.js +57 -0
- package/lib/cjs/components/code.ws.js +2 -0
- package/lib/cjs/components/component-meta.js +13 -1
- package/lib/cjs/components/components-utils.js +9 -1
- package/lib/cjs/components/components.js +17 -1
- package/lib/cjs/components/error-message.js +29 -0
- package/lib/cjs/components/error-message.ws.js +40 -0
- package/lib/cjs/components/form.js +1 -1
- package/lib/cjs/components/form.ws.js +27 -6
- package/lib/cjs/components/heading.ws.js +2 -0
- package/lib/cjs/components/image.ws.js +2 -0
- package/lib/cjs/components/index.js +43 -2
- package/lib/cjs/components/input.ws.js +17 -3
- package/lib/cjs/components/italic.ws.js +2 -0
- package/lib/cjs/components/label.js +29 -0
- package/lib/cjs/components/label.ws.js +56 -0
- package/lib/cjs/components/link-block.ws.js +1 -1
- package/lib/cjs/components/link.ws.js +13 -1
- package/lib/cjs/components/list-item.ws.js +3 -0
- package/lib/cjs/components/list.ws.js +2 -0
- package/lib/cjs/components/paragraph.ws.js +2 -0
- package/lib/cjs/components/radio-button-field.js +29 -0
- package/lib/cjs/components/radio-button-field.ws.js +55 -0
- package/lib/cjs/components/radio-button.js +29 -0
- package/lib/cjs/components/radio-button.ws.js +57 -0
- package/lib/cjs/components/separator.ws.js +2 -0
- package/lib/cjs/components/span.ws.js +2 -0
- package/lib/cjs/components/subscript.ws.js +2 -0
- package/lib/cjs/components/success-message.js +29 -0
- package/lib/cjs/components/success-message.ws.js +40 -0
- package/lib/cjs/components/superscript.ws.js +2 -0
- package/lib/cjs/components/text-block.ws.js +2 -0
- package/lib/cjs/components/textarea.js +29 -0
- package/lib/cjs/components/textarea.ws.js +58 -0
- package/lib/cjs/css/normalize.js +3 -1
- package/lib/cjs/css/presets.js +19 -1
- package/lib/cjs/index.js +2 -1
- package/lib/components/__generated__/checkbox-field.props.js +399 -0
- package/lib/components/__generated__/checkbox.props.js +439 -0
- package/lib/components/__generated__/error-message.props.js +398 -0
- package/lib/components/__generated__/input.props.js +8 -3
- package/lib/components/__generated__/label.props.js +400 -0
- package/lib/components/__generated__/radio-button-field.props.js +399 -0
- package/lib/components/__generated__/radio-button.props.js +439 -0
- package/lib/components/__generated__/success-message.props.js +398 -0
- package/lib/components/__generated__/textarea.props.js +412 -0
- package/lib/components/blockquote.ws.js +4 -0
- package/lib/components/body.ws.js +4 -0
- package/lib/components/bold.ws.js +4 -0
- package/lib/components/box.ws.js +4 -0
- package/lib/components/button.ws.js +10 -2
- package/lib/components/checkbox-field.js +9 -0
- package/lib/components/checkbox-field.ws.js +37 -0
- package/lib/components/checkbox.js +9 -0
- package/lib/components/checkbox.ws.js +39 -0
- package/lib/components/code.ws.js +4 -0
- package/lib/components/component-meta.js +13 -1
- package/lib/components/components-utils.js +9 -1
- package/lib/components/components.js +17 -1
- package/lib/components/error-message.js +9 -0
- package/lib/components/error-message.ws.js +20 -0
- package/lib/components/form.js +1 -1
- package/lib/components/form.ws.js +29 -6
- package/lib/components/heading.ws.js +4 -0
- package/lib/components/image.ws.js +4 -0
- package/lib/components/index.js +43 -2
- package/lib/components/input.ws.js +19 -3
- package/lib/components/italic.ws.js +4 -0
- package/lib/components/label.js +9 -0
- package/lib/components/label.ws.js +38 -0
- package/lib/components/link-block.ws.js +2 -2
- package/lib/components/link.ws.js +15 -1
- package/lib/components/list-item.ws.js +5 -0
- package/lib/components/list.ws.js +4 -0
- package/lib/components/paragraph.ws.js +4 -0
- package/lib/components/radio-button-field.js +9 -0
- package/lib/components/radio-button-field.ws.js +37 -0
- package/lib/components/radio-button.js +9 -0
- package/lib/components/radio-button.ws.js +39 -0
- package/lib/components/separator.ws.js +4 -0
- package/lib/components/span.ws.js +4 -0
- package/lib/components/subscript.ws.js +4 -0
- package/lib/components/success-message.js +9 -0
- package/lib/components/success-message.ws.js +20 -0
- package/lib/components/superscript.ws.js +4 -0
- package/lib/components/text-block.ws.js +4 -0
- package/lib/components/textarea.js +9 -0
- package/lib/components/textarea.ws.js +40 -0
- package/lib/css/normalize.js +4 -2
- package/lib/css/presets.js +19 -1
- package/lib/index.js +4 -2
- package/lib/types/app/custom-components/__generated__/form.props.d.ts +2 -0
- package/lib/types/app/custom-components/__generated__/image.props.d.ts +2 -0
- package/lib/types/app/custom-components/__generated__/link-block.props.d.ts +2 -0
- package/lib/types/app/custom-components/__generated__/link.props.d.ts +2 -0
- package/lib/types/app/custom-components/__generated__/rich-text-link.props.d.ts +2 -0
- package/lib/types/app/custom-components/form.d.ts +5 -0
- package/lib/types/app/custom-components/form.ws.d.ts +3 -0
- package/lib/types/app/custom-components/index.d.ts +6 -1
- package/lib/types/components/__generated__/checkbox-field.props.d.ts +2 -0
- package/lib/types/components/__generated__/checkbox.props.d.ts +2 -0
- package/lib/types/components/__generated__/error-message.props.d.ts +2 -0
- package/lib/types/components/__generated__/label.props.d.ts +2 -0
- package/lib/types/components/__generated__/radio-button-field.props.d.ts +2 -0
- package/lib/types/components/__generated__/radio-button.props.d.ts +2 -0
- package/lib/types/components/__generated__/success-message.props.d.ts +2 -0
- package/lib/types/components/__generated__/textarea.props.d.ts +2 -0
- package/lib/types/components/blockquote.ws.d.ts +1 -1
- package/lib/types/components/body.ws.d.ts +1 -1
- package/lib/types/components/bold.ws.d.ts +1 -1
- package/lib/types/components/box.ws.d.ts +1 -1
- package/lib/types/components/button.ws.d.ts +1 -1
- package/lib/types/components/checkbox-field.d.ts +3 -0
- package/lib/types/components/checkbox-field.ws.d.ts +3 -0
- package/lib/types/components/checkbox.d.ts +3 -0
- package/lib/types/components/checkbox.ws.d.ts +3 -0
- package/lib/types/components/code.ws.d.ts +1 -1
- package/lib/types/components/component-meta.d.ts +17 -4
- package/lib/types/components/components-utils.d.ts +5 -20
- package/lib/types/components/components.d.ts +8 -0
- package/lib/types/components/error-message.d.ts +3 -0
- package/lib/types/components/error-message.ws.d.ts +3 -0
- package/lib/types/components/form.ws.d.ts +1 -1
- package/lib/types/components/heading.ws.d.ts +1 -1
- package/lib/types/components/image.ws.d.ts +1 -1
- package/lib/types/components/index.d.ts +1 -0
- package/lib/types/components/input.d.ts +3 -1
- package/lib/types/components/input.stories.d.ts +6 -2
- package/lib/types/components/input.ws.d.ts +1 -1
- package/lib/types/components/italic.ws.d.ts +1 -1
- package/lib/types/components/label.d.ts +3 -0
- package/lib/types/components/label.ws.d.ts +3 -0
- package/lib/types/components/link.ws.d.ts +1 -1
- package/lib/types/components/list-item.ws.d.ts +1 -1
- package/lib/types/components/list.ws.d.ts +1 -1
- package/lib/types/components/paragraph.ws.d.ts +1 -1
- package/lib/types/components/radio-button-field.d.ts +3 -0
- package/lib/types/components/radio-button-field.ws.d.ts +3 -0
- package/lib/types/components/radio-button.d.ts +3 -0
- package/lib/types/components/radio-button.ws.d.ts +3 -0
- package/lib/types/components/separator.ws.d.ts +1 -1
- package/lib/types/components/span.ws.d.ts +1 -1
- package/lib/types/components/subscript.ws.d.ts +1 -1
- package/lib/types/components/success-message.d.ts +3 -0
- package/lib/types/components/success-message.ws.d.ts +3 -0
- package/lib/types/components/superscript.ws.d.ts +1 -1
- package/lib/types/components/text-block.ws.d.ts +1 -1
- package/lib/types/components/textarea.d.ts +3 -0
- package/lib/types/components/textarea.ws.d.ts +3 -0
- package/lib/types/css/normalize.d.ts +239 -46
- package/lib/types/css/presets.d.ts +3 -2
- package/lib/types/css/style-rules.d.ts +1 -1
- package/lib/types/embed-template.d.ts +4 -4
- package/lib/types/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/app/custom-components/__generated__/form.props.ts +457 -0
- package/src/app/custom-components/__generated__/image.props.ts +487 -0
- package/src/app/custom-components/__generated__/link-block.props.ts +477 -0
- package/src/app/custom-components/__generated__/link.props.ts +477 -0
- package/src/app/custom-components/__generated__/rich-text-link.props.ts +477 -0
- package/src/app/custom-components/form.tsx +94 -0
- package/src/app/custom-components/form.ws.tsx +86 -0
- package/src/app/custom-components/index.ts +9 -4
- package/src/components/__generated__/checkbox-field.props.ts +444 -0
- package/src/components/__generated__/checkbox.props.ts +484 -0
- package/src/components/__generated__/error-message.props.ts +443 -0
- package/src/components/__generated__/input.props.ts +8 -3
- package/src/components/__generated__/label.props.ts +445 -0
- package/src/components/__generated__/radio-button-field.props.ts +444 -0
- package/src/components/__generated__/radio-button.props.ts +484 -0
- package/src/components/__generated__/success-message.props.ts +443 -0
- package/src/components/__generated__/textarea.props.ts +457 -0
- package/src/components/blockquote.ws.tsx +6 -4
- package/src/components/body.ws.tsx +6 -4
- package/src/components/bold.ws.tsx +6 -4
- package/src/components/box.ws.ts +6 -4
- package/src/components/button.ws.tsx +11 -5
- package/src/components/checkbox-field.tsx +10 -0
- package/src/components/checkbox-field.ws.tsx +40 -0
- package/src/components/checkbox.tsx +13 -0
- package/src/components/checkbox.ws.tsx +42 -0
- package/src/components/code.ws.tsx +6 -4
- package/src/components/component-meta.ts +12 -0
- package/src/components/components-utils.ts +16 -10
- package/src/components/components.ts +8 -0
- package/src/components/error-message.tsx +10 -0
- package/src/components/error-message.ws.tsx +24 -0
- package/src/components/form.tsx +5 -1
- package/src/components/form.ws.tsx +30 -9
- package/src/components/heading.ws.tsx +6 -4
- package/src/components/image.ws.tsx +6 -4
- package/src/components/index.ts +47 -0
- package/src/components/input.tsx +3 -1
- package/src/components/input.ws.tsx +19 -5
- package/src/components/italic.ws.tsx +6 -4
- package/src/components/label.tsx +10 -0
- package/src/components/label.ws.tsx +41 -0
- package/src/components/link-block.ws.tsx +2 -2
- package/src/components/link.ws.tsx +17 -5
- package/src/components/list-item.ws.tsx +7 -4
- package/src/components/list.ws.tsx +6 -4
- package/src/components/paragraph.ws.tsx +6 -4
- package/src/components/radio-button-field.tsx +10 -0
- package/src/components/radio-button-field.ws.tsx +40 -0
- package/src/components/radio-button.tsx +13 -0
- package/src/components/radio-button.ws.tsx +42 -0
- package/src/components/separator.ws.tsx +6 -4
- package/src/components/span.ws.tsx +6 -4
- package/src/components/subscript.ws.tsx +6 -4
- package/src/components/success-message.tsx +10 -0
- package/src/components/success-message.ws.tsx +24 -0
- package/src/components/superscript.ws.tsx +6 -4
- package/src/components/text-block.ws.tsx +6 -4
- package/src/components/textarea.tsx +13 -0
- package/src/components/textarea.ws.tsx +43 -0
- package/src/css/normalize.ts +21 -18
- package/src/css/presets.ts +20 -2
- package/src/index.ts +1 -0
|
@@ -22,29 +22,45 @@ import { List } from "./list";
|
|
|
22
22
|
import { ListItem } from "./list-item";
|
|
23
23
|
import { Separator } from "./separator";
|
|
24
24
|
import { Code } from "./code";
|
|
25
|
+
import { Label } from "./label";
|
|
26
|
+
import { SuccessMessage } from "./success-message";
|
|
27
|
+
import { ErrorMessage } from "./error-message";
|
|
28
|
+
import { Textarea } from "./textarea";
|
|
29
|
+
import { RadioButtonField } from "./radio-button-field";
|
|
30
|
+
import { RadioButton } from "./radio-button";
|
|
31
|
+
import { CheckboxField } from "./checkbox-field";
|
|
32
|
+
import { Checkbox } from "./checkbox";
|
|
25
33
|
export {
|
|
26
34
|
Blockquote,
|
|
27
35
|
Body,
|
|
28
36
|
Bold,
|
|
29
37
|
Box,
|
|
30
38
|
Button,
|
|
39
|
+
Checkbox,
|
|
40
|
+
CheckboxField,
|
|
31
41
|
Code,
|
|
42
|
+
ErrorMessage,
|
|
32
43
|
Form,
|
|
33
44
|
Fragment,
|
|
34
45
|
Heading,
|
|
35
46
|
Image,
|
|
36
47
|
Input,
|
|
37
48
|
Italic,
|
|
49
|
+
Label,
|
|
38
50
|
Link,
|
|
39
51
|
LinkBlock,
|
|
40
52
|
List,
|
|
41
53
|
ListItem,
|
|
42
54
|
Paragraph,
|
|
55
|
+
RadioButton,
|
|
56
|
+
RadioButtonField,
|
|
43
57
|
RichTextLink,
|
|
44
58
|
Separator,
|
|
45
59
|
Slot,
|
|
46
60
|
Span,
|
|
47
61
|
Subscript,
|
|
62
|
+
SuccessMessage,
|
|
48
63
|
Superscript,
|
|
49
|
-
TextBlock
|
|
64
|
+
TextBlock,
|
|
65
|
+
Textarea
|
|
50
66
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
const defaultTag = "div";
|
|
4
|
+
const ErrorMessage = forwardRef((props, ref) => /* @__PURE__ */ jsx("div", { ...props, ref }));
|
|
5
|
+
ErrorMessage.displayName = "ErrorMessage";
|
|
6
|
+
export {
|
|
7
|
+
ErrorMessage,
|
|
8
|
+
defaultTag
|
|
9
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BoxIcon } from "@webstudio-is/icons";
|
|
2
|
+
import { props } from "./__generated__/error-message.props";
|
|
3
|
+
import { div } from "../css/normalize";
|
|
4
|
+
const presetStyle = {
|
|
5
|
+
div
|
|
6
|
+
};
|
|
7
|
+
const meta = {
|
|
8
|
+
type: "container",
|
|
9
|
+
label: "Error Message",
|
|
10
|
+
Icon: BoxIcon,
|
|
11
|
+
presetStyle
|
|
12
|
+
};
|
|
13
|
+
const propsMeta = {
|
|
14
|
+
props,
|
|
15
|
+
initialProps: []
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
meta,
|
|
19
|
+
propsMeta
|
|
20
|
+
};
|
package/lib/components/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
const defaultTag = "form";
|
|
4
|
-
const Form = forwardRef((props, ref) => /* @__PURE__ */ jsx("form", { ...props, ref }));
|
|
4
|
+
const Form = forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx("form", { ...props, ref, children }));
|
|
5
5
|
Form.displayName = "Form";
|
|
6
6
|
export {
|
|
7
7
|
Form,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FormIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { form } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/form.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
form: [
|
|
6
9
|
...form,
|
|
7
|
-
{
|
|
8
|
-
property: "minHeight",
|
|
9
|
-
value: { type: "unit", unit: "px", value: 20 }
|
|
10
|
-
}
|
|
10
|
+
{ property: "minHeight", value: { type: "unit", unit: "px", value: 20 } }
|
|
11
11
|
]
|
|
12
12
|
};
|
|
13
13
|
const meta = {
|
|
@@ -15,9 +15,31 @@ const meta = {
|
|
|
15
15
|
type: "container",
|
|
16
16
|
label: "Form",
|
|
17
17
|
Icon: FormIcon,
|
|
18
|
+
states: defaultStates,
|
|
18
19
|
presetStyle,
|
|
19
20
|
children: [
|
|
20
|
-
{
|
|
21
|
+
{
|
|
22
|
+
type: "instance",
|
|
23
|
+
component: "Label",
|
|
24
|
+
children: [{ type: "text", value: "Name" }]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: "instance",
|
|
28
|
+
component: "Input",
|
|
29
|
+
props: [{ type: "string", name: "name", value: "name" }],
|
|
30
|
+
children: []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "instance",
|
|
34
|
+
component: "Label",
|
|
35
|
+
children: [{ type: "text", value: "Email" }]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "instance",
|
|
39
|
+
component: "Input",
|
|
40
|
+
props: [{ type: "string", name: "email", value: "email" }],
|
|
41
|
+
children: []
|
|
42
|
+
},
|
|
21
43
|
{
|
|
22
44
|
type: "instance",
|
|
23
45
|
component: "Button",
|
|
@@ -26,7 +48,8 @@ const meta = {
|
|
|
26
48
|
]
|
|
27
49
|
};
|
|
28
50
|
const propsMeta = {
|
|
29
|
-
props
|
|
51
|
+
props,
|
|
52
|
+
initialProps: []
|
|
30
53
|
};
|
|
31
54
|
export {
|
|
32
55
|
meta,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { HeadingIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { h1, h2, h3, h4, h5, h6 } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/heading.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
h1,
|
|
@@ -15,6 +18,7 @@ const meta = {
|
|
|
15
18
|
label: "Heading",
|
|
16
19
|
Icon: HeadingIcon,
|
|
17
20
|
children: [{ type: "text", value: "Heading you can edit" }],
|
|
21
|
+
states: defaultStates,
|
|
18
22
|
presetStyle
|
|
19
23
|
};
|
|
20
24
|
const propsMeta = {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ImageIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { img } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/image.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
img: [
|
|
@@ -22,6 +25,7 @@ const meta = {
|
|
|
22
25
|
type: "embed",
|
|
23
26
|
label: "Image",
|
|
24
27
|
Icon: ImageIcon,
|
|
28
|
+
states: defaultStates,
|
|
25
29
|
presetStyle
|
|
26
30
|
};
|
|
27
31
|
const propsMeta = {
|
package/lib/components/index.js
CHANGED
|
@@ -23,6 +23,14 @@ import { meta as ListMeta } from "./list.ws";
|
|
|
23
23
|
import { meta as ListItemMeta } from "./list-item.ws";
|
|
24
24
|
import { meta as SeparatorMeta } from "./separator.ws";
|
|
25
25
|
import { meta as CodeMeta } from "./code.ws";
|
|
26
|
+
import { meta as LabelMeta } from "./label.ws";
|
|
27
|
+
import { meta as SuccessMessageMeta } from "./success-message.ws";
|
|
28
|
+
import { meta as ErrorMessageMeta } from "./error-message.ws";
|
|
29
|
+
import { meta as TextareaMeta } from "./textarea.ws";
|
|
30
|
+
import { meta as RadioButtonFieldMeta } from "./radio-button-field.ws";
|
|
31
|
+
import { meta as RadioButtonMeta } from "./radio-button.ws";
|
|
32
|
+
import { meta as CheckboxFieldMeta } from "./checkbox-field.ws";
|
|
33
|
+
import { meta as CheckboxMeta } from "./checkbox.ws";
|
|
26
34
|
import { propsMeta as SlotMetaPropsMeta } from "./slot.ws";
|
|
27
35
|
import { propsMeta as FragmentMetaPropsMeta } from "./fragment.ws";
|
|
28
36
|
import { propsMeta as BodyMetaPropsMeta } from "./body.ws";
|
|
@@ -47,6 +55,14 @@ import { propsMeta as ListPropsMeta } from "./list.ws";
|
|
|
47
55
|
import { propsMeta as ListItemPropsMeta } from "./list-item.ws";
|
|
48
56
|
import { propsMeta as SeparatorPropsMeta } from "./separator.ws";
|
|
49
57
|
import { propsMeta as CodePropsMeta } from "./code.ws";
|
|
58
|
+
import { propsMeta as LabelPropsMeta } from "./label.ws";
|
|
59
|
+
import { propsMeta as SuccessMessagePropsMeta } from "./success-message.ws";
|
|
60
|
+
import { propsMeta as ErrorMessagePropsMeta } from "./error-message.ws";
|
|
61
|
+
import { propsMeta as TextareaPropsMeta } from "./textarea.ws";
|
|
62
|
+
import { propsMeta as RadioButtonFieldPropsMeta } from "./radio-button-field.ws";
|
|
63
|
+
import { propsMeta as RadioButtonPropsMeta } from "./radio-button.ws";
|
|
64
|
+
import { propsMeta as CheckboxFieldPropsMeta } from "./checkbox-field.ws";
|
|
65
|
+
import { propsMeta as CheckboxPropsMeta } from "./checkbox.ws";
|
|
50
66
|
const defaultMetas = {
|
|
51
67
|
Slot: SlotMeta,
|
|
52
68
|
Fragment: FragmentMeta,
|
|
@@ -71,7 +87,15 @@ const defaultMetas = {
|
|
|
71
87
|
List: ListMeta,
|
|
72
88
|
ListItem: ListItemMeta,
|
|
73
89
|
Separator: SeparatorMeta,
|
|
74
|
-
Code: CodeMeta
|
|
90
|
+
Code: CodeMeta,
|
|
91
|
+
Label: LabelMeta,
|
|
92
|
+
SuccessMessage: SuccessMessageMeta,
|
|
93
|
+
ErrorMessage: ErrorMessageMeta,
|
|
94
|
+
Textarea: TextareaMeta,
|
|
95
|
+
RadioButtonField: RadioButtonFieldMeta,
|
|
96
|
+
RadioButton: RadioButtonMeta,
|
|
97
|
+
CheckboxField: CheckboxFieldMeta,
|
|
98
|
+
Checkbox: CheckboxMeta
|
|
75
99
|
};
|
|
76
100
|
let currentMetas = defaultMetas;
|
|
77
101
|
const getComponentMeta = (name) => {
|
|
@@ -108,7 +132,15 @@ const defaultPropsMetasRaw = {
|
|
|
108
132
|
List: ListPropsMeta,
|
|
109
133
|
ListItem: ListItemPropsMeta,
|
|
110
134
|
Separator: SeparatorPropsMeta,
|
|
111
|
-
Code: CodePropsMeta
|
|
135
|
+
Code: CodePropsMeta,
|
|
136
|
+
Label: LabelPropsMeta,
|
|
137
|
+
SuccessMessage: SuccessMessagePropsMeta,
|
|
138
|
+
ErrorMessage: ErrorMessagePropsMeta,
|
|
139
|
+
Textarea: TextareaPropsMeta,
|
|
140
|
+
RadioButtonField: RadioButtonFieldPropsMeta,
|
|
141
|
+
RadioButton: RadioButtonPropsMeta,
|
|
142
|
+
CheckboxField: CheckboxFieldPropsMeta,
|
|
143
|
+
Checkbox: CheckboxPropsMeta
|
|
112
144
|
};
|
|
113
145
|
const defaultPropsMetas = defaultPropsMetasRaw;
|
|
114
146
|
let registeredPropsMetas = {};
|
|
@@ -163,7 +195,16 @@ const computeInitialProps = (props, defaults, overrides) => {
|
|
|
163
195
|
).map(([name]) => name) : [];
|
|
164
196
|
return [...initialProps, ...requiredProps];
|
|
165
197
|
};
|
|
198
|
+
const canAcceptComponent = (parentComponent, childComponent) => {
|
|
199
|
+
const parentMeta = getComponentMeta(parentComponent);
|
|
200
|
+
const childMeta = getComponentMeta(childComponent);
|
|
201
|
+
if (parentMeta?.type !== "container" || childMeta === void 0) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
return childMeta.acceptedParents === void 0 || childMeta.acceptedParents.includes(parentComponent);
|
|
205
|
+
};
|
|
166
206
|
export {
|
|
207
|
+
canAcceptComponent,
|
|
167
208
|
getComponentMeta,
|
|
168
209
|
getComponentPropsMeta,
|
|
169
210
|
registerComponentMetas,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { FormTextFieldIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { input } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/input.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
input
|
|
@@ -7,12 +10,25 @@ const presetStyle = {
|
|
|
7
10
|
const meta = {
|
|
8
11
|
category: "forms",
|
|
9
12
|
type: "control",
|
|
10
|
-
label: "
|
|
13
|
+
label: "Text Field",
|
|
11
14
|
Icon: FormTextFieldIcon,
|
|
12
|
-
presetStyle
|
|
15
|
+
presetStyle,
|
|
16
|
+
states: [
|
|
17
|
+
...defaultStates,
|
|
18
|
+
{ selector: "::placeholder", label: "Placeholder" },
|
|
19
|
+
{ selector: ":valid", label: "Valid" },
|
|
20
|
+
{ selector: ":invalid", label: "Invalid" },
|
|
21
|
+
{ selector: ":required", label: "Required" },
|
|
22
|
+
{ selector: ":optional", label: "Optional" },
|
|
23
|
+
{ selector: ":disabled", label: "Disabled" },
|
|
24
|
+
{ selector: ":enabled", label: "Enabled" },
|
|
25
|
+
{ selector: ":read-only", label: "Read Only" },
|
|
26
|
+
{ selector: ":read-write", label: "Read Write" }
|
|
27
|
+
]
|
|
13
28
|
};
|
|
14
29
|
const propsMeta = {
|
|
15
|
-
props
|
|
30
|
+
props,
|
|
31
|
+
initialProps: ["name", "type", "placeholder", "required", "autoFocus"]
|
|
16
32
|
};
|
|
17
33
|
export {
|
|
18
34
|
meta,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TextItalicIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/italic.props";
|
|
3
6
|
import { i } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -14,6 +17,7 @@ const meta = {
|
|
|
14
17
|
type: "rich-text-child",
|
|
15
18
|
label: "Italic Text",
|
|
16
19
|
Icon: TextItalicIcon,
|
|
20
|
+
states: defaultStates,
|
|
17
21
|
presetStyle
|
|
18
22
|
};
|
|
19
23
|
const propsMeta = {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
const defaultTag = "label";
|
|
4
|
+
const Label = forwardRef((props, ref) => /* @__PURE__ */ jsx("label", { ...props, ref }));
|
|
5
|
+
Label.displayName = "Label";
|
|
6
|
+
export {
|
|
7
|
+
Label,
|
|
8
|
+
defaultTag
|
|
9
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TextBlockIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
5
|
+
import { props } from "./__generated__/label.props";
|
|
6
|
+
import { label } from "../css/normalize";
|
|
7
|
+
const presetStyle = {
|
|
8
|
+
label: [
|
|
9
|
+
...label,
|
|
10
|
+
{ property: "display", value: { type: "keyword", value: "block" } }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
const meta = {
|
|
14
|
+
category: "forms",
|
|
15
|
+
type: "rich-text",
|
|
16
|
+
label: "Input Label",
|
|
17
|
+
Icon: TextBlockIcon,
|
|
18
|
+
states: defaultStates,
|
|
19
|
+
presetStyle,
|
|
20
|
+
children: [{ type: "text", value: "Form Label" }]
|
|
21
|
+
};
|
|
22
|
+
const propsMeta = {
|
|
23
|
+
props: {
|
|
24
|
+
...props,
|
|
25
|
+
htmlFor: {
|
|
26
|
+
required: false,
|
|
27
|
+
control: "text",
|
|
28
|
+
type: "string",
|
|
29
|
+
rows: 0,
|
|
30
|
+
label: "For"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
initialProps: ["htmlFor"]
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
meta,
|
|
37
|
+
propsMeta
|
|
38
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinkBlockIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { props } from "./__generated__/link-block.props";
|
|
3
3
|
import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
|
|
4
4
|
import { a } from "../css/normalize";
|
|
@@ -15,7 +15,7 @@ const meta = {
|
|
|
15
15
|
category: "general",
|
|
16
16
|
type: "container",
|
|
17
17
|
label: "Link Block",
|
|
18
|
-
Icon:
|
|
18
|
+
Icon: LinkBlockIcon,
|
|
19
19
|
states: linkMeta.states,
|
|
20
20
|
presetStyle
|
|
21
21
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { LinkIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { a } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/link.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
a: [
|
|
@@ -20,7 +23,18 @@ const meta = {
|
|
|
20
23
|
label: "Link Text",
|
|
21
24
|
Icon: LinkIcon,
|
|
22
25
|
presetStyle,
|
|
23
|
-
states: [
|
|
26
|
+
states: [
|
|
27
|
+
...defaultStates,
|
|
28
|
+
{
|
|
29
|
+
selector: ":visited",
|
|
30
|
+
label: "Visited"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
category: "component-states",
|
|
34
|
+
selector: "[aria-current=page]",
|
|
35
|
+
label: "Current page"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
24
38
|
children: [{ type: "text", value: "Link text you can edit" }]
|
|
25
39
|
};
|
|
26
40
|
const propsMeta = {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ListItemIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { li } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/list-item.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
li
|
|
@@ -7,9 +10,11 @@ const presetStyle = {
|
|
|
7
10
|
const meta = {
|
|
8
11
|
category: "typography",
|
|
9
12
|
type: "rich-text",
|
|
13
|
+
acceptedParents: ["List"],
|
|
10
14
|
label: "List Item",
|
|
11
15
|
Icon: ListItemIcon,
|
|
12
16
|
children: [{ type: "text", value: "List Item you can edit" }],
|
|
17
|
+
states: defaultStates,
|
|
13
18
|
presetStyle
|
|
14
19
|
};
|
|
15
20
|
const propsMeta = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ListIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/list.props";
|
|
3
6
|
import { ol, ul } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -38,6 +41,7 @@ const meta = {
|
|
|
38
41
|
type: "container",
|
|
39
42
|
label: "List",
|
|
40
43
|
Icon: ListIcon,
|
|
44
|
+
states: defaultStates,
|
|
41
45
|
presetStyle,
|
|
42
46
|
children: []
|
|
43
47
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TextAlignLeftIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { p } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/paragraph.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
p
|
|
@@ -10,6 +13,7 @@ const meta = {
|
|
|
10
13
|
label: "Paragraph",
|
|
11
14
|
Icon: TextAlignLeftIcon,
|
|
12
15
|
children: [{ type: "text", value: "Pragraph you can edit" }],
|
|
16
|
+
states: defaultStates,
|
|
13
17
|
presetStyle
|
|
14
18
|
};
|
|
15
19
|
const propsMeta = {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
const defaultTag = "label";
|
|
4
|
+
const RadioButtonField = forwardRef((props, ref) => /* @__PURE__ */ jsx("label", { ...props, ref }));
|
|
5
|
+
RadioButtonField.displayName = "RadioButtonField";
|
|
6
|
+
export {
|
|
7
|
+
RadioButtonField,
|
|
8
|
+
defaultTag
|
|
9
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RadioCheckedIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
5
|
+
import { props } from "./__generated__/radio-button-field.props";
|
|
6
|
+
import { label } from "../css/normalize";
|
|
7
|
+
const presetStyle = {
|
|
8
|
+
label: [
|
|
9
|
+
...label,
|
|
10
|
+
{ property: "display", value: { type: "keyword", value: "flex" } }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
const meta = {
|
|
14
|
+
category: "forms",
|
|
15
|
+
type: "container",
|
|
16
|
+
label: "Radio Button Field",
|
|
17
|
+
Icon: RadioCheckedIcon,
|
|
18
|
+
states: defaultStates,
|
|
19
|
+
presetStyle,
|
|
20
|
+
children: [
|
|
21
|
+
{ type: "instance", component: "RadioButton", props: [], children: [] },
|
|
22
|
+
{
|
|
23
|
+
type: "instance",
|
|
24
|
+
component: "TextBlock",
|
|
25
|
+
props: [],
|
|
26
|
+
children: [{ type: "text", value: "Radio" }]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
const propsMeta = {
|
|
31
|
+
props,
|
|
32
|
+
initialProps: []
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
meta,
|
|
36
|
+
propsMeta
|
|
37
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
const defaultTag = "input";
|
|
4
|
+
const RadioButton = forwardRef(({ children: _children, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, type: "radio", ref }));
|
|
5
|
+
RadioButton.displayName = "RadioButton";
|
|
6
|
+
export {
|
|
7
|
+
RadioButton,
|
|
8
|
+
defaultTag
|
|
9
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RadioCheckedIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
5
|
+
import { input } from "../css/normalize";
|
|
6
|
+
import { props } from "./__generated__/radio-button.props";
|
|
7
|
+
const presetStyle = {
|
|
8
|
+
input: [
|
|
9
|
+
...input,
|
|
10
|
+
{
|
|
11
|
+
property: "marginRight",
|
|
12
|
+
value: { type: "unit", unit: "em", value: 0.5 }
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
const meta = {
|
|
17
|
+
type: "control",
|
|
18
|
+
label: "Radio Button",
|
|
19
|
+
Icon: RadioCheckedIcon,
|
|
20
|
+
presetStyle,
|
|
21
|
+
states: [
|
|
22
|
+
...defaultStates,
|
|
23
|
+
{ selector: ":checked", label: "Checked" },
|
|
24
|
+
{ selector: ":required", label: "Required" },
|
|
25
|
+
{ selector: ":optional", label: "Optional" },
|
|
26
|
+
{ selector: ":disabled", label: "Disabled" },
|
|
27
|
+
{ selector: ":enabled", label: "Enabled" },
|
|
28
|
+
{ selector: ":read-only", label: "Read Only" },
|
|
29
|
+
{ selector: ":read-write", label: "Read Write" }
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
const propsMeta = {
|
|
33
|
+
props,
|
|
34
|
+
initialProps: ["name"]
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
meta,
|
|
38
|
+
propsMeta
|
|
39
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { DashIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/separator.props";
|
|
3
6
|
import { hr } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -35,6 +38,7 @@ const meta = {
|
|
|
35
38
|
type: "embed",
|
|
36
39
|
label: "Separator",
|
|
37
40
|
Icon: DashIcon,
|
|
41
|
+
states: defaultStates,
|
|
38
42
|
presetStyle,
|
|
39
43
|
children: []
|
|
40
44
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { PaintBrushIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { span } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/span.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
span
|
|
@@ -8,6 +11,7 @@ const meta = {
|
|
|
8
11
|
type: "rich-text-child",
|
|
9
12
|
label: "Styled Text",
|
|
10
13
|
Icon: PaintBrushIcon,
|
|
14
|
+
states: defaultStates,
|
|
11
15
|
presetStyle
|
|
12
16
|
};
|
|
13
17
|
const propsMeta = {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { SubscriptIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { sub } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/subscript.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
sub
|
|
@@ -8,6 +11,7 @@ const meta = {
|
|
|
8
11
|
type: "rich-text-child",
|
|
9
12
|
label: "Subscript Text",
|
|
10
13
|
Icon: SubscriptIcon,
|
|
14
|
+
states: defaultStates,
|
|
11
15
|
presetStyle
|
|
12
16
|
};
|
|
13
17
|
const propsMeta = {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
const defaultTag = "div";
|
|
4
|
+
const SuccessMessage = forwardRef((props, ref) => /* @__PURE__ */ jsx("div", { ...props, ref }));
|
|
5
|
+
SuccessMessage.displayName = "SuccessMessage";
|
|
6
|
+
export {
|
|
7
|
+
SuccessMessage,
|
|
8
|
+
defaultTag
|
|
9
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BoxIcon } from "@webstudio-is/icons";
|
|
2
|
+
import { props } from "./__generated__/success-message.props";
|
|
3
|
+
import { div } from "../css/normalize";
|
|
4
|
+
const presetStyle = {
|
|
5
|
+
div
|
|
6
|
+
};
|
|
7
|
+
const meta = {
|
|
8
|
+
type: "container",
|
|
9
|
+
label: "Success Message",
|
|
10
|
+
Icon: BoxIcon,
|
|
11
|
+
presetStyle
|
|
12
|
+
};
|
|
13
|
+
const propsMeta = {
|
|
14
|
+
props,
|
|
15
|
+
initialProps: []
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
meta,
|
|
19
|
+
propsMeta
|
|
20
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { SuperscriptIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { sup } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/superscript.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
sup
|
|
@@ -8,6 +11,7 @@ const meta = {
|
|
|
8
11
|
type: "rich-text-child",
|
|
9
12
|
label: "Superscript Text",
|
|
10
13
|
Icon: SuperscriptIcon,
|
|
14
|
+
states: defaultStates,
|
|
11
15
|
presetStyle
|
|
12
16
|
};
|
|
13
17
|
const propsMeta = {
|