@webstudio-is/react-sdk 0.62.0 → 0.64.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 +1 -2
- package/lib/app/custom-components/form.js +13 -2
- package/lib/cjs/app/custom-components/__generated__/form.props.js +1 -2
- package/lib/cjs/app/custom-components/form.js +19 -8
- 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 +2 -1
- package/lib/cjs/components/checkbox-field.ws.js +2 -0
- package/lib/cjs/components/checkbox.ws.js +2 -0
- package/lib/cjs/components/code.ws.js +2 -0
- package/lib/cjs/components/component-meta.js +12 -1
- package/lib/cjs/components/form.ws.js +2 -0
- package/lib/cjs/components/heading.ws.js +2 -0
- package/lib/cjs/components/image.ws.js +2 -0
- package/lib/cjs/components/input.ws.js +2 -0
- package/lib/cjs/components/italic.ws.js +2 -0
- package/lib/cjs/components/label.ws.js +2 -0
- package/lib/cjs/components/link.ws.js +13 -1
- package/lib/cjs/components/list-item.ws.js +2 -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.ws.js +2 -0
- package/lib/cjs/components/radio-button.ws.js +2 -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/superscript.ws.js +2 -0
- package/lib/cjs/components/text-block.ws.js +2 -0
- package/lib/cjs/components/textarea.ws.js +2 -0
- package/lib/cjs/index.js +2 -1
- 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 +4 -1
- package/lib/components/checkbox-field.ws.js +4 -0
- package/lib/components/checkbox.ws.js +4 -0
- package/lib/components/code.ws.js +4 -0
- package/lib/components/component-meta.js +12 -1
- package/lib/components/form.ws.js +4 -0
- package/lib/components/heading.ws.js +4 -0
- package/lib/components/image.ws.js +4 -0
- package/lib/components/input.ws.js +4 -0
- package/lib/components/italic.ws.js +4 -0
- package/lib/components/label.ws.js +4 -0
- package/lib/components/link.ws.js +15 -1
- package/lib/components/list-item.ws.js +4 -0
- package/lib/components/list.ws.js +4 -0
- package/lib/components/paragraph.ws.js +4 -0
- package/lib/components/radio-button-field.ws.js +4 -0
- package/lib/components/radio-button.ws.js +4 -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/superscript.ws.js +4 -0
- package/lib/components/text-block.ws.js +4 -0
- package/lib/components/textarea.ws.js +4 -0
- package/lib/index.js +4 -2
- package/lib/types/app/custom-components/form.d.ts +1 -1
- package/lib/types/app/custom-components/index.d.ts +1 -1
- 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.ws.d.ts +1 -1
- package/lib/types/components/checkbox.ws.d.ts +1 -1
- package/lib/types/components/code.ws.d.ts +1 -1
- package/lib/types/components/component-meta.d.ts +16 -6
- 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/input.ws.d.ts +1 -1
- package/lib/types/components/italic.ws.d.ts +1 -1
- package/lib/types/components/label.ws.d.ts +1 -1
- 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.ws.d.ts +1 -1
- package/lib/types/components/radio-button.ws.d.ts +1 -1
- 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/superscript.ws.d.ts +1 -1
- package/lib/types/components/text-block.ws.d.ts +1 -1
- package/lib/types/components/textarea.ws.d.ts +1 -1
- package/lib/types/css/normalize.d.ts +2 -0
- package/lib/types/css/presets.d.ts +2 -2
- package/lib/types/index.d.ts +1 -1
- package/package.json +12 -11
- package/src/app/custom-components/__generated__/form.props.ts +1 -2
- package/src/app/custom-components/form.tsx +27 -10
- 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 +6 -5
- package/src/components/checkbox-field.ws.tsx +6 -4
- package/src/components/checkbox.ws.tsx +6 -4
- package/src/components/code.ws.tsx +6 -4
- package/src/components/component-meta.ts +11 -0
- package/src/components/form.ws.tsx +6 -4
- package/src/components/heading.ws.tsx +6 -4
- package/src/components/image.ws.tsx +6 -4
- package/src/components/input.ws.tsx +6 -4
- package/src/components/italic.ws.tsx +6 -4
- package/src/components/label.ws.tsx +6 -4
- package/src/components/link.ws.tsx +17 -5
- package/src/components/list-item.ws.tsx +6 -4
- package/src/components/list.ws.tsx +6 -4
- package/src/components/paragraph.ws.tsx +6 -4
- package/src/components/radio-button-field.ws.tsx +6 -4
- package/src/components/radio-button.ws.tsx +6 -4
- 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/superscript.ws.tsx +6 -4
- package/src/components/text-block.ws.tsx +6 -4
- package/src/components/textarea.ws.tsx +6 -4
- package/src/css/normalize.ts +18 -16
- package/src/css/presets.ts +2 -2
- package/src/index.ts +1 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BodyIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { body } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/body.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
body: [
|
|
@@ -32,6 +35,7 @@ const meta = {
|
|
|
32
35
|
type: "container",
|
|
33
36
|
label: "Body",
|
|
34
37
|
Icon: BodyIcon,
|
|
38
|
+
states: defaultStates,
|
|
35
39
|
presetStyle
|
|
36
40
|
};
|
|
37
41
|
const propsMeta = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BoldIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/bold.props";
|
|
3
6
|
import { b } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -8,6 +11,7 @@ const meta = {
|
|
|
8
11
|
type: "rich-text-child",
|
|
9
12
|
label: "Bold Text",
|
|
10
13
|
Icon: BoldIcon,
|
|
14
|
+
states: defaultStates,
|
|
11
15
|
presetStyle
|
|
12
16
|
};
|
|
13
17
|
const propsMeta = {
|
package/lib/components/box.ws.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { BoxIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/box.props";
|
|
3
6
|
import {
|
|
4
7
|
div,
|
|
@@ -29,6 +32,7 @@ const meta = {
|
|
|
29
32
|
type: "container",
|
|
30
33
|
label: "Box",
|
|
31
34
|
Icon: BoxIcon,
|
|
35
|
+
states: defaultStates,
|
|
32
36
|
presetStyle
|
|
33
37
|
};
|
|
34
38
|
const propsMeta = {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ButtonElementIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { button } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/button.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
button
|
|
@@ -11,7 +14,7 @@ const meta = {
|
|
|
11
14
|
Icon: ButtonElementIcon,
|
|
12
15
|
presetStyle,
|
|
13
16
|
states: [
|
|
14
|
-
|
|
17
|
+
...defaultStates,
|
|
15
18
|
{ selector: ":disabled", label: "Disabled" },
|
|
16
19
|
{ selector: ":enabled", label: "Enabled" }
|
|
17
20
|
]
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CheckboxCheckedIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/checkbox-field.props";
|
|
3
6
|
import { label } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -12,6 +15,7 @@ const meta = {
|
|
|
12
15
|
type: "container",
|
|
13
16
|
label: "Checkbox Field",
|
|
14
17
|
Icon: CheckboxCheckedIcon,
|
|
18
|
+
states: defaultStates,
|
|
15
19
|
presetStyle,
|
|
16
20
|
children: [
|
|
17
21
|
{ type: "instance", component: "Checkbox", props: [], children: [] },
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CheckboxCheckedIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { input } from "../css/normalize";
|
|
3
6
|
import { props } from "./__generated__/checkbox.props";
|
|
4
7
|
const presetStyle = {
|
|
@@ -16,6 +19,7 @@ const meta = {
|
|
|
16
19
|
Icon: CheckboxCheckedIcon,
|
|
17
20
|
presetStyle,
|
|
18
21
|
states: [
|
|
22
|
+
...defaultStates,
|
|
19
23
|
{ selector: ":checked", label: "Checked" },
|
|
20
24
|
{ selector: ":required", label: "Required" },
|
|
21
25
|
{ selector: ":optional", label: "Optional" },
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CodeIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { displayVarNamespace } from "./code";
|
|
3
6
|
import { props } from "./__generated__/code.props";
|
|
4
7
|
import { code } from "../css/normalize";
|
|
@@ -32,6 +35,7 @@ const meta = {
|
|
|
32
35
|
type: "rich-text",
|
|
33
36
|
label: "Code",
|
|
34
37
|
Icon: CodeIcon,
|
|
38
|
+
states: defaultStates,
|
|
35
39
|
presetStyle,
|
|
36
40
|
children: [{ type: "text", value: "Code you can edit" }]
|
|
37
41
|
};
|
|
@@ -11,10 +11,19 @@ const componentCategories = [
|
|
|
11
11
|
"media",
|
|
12
12
|
"forms"
|
|
13
13
|
];
|
|
14
|
+
const stateCategories = ["states", "component-states"];
|
|
14
15
|
const ComponentState = z.object({
|
|
16
|
+
category: z.enum(stateCategories).optional(),
|
|
15
17
|
selector: z.string(),
|
|
16
18
|
label: z.string()
|
|
17
19
|
});
|
|
20
|
+
const defaultStates = [
|
|
21
|
+
{ selector: ":hover", label: "Hover" },
|
|
22
|
+
{ selector: ":active", label: "Active" },
|
|
23
|
+
{ selector: ":focus", label: "Focus" },
|
|
24
|
+
{ selector: ":focus-visible", label: "Focus Visible" },
|
|
25
|
+
{ selector: ":focus-within", label: "Focus Within" }
|
|
26
|
+
];
|
|
18
27
|
const WsComponentMeta = z.object({
|
|
19
28
|
category: z.enum(componentCategories).optional(),
|
|
20
29
|
// container - can accept other components with dnd
|
|
@@ -38,5 +47,7 @@ const WsComponentMeta = z.object({
|
|
|
38
47
|
});
|
|
39
48
|
export {
|
|
40
49
|
ComponentState,
|
|
41
|
-
componentCategories
|
|
50
|
+
componentCategories,
|
|
51
|
+
defaultStates,
|
|
52
|
+
stateCategories
|
|
42
53
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
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: [
|
|
@@ -12,6 +15,7 @@ const meta = {
|
|
|
12
15
|
type: "container",
|
|
13
16
|
label: "Form",
|
|
14
17
|
Icon: FormIcon,
|
|
18
|
+
states: defaultStates,
|
|
15
19
|
presetStyle,
|
|
16
20
|
children: [
|
|
17
21
|
{
|
|
@@ -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 = {
|
|
@@ -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
|
|
@@ -11,6 +14,7 @@ const meta = {
|
|
|
11
14
|
Icon: FormTextFieldIcon,
|
|
12
15
|
presetStyle,
|
|
13
16
|
states: [
|
|
17
|
+
...defaultStates,
|
|
14
18
|
{ selector: "::placeholder", label: "Placeholder" },
|
|
15
19
|
{ selector: ":valid", label: "Valid" },
|
|
16
20
|
{ selector: ":invalid", label: "Invalid" },
|
|
@@ -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 = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TextBlockIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/label.props";
|
|
3
6
|
import { label } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -12,6 +15,7 @@ const meta = {
|
|
|
12
15
|
type: "rich-text",
|
|
13
16
|
label: "Input Label",
|
|
14
17
|
Icon: TextBlockIcon,
|
|
18
|
+
states: defaultStates,
|
|
15
19
|
presetStyle,
|
|
16
20
|
children: [{ type: "text", value: "Form Label" }]
|
|
17
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
|
|
@@ -11,6 +14,7 @@ const meta = {
|
|
|
11
14
|
label: "List Item",
|
|
12
15
|
Icon: ListItemIcon,
|
|
13
16
|
children: [{ type: "text", value: "List Item you can edit" }],
|
|
17
|
+
states: defaultStates,
|
|
14
18
|
presetStyle
|
|
15
19
|
};
|
|
16
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 = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { RadioCheckedIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/radio-button-field.props";
|
|
3
6
|
import { label } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -12,6 +15,7 @@ const meta = {
|
|
|
12
15
|
type: "container",
|
|
13
16
|
label: "Radio Button Field",
|
|
14
17
|
Icon: RadioCheckedIcon,
|
|
18
|
+
states: defaultStates,
|
|
15
19
|
presetStyle,
|
|
16
20
|
children: [
|
|
17
21
|
{ type: "instance", component: "RadioButton", props: [], children: [] },
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { RadioCheckedIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { input } from "../css/normalize";
|
|
3
6
|
import { props } from "./__generated__/radio-button.props";
|
|
4
7
|
const presetStyle = {
|
|
@@ -16,6 +19,7 @@ const meta = {
|
|
|
16
19
|
Icon: RadioCheckedIcon,
|
|
17
20
|
presetStyle,
|
|
18
21
|
states: [
|
|
22
|
+
...defaultStates,
|
|
19
23
|
{ selector: ":checked", label: "Checked" },
|
|
20
24
|
{ selector: ":required", label: "Required" },
|
|
21
25
|
{ selector: ":optional", label: "Optional" },
|
|
@@ -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 = {
|
|
@@ -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 = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TextBlockIcon } from "@webstudio-is/icons";
|
|
2
|
+
import {
|
|
3
|
+
defaultStates
|
|
4
|
+
} from "./component-meta";
|
|
2
5
|
import { props } from "./__generated__/text-block.props";
|
|
3
6
|
import { div } from "../css/normalize";
|
|
4
7
|
const presetStyle = {
|
|
@@ -15,6 +18,7 @@ const meta = {
|
|
|
15
18
|
type: "rich-text",
|
|
16
19
|
label: "Text Block",
|
|
17
20
|
Icon: TextBlockIcon,
|
|
21
|
+
states: defaultStates,
|
|
18
22
|
presetStyle,
|
|
19
23
|
children: [{ type: "text", value: "Block of text you can edit" }]
|
|
20
24
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { FormTextAreaIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { textarea } from "../css/normalize";
|
|
3
|
+
import {
|
|
4
|
+
defaultStates
|
|
5
|
+
} from "./component-meta";
|
|
3
6
|
import { props } from "./__generated__/textarea.props";
|
|
4
7
|
const presetStyle = {
|
|
5
8
|
textarea: [
|
|
@@ -15,6 +18,7 @@ const meta = {
|
|
|
15
18
|
Icon: FormTextAreaIcon,
|
|
16
19
|
presetStyle,
|
|
17
20
|
states: [
|
|
21
|
+
...defaultStates,
|
|
18
22
|
{ selector: "::placeholder", label: "Placeholder" },
|
|
19
23
|
{ selector: ":valid", label: "Valid" },
|
|
20
24
|
{ selector: ":invalid", label: "Invalid" },
|
package/lib/index.js
CHANGED
|
@@ -11,12 +11,14 @@ import {
|
|
|
11
11
|
customComponentPropsMetas
|
|
12
12
|
} from "./app/custom-components";
|
|
13
13
|
import {
|
|
14
|
-
componentCategories
|
|
14
|
+
componentCategories,
|
|
15
|
+
stateCategories
|
|
15
16
|
} from "./components/component-meta";
|
|
16
17
|
export * from "./embed-template";
|
|
17
18
|
export {
|
|
18
19
|
componentCategories,
|
|
19
20
|
customComponentMetas,
|
|
20
21
|
customComponentPropsMetas,
|
|
21
|
-
customComponents
|
|
22
|
+
customComponents,
|
|
23
|
+
stateCategories
|
|
22
24
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const defaultTag = "form";
|
|
3
|
-
export declare const Form: import("react").ForwardRefExoticComponent<Omit<import("react").
|
|
3
|
+
export declare const Form: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "action" | "method"> & {
|
|
4
4
|
initialState?: "error" | "initial" | "success" | undefined;
|
|
5
5
|
}, "ref"> & import("react").RefAttributes<HTMLFormElement>>;
|
|
@@ -21,7 +21,7 @@ export declare const customComponents: {
|
|
|
21
21
|
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
22
22
|
prefetch?: "none" | "intent" | "render" | undefined;
|
|
23
23
|
}, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
24
|
-
Form: import("react").ForwardRefExoticComponent<Omit<import("react").
|
|
24
|
+
Form: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "action" | "method"> & {
|
|
25
25
|
initialState?: "error" | "initial" | "success" | undefined;
|
|
26
26
|
}, "ref"> & import("react").RefAttributes<HTMLFormElement>>;
|
|
27
27
|
};
|
|
@@ -581,17 +581,22 @@ declare const WsComponentPropsMeta: z.ZodObject<{
|
|
|
581
581
|
}>;
|
|
582
582
|
export type WsComponentPropsMeta = z.infer<typeof WsComponentPropsMeta>;
|
|
583
583
|
export declare const componentCategories: readonly ["general", "typography", "media", "forms"];
|
|
584
|
+
export declare const stateCategories: readonly ["states", "component-states"];
|
|
584
585
|
export declare const ComponentState: z.ZodObject<{
|
|
586
|
+
category: z.ZodOptional<z.ZodEnum<["states", "component-states"]>>;
|
|
585
587
|
selector: z.ZodString;
|
|
586
588
|
label: z.ZodString;
|
|
587
589
|
}, "strip", z.ZodTypeAny, {
|
|
590
|
+
category?: "states" | "component-states" | undefined;
|
|
588
591
|
label: string;
|
|
589
592
|
selector: string;
|
|
590
593
|
}, {
|
|
594
|
+
category?: "states" | "component-states" | undefined;
|
|
591
595
|
label: string;
|
|
592
596
|
selector: string;
|
|
593
597
|
}>;
|
|
594
598
|
export type ComponentState = z.infer<typeof ComponentState>;
|
|
599
|
+
export declare const defaultStates: ComponentState[];
|
|
595
600
|
declare const WsComponentMeta: z.ZodObject<{
|
|
596
601
|
category: z.ZodOptional<z.ZodEnum<["general", "typography", "media", "forms"]>>;
|
|
597
602
|
type: z.ZodEnum<["container", "control", "embed", "rich-text", "rich-text-child"]>;
|
|
@@ -600,12 +605,15 @@ declare const WsComponentMeta: z.ZodObject<{
|
|
|
600
605
|
Icon: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
601
606
|
presetStyle: z.ZodOptional<z.ZodAny>;
|
|
602
607
|
states: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
608
|
+
category: z.ZodOptional<z.ZodEnum<["states", "component-states"]>>;
|
|
603
609
|
selector: z.ZodString;
|
|
604
610
|
label: z.ZodString;
|
|
605
611
|
}, "strip", z.ZodTypeAny, {
|
|
612
|
+
category?: "states" | "component-states" | undefined;
|
|
606
613
|
label: string;
|
|
607
614
|
selector: string;
|
|
608
615
|
}, {
|
|
616
|
+
category?: "states" | "component-states" | undefined;
|
|
609
617
|
label: string;
|
|
610
618
|
selector: string;
|
|
611
619
|
}>, "many">>;
|
|
@@ -624,13 +632,14 @@ declare const WsComponentMeta: z.ZodObject<{
|
|
|
624
632
|
type: "text";
|
|
625
633
|
value: string;
|
|
626
634
|
} | import("../embed-template").EmbedTemplateInstance)[] | undefined;
|
|
627
|
-
category?: "media" | "general" | "typography" | "forms" | undefined;
|
|
628
|
-
acceptedParents?: string[] | undefined;
|
|
629
|
-
presetStyle?: any;
|
|
630
635
|
states?: {
|
|
636
|
+
category?: "states" | "component-states" | undefined;
|
|
631
637
|
label: string;
|
|
632
638
|
selector: string;
|
|
633
639
|
}[] | undefined;
|
|
640
|
+
category?: "media" | "general" | "typography" | "forms" | undefined;
|
|
641
|
+
acceptedParents?: string[] | undefined;
|
|
642
|
+
presetStyle?: any;
|
|
634
643
|
type: "embed" | "control" | "container" | "rich-text" | "rich-text-child";
|
|
635
644
|
label: string;
|
|
636
645
|
Icon: (...args: unknown[]) => unknown;
|
|
@@ -639,13 +648,14 @@ declare const WsComponentMeta: z.ZodObject<{
|
|
|
639
648
|
type: "text";
|
|
640
649
|
value: string;
|
|
641
650
|
} | import("../embed-template").EmbedTemplateInstance)[] | undefined;
|
|
642
|
-
category?: "media" | "general" | "typography" | "forms" | undefined;
|
|
643
|
-
acceptedParents?: string[] | undefined;
|
|
644
|
-
presetStyle?: any;
|
|
645
651
|
states?: {
|
|
652
|
+
category?: "states" | "component-states" | undefined;
|
|
646
653
|
label: string;
|
|
647
654
|
selector: string;
|
|
648
655
|
}[] | undefined;
|
|
656
|
+
category?: "media" | "general" | "typography" | "forms" | undefined;
|
|
657
|
+
acceptedParents?: string[] | undefined;
|
|
658
|
+
presetStyle?: any;
|
|
649
659
|
type: "embed" | "control" | "container" | "rich-text" | "rich-text-child";
|
|
650
660
|
label: string;
|
|
651
661
|
Icon: (...args: unknown[]) => unknown;
|