@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/html-embed.ws.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { EmbedIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import { props } from "./__generated__/html-embed.props";
|
|
4
|
-
export const meta = {
|
|
5
|
-
category: "general",
|
|
6
|
-
type: "embed",
|
|
7
|
-
label: "HTML Embed",
|
|
8
|
-
description: "Used to add HTML code to the page, such as an SVG or script.",
|
|
9
|
-
icon: EmbedIcon,
|
|
10
|
-
stylable: false,
|
|
11
|
-
order: 7
|
|
12
|
-
};
|
|
13
|
-
export const propsMeta = {
|
|
14
|
-
props: {
|
|
15
|
-
...props,
|
|
16
|
-
executeScriptOnCanvas: {
|
|
17
|
-
...props.executeScriptOnCanvas,
|
|
18
|
-
label: "Run script on canvas"
|
|
19
|
-
},
|
|
20
|
-
code: {
|
|
21
|
-
required: true,
|
|
22
|
-
control: "code",
|
|
23
|
-
type: "string",
|
|
24
|
-
rows: 10
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
initialProps: []
|
|
28
|
-
};
|
package/lib/image.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
forwardRef,
|
|
5
|
-
useMemo,
|
|
6
|
-
useContext
|
|
7
|
-
} from "react";
|
|
8
|
-
import {
|
|
9
|
-
Image as WebstudioImage,
|
|
10
|
-
createImageLoader
|
|
11
|
-
} from "@webstudio-is/image";
|
|
12
|
-
import {
|
|
13
|
-
usePropAsset,
|
|
14
|
-
getInstanceIdFromComponentProps,
|
|
15
|
-
ReactSdkContext
|
|
16
|
-
} from "@webstudio-is/react-sdk";
|
|
17
|
-
export const defaultTag = "img";
|
|
18
|
-
const imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
|
|
19
|
-
width="140"
|
|
20
|
-
height="140"
|
|
21
|
-
viewBox="0 0 600 600"
|
|
22
|
-
fill="none"
|
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
-
>
|
|
25
|
-
<rect width="600" height="600" fill="#CCCCCC" />
|
|
26
|
-
<path
|
|
27
|
-
fill-rule="evenodd"
|
|
28
|
-
clip-rule="evenodd"
|
|
29
|
-
d="M450 170H150C141.716 170 135 176.716 135 185V415C135 423.284 141.716 430 150 430H450C458.284 430 465 423.284 465 415V185C465 176.716 458.284 170 450 170ZM150 145C127.909 145 110 162.909 110 185V415C110 437.091 127.909 455 150 455H450C472.091 455 490 437.091 490 415V185C490 162.909 472.091 145 450 145H150Z"
|
|
30
|
-
fill="#A2A2A2"
|
|
31
|
-
/>
|
|
32
|
-
<path
|
|
33
|
-
d="M237.135 235.012C237.135 255.723 220.345 272.512 199.635 272.512C178.924 272.512 162.135 255.723 162.135 235.012C162.135 214.301 178.924 197.512 199.635 197.512C220.345 197.512 237.135 214.301 237.135 235.012Z"
|
|
34
|
-
fill="#A2A2A2"
|
|
35
|
-
/>
|
|
36
|
-
<path
|
|
37
|
-
d="M160 405V367.205L221.609 306.364L256.552 338.628L358.161 234L440 316.043V405H160Z"
|
|
38
|
-
fill="#A2A2A2"
|
|
39
|
-
/>
|
|
40
|
-
</svg>`)}`;
|
|
41
|
-
export const Image = forwardRef(
|
|
42
|
-
({ loading = "lazy", ...props }, ref) => {
|
|
43
|
-
const { imageBaseUrl } = useContext(ReactSdkContext);
|
|
44
|
-
const asset = usePropAsset(getInstanceIdFromComponentProps(props), "src");
|
|
45
|
-
const loader = useMemo(() => {
|
|
46
|
-
return createImageLoader({ imageBaseUrl });
|
|
47
|
-
}, [imageBaseUrl]);
|
|
48
|
-
const src = asset?.name ?? props.src;
|
|
49
|
-
if (asset == null || loader == null) {
|
|
50
|
-
return /* @__PURE__ */ jsx(
|
|
51
|
-
"img",
|
|
52
|
-
{
|
|
53
|
-
loading,
|
|
54
|
-
...props,
|
|
55
|
-
src: src || imagePlaceholderSvg,
|
|
56
|
-
ref
|
|
57
|
-
},
|
|
58
|
-
src
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
return /* @__PURE__ */ jsx(
|
|
62
|
-
WebstudioImage,
|
|
63
|
-
{
|
|
64
|
-
loading,
|
|
65
|
-
...props,
|
|
66
|
-
loader,
|
|
67
|
-
src,
|
|
68
|
-
ref
|
|
69
|
-
},
|
|
70
|
-
src
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
Image.displayName = "Image";
|
package/lib/image.stories.js
DELETED
package/lib/image.ws.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { ImageIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { img } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/image.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
img: [
|
|
10
|
-
...img,
|
|
11
|
-
// Otherwise on new image insert onto canvas it can overfit screen size multiple times
|
|
12
|
-
{
|
|
13
|
-
property: "maxWidth",
|
|
14
|
-
value: { type: "unit", unit: "%", value: 100 }
|
|
15
|
-
},
|
|
16
|
-
// inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
|
|
17
|
-
// see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
|
|
18
|
-
{
|
|
19
|
-
property: "display",
|
|
20
|
-
value: { type: "keyword", value: "block" }
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
};
|
|
24
|
-
export const meta = {
|
|
25
|
-
category: "media",
|
|
26
|
-
type: "embed",
|
|
27
|
-
label: "Image",
|
|
28
|
-
description: "Add an image asset to the page. Webstudio automatically converts images to WebP or AVIF format and makes them responsive for best performance.",
|
|
29
|
-
icon: ImageIcon,
|
|
30
|
-
states: defaultStates,
|
|
31
|
-
presetStyle,
|
|
32
|
-
order: 0
|
|
33
|
-
};
|
|
34
|
-
export const propsOverrides = {
|
|
35
|
-
src: {
|
|
36
|
-
type: "string",
|
|
37
|
-
control: "file",
|
|
38
|
-
label: "Source",
|
|
39
|
-
required: false
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
export const propsMeta = {
|
|
43
|
-
props: {
|
|
44
|
-
...props,
|
|
45
|
-
...propsOverrides
|
|
46
|
-
},
|
|
47
|
-
initialProps: ["id", "src", "width", "height", "alt", "loading"]
|
|
48
|
-
};
|
package/lib/input.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 Input = forwardRef(({ children: _children, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, ref }));
|
|
6
|
-
Input.displayName = "Input";
|
package/lib/input.stories.js
DELETED
package/lib/input.ws.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { FormTextFieldIcon } 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__/input.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
input: [
|
|
10
|
-
...input,
|
|
11
|
-
{
|
|
12
|
-
property: "display",
|
|
13
|
-
value: { type: "keyword", value: "block" }
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
};
|
|
17
|
-
export const meta = {
|
|
18
|
-
category: "forms",
|
|
19
|
-
invalidAncestors: ["Button"],
|
|
20
|
-
type: "control",
|
|
21
|
-
label: "Text Input",
|
|
22
|
-
description: "A single-line text input for collecting string data from your users.",
|
|
23
|
-
icon: FormTextFieldIcon,
|
|
24
|
-
presetStyle,
|
|
25
|
-
order: 3,
|
|
26
|
-
states: [
|
|
27
|
-
...defaultStates,
|
|
28
|
-
{ selector: "::placeholder", label: "Placeholder" },
|
|
29
|
-
{ selector: ":valid", label: "Valid" },
|
|
30
|
-
{ selector: ":invalid", label: "Invalid" },
|
|
31
|
-
{ selector: ":required", label: "Required" },
|
|
32
|
-
{ selector: ":optional", label: "Optional" }
|
|
33
|
-
// Additional states will go into submenu
|
|
34
|
-
//{ selector: ":disabled", label: "Disabled" },
|
|
35
|
-
//{ selector: ":enabled", label: "Enabled" },
|
|
36
|
-
//{ selector: ":read-only", label: "Read Only" },
|
|
37
|
-
//{ selector: ":read-write", label: "Read Write" },
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
export const propsMeta = {
|
|
41
|
-
props,
|
|
42
|
-
initialProps: ["id", "name", "type", "placeholder", "required", "autoFocus"]
|
|
43
|
-
};
|
package/lib/italic.js
DELETED
package/lib/italic.stories.js
DELETED
package/lib/italic.ws.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { TextItalicIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { i } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/italic.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
i: [
|
|
10
|
-
...i,
|
|
11
|
-
{
|
|
12
|
-
property: "fontStyle",
|
|
13
|
-
value: { type: "keyword", value: "italic" }
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
};
|
|
17
|
-
export const meta = {
|
|
18
|
-
type: "rich-text-child",
|
|
19
|
-
label: "Italic Text",
|
|
20
|
-
icon: TextItalicIcon,
|
|
21
|
-
states: defaultStates,
|
|
22
|
-
presetStyle
|
|
23
|
-
};
|
|
24
|
-
export const propsMeta = {
|
|
25
|
-
props,
|
|
26
|
-
initialProps: ["id"]
|
|
27
|
-
};
|
package/lib/label.js
DELETED
package/lib/label.ws.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { LabelIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { label } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/label.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
label: [
|
|
10
|
-
...label,
|
|
11
|
-
{ property: "display", value: { type: "keyword", value: "block" } }
|
|
12
|
-
]
|
|
13
|
-
};
|
|
14
|
-
export const meta = {
|
|
15
|
-
category: "forms",
|
|
16
|
-
invalidAncestors: ["Button", "Label"],
|
|
17
|
-
type: "container",
|
|
18
|
-
label: "Input Label",
|
|
19
|
-
icon: LabelIcon,
|
|
20
|
-
states: defaultStates,
|
|
21
|
-
presetStyle,
|
|
22
|
-
order: 2,
|
|
23
|
-
template: [
|
|
24
|
-
{
|
|
25
|
-
type: "instance",
|
|
26
|
-
component: "Label",
|
|
27
|
-
children: [{ type: "text", value: "Form Label" }]
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
};
|
|
31
|
-
export const propsMeta = {
|
|
32
|
-
props: {
|
|
33
|
-
...props,
|
|
34
|
-
htmlFor: {
|
|
35
|
-
...props.htmlFor,
|
|
36
|
-
label: "For"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
initialProps: ["id", "htmlFor"]
|
|
40
|
-
};
|
package/lib/link.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useContext } from "react";
|
|
4
|
-
import {
|
|
5
|
-
usePropUrl,
|
|
6
|
-
getInstanceIdFromComponentProps,
|
|
7
|
-
ReactSdkContext
|
|
8
|
-
} from "@webstudio-is/react-sdk";
|
|
9
|
-
export const defaultTag = "a";
|
|
10
|
-
export const Link = forwardRef((props, ref) => {
|
|
11
|
-
const { assetBaseUrl } = useContext(ReactSdkContext);
|
|
12
|
-
const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
|
|
13
|
-
let url = "#";
|
|
14
|
-
switch (href?.type) {
|
|
15
|
-
case "page": {
|
|
16
|
-
url = href.page.path === "" ? "/" : href.page.path;
|
|
17
|
-
const urlTo = new URL(url, "https://any-valid.url");
|
|
18
|
-
url = urlTo.pathname;
|
|
19
|
-
if (href.hash !== void 0) {
|
|
20
|
-
urlTo.hash = encodeURIComponent(href.hash);
|
|
21
|
-
url = `${urlTo.pathname}${urlTo.hash}`;
|
|
22
|
-
}
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
case "asset":
|
|
26
|
-
url = `${assetBaseUrl}${href.asset.name}`;
|
|
27
|
-
break;
|
|
28
|
-
case "string":
|
|
29
|
-
url = href.url;
|
|
30
|
-
}
|
|
31
|
-
return /* @__PURE__ */ jsx("a", { ...props, href: url, ref });
|
|
32
|
-
});
|
|
33
|
-
Link.displayName = "Link";
|
package/lib/link.stories.js
DELETED
package/lib/link.ws.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { LinkIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { a } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/link.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
a: [
|
|
10
|
-
...a,
|
|
11
|
-
{
|
|
12
|
-
property: "minHeight",
|
|
13
|
-
value: { type: "unit", unit: "em", value: 1 }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
property: "display",
|
|
17
|
-
value: { type: "keyword", value: "inline-block" }
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
};
|
|
21
|
-
export const meta = {
|
|
22
|
-
category: "general",
|
|
23
|
-
type: "container",
|
|
24
|
-
label: "Link",
|
|
25
|
-
description: "Use a link to send your users to another page, section, or resource. Configure links in the Settings panel.",
|
|
26
|
-
icon: LinkIcon,
|
|
27
|
-
invalidAncestors: ["Link"],
|
|
28
|
-
presetStyle,
|
|
29
|
-
order: 1,
|
|
30
|
-
states: [
|
|
31
|
-
...defaultStates,
|
|
32
|
-
{
|
|
33
|
-
selector: ":visited",
|
|
34
|
-
label: "Visited"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
category: "component-states",
|
|
38
|
-
selector: "[aria-current=page]",
|
|
39
|
-
label: "Current page"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
template: [
|
|
43
|
-
{
|
|
44
|
-
type: "instance",
|
|
45
|
-
component: "Link",
|
|
46
|
-
children: [{ type: "text", value: "Link text you can edit" }]
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
};
|
|
50
|
-
export const propsMeta = {
|
|
51
|
-
props: {
|
|
52
|
-
...props,
|
|
53
|
-
href: {
|
|
54
|
-
type: "string",
|
|
55
|
-
control: "url",
|
|
56
|
-
required: false
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
initialProps: ["id", "href", "target"]
|
|
60
|
-
};
|
package/lib/list-item.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
createElement
|
|
5
|
-
} from "react";
|
|
6
|
-
export const defaultTag = "li";
|
|
7
|
-
export const ListItem = forwardRef(
|
|
8
|
-
(props, ref) => {
|
|
9
|
-
return createElement(defaultTag, { ...props, ref });
|
|
10
|
-
}
|
|
11
|
-
);
|
|
12
|
-
ListItem.displayName = "ListItem";
|
package/lib/list-item.stories.js
DELETED
package/lib/list-item.ws.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { ListItemIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { li } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/list-item.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
li
|
|
10
|
-
};
|
|
11
|
-
export const meta = {
|
|
12
|
-
category: "general",
|
|
13
|
-
type: "container",
|
|
14
|
-
requiredAncestors: ["List"],
|
|
15
|
-
label: "List Item",
|
|
16
|
-
description: "Adds a new item to an existing list.",
|
|
17
|
-
icon: ListItemIcon,
|
|
18
|
-
states: defaultStates,
|
|
19
|
-
presetStyle,
|
|
20
|
-
template: [
|
|
21
|
-
{
|
|
22
|
-
type: "instance",
|
|
23
|
-
component: "ListItem",
|
|
24
|
-
children: [{ type: "text", value: "List Item you can edit" }]
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
order: 4
|
|
28
|
-
};
|
|
29
|
-
export const propsMeta = {
|
|
30
|
-
props,
|
|
31
|
-
initialProps: ["id"]
|
|
32
|
-
};
|
package/lib/list.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
createElement
|
|
5
|
-
} from "react";
|
|
6
|
-
const unorderedTag = "ul";
|
|
7
|
-
const orderedTag = "ol";
|
|
8
|
-
export const List = forwardRef(({ ordered = false, ...props }, ref) => {
|
|
9
|
-
const tag = ordered ? orderedTag : unorderedTag;
|
|
10
|
-
return createElement(tag, { ...props, ref });
|
|
11
|
-
});
|
|
12
|
-
List.displayName = "List";
|
package/lib/list.stories.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { List as ListPrimitive } from "./list";
|
|
4
|
-
import { ListItem } from "./list-item";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Components/List",
|
|
7
|
-
component: ListPrimitive
|
|
8
|
-
};
|
|
9
|
-
export const List = {
|
|
10
|
-
args: {
|
|
11
|
-
children: /* @__PURE__ */ jsx(ListItem, { children: "List" })
|
|
12
|
-
}
|
|
13
|
-
};
|
package/lib/list.ws.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { ListIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { ol, ul } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/list.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
ol: [
|
|
10
|
-
...ol,
|
|
11
|
-
{
|
|
12
|
-
property: "marginTop",
|
|
13
|
-
value: { type: "keyword", value: "0" }
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
property: "marginBottom",
|
|
17
|
-
value: { type: "keyword", value: "10px" }
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
property: "paddingLeft",
|
|
21
|
-
value: { type: "keyword", value: "40px" }
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
ul: [
|
|
25
|
-
...ul,
|
|
26
|
-
{
|
|
27
|
-
property: "marginTop",
|
|
28
|
-
value: { type: "keyword", value: "0" }
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
property: "marginBottom",
|
|
32
|
-
value: { type: "keyword", value: "10px" }
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
property: "paddingLeft",
|
|
36
|
-
value: { type: "keyword", value: "40px" }
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
export const meta = {
|
|
41
|
-
category: "general",
|
|
42
|
-
type: "container",
|
|
43
|
-
label: "List",
|
|
44
|
-
description: "Groups content, like links in a menu or steps in a recipe.",
|
|
45
|
-
icon: ListIcon,
|
|
46
|
-
states: defaultStates,
|
|
47
|
-
presetStyle,
|
|
48
|
-
order: 3
|
|
49
|
-
};
|
|
50
|
-
export const propsMeta = {
|
|
51
|
-
props,
|
|
52
|
-
initialProps: ["id", "ordered", "start", "reversed"]
|
|
53
|
-
};
|
package/lib/paragraph.js
DELETED
package/lib/paragraph.stories.js
DELETED
package/lib/paragraph.ws.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { TextAlignLeftIcon } from "@webstudio-is/icons/svg";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { p } from "@webstudio-is/react-sdk/css-normalize";
|
|
7
|
-
import { props } from "./__generated__/paragraph.props";
|
|
8
|
-
const presetStyle = {
|
|
9
|
-
p
|
|
10
|
-
};
|
|
11
|
-
export const meta = {
|
|
12
|
-
category: "text",
|
|
13
|
-
type: "container",
|
|
14
|
-
label: "Paragraph",
|
|
15
|
-
description: "A container for multi-line text.",
|
|
16
|
-
icon: TextAlignLeftIcon,
|
|
17
|
-
invalidAncestors: ["Paragraph"],
|
|
18
|
-
states: defaultStates,
|
|
19
|
-
presetStyle,
|
|
20
|
-
template: [
|
|
21
|
-
{
|
|
22
|
-
type: "instance",
|
|
23
|
-
component: "Paragraph",
|
|
24
|
-
children: [{ type: "text", value: "Paragraph you can edit" }]
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
order: 2
|
|
28
|
-
};
|
|
29
|
-
export const propsMeta = {
|
|
30
|
-
props,
|
|
31
|
-
initialProps: ["id"]
|
|
32
|
-
};
|
package/lib/radio-button.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 RadioButton = forwardRef(({ children: _children, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, type: "radio", ref }));
|
|
6
|
-
RadioButton.displayName = "RadioButton";
|