@webstudio-is/sdk-components-react 0.72.0 → 0.74.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/__generated__/button.props.js +0 -6
- package/lib/__generated__/image.props.js +0 -1
- package/lib/__generated__/vimeo-play-button.props.js +1 -2
- package/lib/__generated__/vimeo-preview-image.props.js +0 -1
- package/lib/blockquote.ws.js +1 -1
- package/lib/button.js +1 -6
- package/lib/button.ws.js +9 -2
- package/lib/checkbox.ws.js +19 -1
- package/lib/cjs/__generated__/button.props.js +0 -6
- package/lib/cjs/__generated__/image.props.js +0 -1
- package/lib/cjs/__generated__/{text-block.props.js → text.props.js} +3 -3
- package/lib/cjs/__generated__/vimeo-play-button.props.js +1 -2
- package/lib/cjs/__generated__/vimeo-preview-image.props.js +0 -1
- package/lib/cjs/blockquote.ws.js +1 -1
- package/lib/cjs/button.js +1 -6
- package/lib/cjs/button.ws.js +9 -2
- package/lib/cjs/checkbox.ws.js +19 -1
- package/lib/cjs/code-text.ws.js +1 -1
- package/lib/cjs/components.js +2 -8
- package/lib/cjs/heading.ws.js +1 -1
- package/lib/cjs/image.js +3 -3
- package/lib/cjs/image.ws.js +1 -2
- package/lib/cjs/label.ws.js +3 -6
- package/lib/cjs/link.js +1 -1
- package/lib/cjs/link.ws.js +2 -2
- package/lib/cjs/list-item.ws.js +1 -1
- package/lib/cjs/metas.js +2 -8
- package/lib/cjs/paragraph.ws.js +2 -2
- package/lib/cjs/props.js +2 -8
- package/lib/cjs/radio-button.ws.js +19 -1
- package/lib/cjs/span.ws.js +1 -1
- package/lib/cjs/{text-block.js → text.js} +6 -6
- package/lib/cjs/{text-block.ws.js → text.ws.js} +10 -10
- package/lib/cjs/vimeo.ws.js +6 -1
- package/lib/code-text.ws.js +1 -1
- package/lib/components.js +2 -8
- package/lib/heading.ws.js +1 -1
- package/lib/image.js +6 -5
- package/lib/image.ws.js +1 -2
- package/lib/label.ws.js +4 -7
- package/lib/link.js +3 -3
- package/lib/link.ws.js +2 -2
- package/lib/list-item.ws.js +1 -1
- package/lib/metas.js +52 -58
- package/lib/paragraph.ws.js +2 -2
- package/lib/props.js +52 -58
- package/lib/radio-button.ws.js +19 -1
- package/lib/span.ws.js +1 -1
- package/lib/{text-block.js → text.js} +3 -3
- package/lib/{text-block.ws.js → text.ws.js} +7 -7
- package/lib/types/button.d.ts +2 -6
- package/lib/types/button.stories.d.ts +2 -6
- package/lib/types/components.d.ts +1 -4
- package/lib/types/image.d.ts +5 -6
- package/lib/types/image.stories.d.ts +555 -6
- package/lib/types/metas.d.ts +1 -4
- package/lib/types/props.d.ts +1 -4
- package/lib/types/{text-block.d.ts → text.d.ts} +1 -1
- package/lib/types/{text-block.stories.d.ts → text.stories.d.ts} +1 -1
- package/lib/types/vimeo-play-button.d.ts +1 -3
- package/lib/types/vimeo-play-button.stories.d.ts +2 -6
- package/lib/types/vimeo-preview-image.d.ts +278 -3
- package/lib/types/vimeo-preview-image.stories.d.ts +555 -6
- package/lib/vimeo.ws.js +6 -1
- package/package.json +7 -7
- package/src/__generated__/button.props.ts +0 -6
- package/src/__generated__/image.props.ts +0 -1
- package/src/__generated__/vimeo-play-button.props.ts +0 -1
- package/src/__generated__/vimeo-preview-image.props.ts +0 -1
- package/src/blockquote.ws.tsx +1 -1
- package/src/button.tsx +3 -11
- package/src/button.ws.tsx +8 -1
- package/src/checkbox.ws.tsx +19 -1
- package/src/code-text.ws.tsx +1 -1
- package/src/components.ts +1 -4
- package/src/heading.ws.tsx +1 -1
- package/src/image.tsx +6 -5
- package/src/image.ws.tsx +1 -4
- package/src/label.ws.tsx +4 -7
- package/src/link.tsx +3 -4
- package/src/link.ws.tsx +2 -2
- package/src/list-item.ws.tsx +1 -1
- package/src/metas.ts +1 -4
- package/src/paragraph.ws.tsx +2 -2
- package/src/props.ts +1 -4
- package/src/radio-button.ws.tsx +19 -1
- package/src/span.ws.tsx +1 -1
- package/src/text.stories.tsx +16 -0
- package/src/{text-block.tsx → text.tsx} +2 -2
- package/src/{text-block.ws.tsx → text.ws.tsx} +8 -8
- package/src/vimeo.ws.ts +6 -1
- package/lib/__generated__/checkbox-field.props.js +0 -399
- package/lib/__generated__/radio-button-field.props.js +0 -399
- package/lib/checkbox-field.js +0 -9
- package/lib/checkbox-field.ws.js +0 -44
- package/lib/cjs/__generated__/checkbox-field.props.js +0 -419
- package/lib/cjs/__generated__/radio-button-field.props.js +0 -419
- package/lib/cjs/checkbox-field.js +0 -29
- package/lib/cjs/checkbox-field.ws.js +0 -62
- package/lib/cjs/link-block.js +0 -30
- package/lib/cjs/link-block.ws.js +0 -46
- package/lib/cjs/radio-button-field.js +0 -29
- package/lib/cjs/radio-button-field.ws.js +0 -62
- package/lib/link-block.js +0 -10
- package/lib/link-block.ws.js +0 -26
- package/lib/radio-button-field.js +0 -9
- package/lib/radio-button-field.ws.js +0 -44
- package/lib/types/__generated__/radio-button-field.props.d.ts +0 -2
- package/lib/types/__generated__/text-block.props.d.ts +0 -2
- package/lib/types/checkbox-field.d.ts +0 -3
- package/lib/types/link-block.d.ts +0 -3
- package/lib/types/link-block.stories.d.ts +0 -9
- package/lib/types/link-block.ws.d.ts +0 -3
- package/lib/types/radio-button-field.d.ts +0 -3
- package/lib/types/radio-button-field.ws.d.ts +0 -3
- package/lib/types/text-block.ws.d.ts +0 -3
- package/src/__generated__/checkbox-field.props.ts +0 -444
- package/src/__generated__/radio-button-field.props.ts +0 -444
- package/src/checkbox-field.tsx +0 -10
- package/src/checkbox-field.ws.tsx +0 -47
- package/src/link-block.stories.tsx +0 -16
- package/src/link-block.tsx +0 -9
- package/src/link-block.ws.tsx +0 -31
- package/src/radio-button-field.tsx +0 -10
- package/src/radio-button-field.ws.tsx +0 -47
- package/src/text-block.stories.tsx +0 -16
- /package/lib/__generated__/{text-block.props.js → text.props.js} +0 -0
- /package/lib/types/__generated__/{checkbox-field.props.d.ts → text.props.d.ts} +0 -0
- /package/lib/types/{checkbox-field.ws.d.ts → text.ws.d.ts} +0 -0
- /package/src/__generated__/{text-block.props.ts → text.props.ts} +0 -0
|
@@ -482,6 +482,5 @@ export const props: Record<string, PropMeta> = {
|
|
|
482
482
|
type: "string",
|
|
483
483
|
},
|
|
484
484
|
quality: { required: false, control: "number", type: "number" },
|
|
485
|
-
loader: { required: true, control: "text", type: "string" },
|
|
486
485
|
optimize: { required: false, control: "boolean", type: "boolean" },
|
|
487
486
|
};
|
|
@@ -482,6 +482,5 @@ export const props: Record<string, PropMeta> = {
|
|
|
482
482
|
type: "string",
|
|
483
483
|
},
|
|
484
484
|
quality: { required: false, control: "number", type: "number" },
|
|
485
|
-
loader: { required: true, control: "text", type: "string" },
|
|
486
485
|
optimize: { required: false, control: "boolean", type: "boolean" },
|
|
487
486
|
};
|
package/src/blockquote.ws.tsx
CHANGED
package/src/button.tsx
CHANGED
|
@@ -2,20 +2,12 @@ import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
|
2
2
|
|
|
3
3
|
export const defaultTag = "button";
|
|
4
4
|
|
|
5
|
-
type ButtonProps = ComponentProps<typeof defaultTag
|
|
5
|
+
type ButtonProps = ComponentProps<typeof defaultTag>;
|
|
6
6
|
|
|
7
7
|
export const Button = forwardRef<ElementRef<typeof defaultTag>, ButtonProps>(
|
|
8
|
-
(
|
|
9
|
-
{
|
|
10
|
-
type = "submit",
|
|
11
|
-
innerText = "Edit Inner Text in Properties",
|
|
12
|
-
children,
|
|
13
|
-
...props
|
|
14
|
-
},
|
|
15
|
-
ref
|
|
16
|
-
) => (
|
|
8
|
+
({ type = "submit", children, ...props }, ref) => (
|
|
17
9
|
<button type={type} {...props} ref={ref}>
|
|
18
|
-
{children
|
|
10
|
+
{children}
|
|
19
11
|
</button>
|
|
20
12
|
)
|
|
21
13
|
);
|
package/src/button.ws.tsx
CHANGED
|
@@ -26,9 +26,16 @@ export const meta: WsComponentMeta = {
|
|
|
26
26
|
{ selector: ":enabled", label: "Enabled" },
|
|
27
27
|
],
|
|
28
28
|
order: 1,
|
|
29
|
+
template: [
|
|
30
|
+
{
|
|
31
|
+
type: "instance",
|
|
32
|
+
component: "Button",
|
|
33
|
+
children: [{ type: "text", value: "Button you can edit" }],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
export const propsMeta: WsComponentPropsMeta = {
|
|
32
39
|
props,
|
|
33
|
-
initialProps: ["type", "
|
|
40
|
+
initialProps: ["type", "aria-label"],
|
|
34
41
|
};
|
package/src/checkbox.ws.tsx
CHANGED
|
@@ -20,8 +20,9 @@ const presetStyle = {
|
|
|
20
20
|
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
21
|
|
|
22
22
|
export const meta: WsComponentMeta = {
|
|
23
|
+
category: "forms",
|
|
23
24
|
type: "control",
|
|
24
|
-
label: "Checkbox
|
|
25
|
+
label: "Checkbox",
|
|
25
26
|
icon: CheckboxCheckedIcon,
|
|
26
27
|
presetStyle,
|
|
27
28
|
order: 6,
|
|
@@ -35,6 +36,23 @@ export const meta: WsComponentMeta = {
|
|
|
35
36
|
{ selector: ":read-only", label: "Read Only" },
|
|
36
37
|
{ selector: ":read-write", label: "Read Write" },
|
|
37
38
|
],
|
|
39
|
+
template: [
|
|
40
|
+
{
|
|
41
|
+
type: "instance",
|
|
42
|
+
component: "Label",
|
|
43
|
+
label: "Checkbox Field",
|
|
44
|
+
children: [
|
|
45
|
+
{ type: "instance", component: "Checkbox", children: [] },
|
|
46
|
+
{
|
|
47
|
+
type: "instance",
|
|
48
|
+
component: "Text",
|
|
49
|
+
label: "Checkbox Label",
|
|
50
|
+
props: [{ type: "string", name: "tag", value: "span" }],
|
|
51
|
+
children: [{ type: "text", value: "Checkbox" }],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
38
56
|
};
|
|
39
57
|
|
|
40
58
|
export const propsMeta: WsComponentPropsMeta = {
|
package/src/code-text.ws.tsx
CHANGED
package/src/components.ts
CHANGED
|
@@ -3,11 +3,10 @@ export { Fragment } from "./fragment";
|
|
|
3
3
|
export { HtmlEmbed } from "./html-embed";
|
|
4
4
|
export { Body } from "./body";
|
|
5
5
|
export { Box } from "./box";
|
|
6
|
-
export {
|
|
6
|
+
export { Text } from "./text";
|
|
7
7
|
export { Heading } from "./heading";
|
|
8
8
|
export { Paragraph } from "./paragraph";
|
|
9
9
|
export { Link } from "./link";
|
|
10
|
-
export { LinkBlock } from "./link-block";
|
|
11
10
|
export { RichTextLink } from "./rich-text-link";
|
|
12
11
|
export { Span } from "./span";
|
|
13
12
|
export { Bold } from "./bold";
|
|
@@ -27,9 +26,7 @@ export { Label } from "./label";
|
|
|
27
26
|
export { SuccessMessage } from "./success-message";
|
|
28
27
|
export { ErrorMessage } from "./error-message";
|
|
29
28
|
export { Textarea } from "./textarea";
|
|
30
|
-
export { RadioButtonField } from "./radio-button-field";
|
|
31
29
|
export { RadioButton } from "./radio-button";
|
|
32
|
-
export { CheckboxField } from "./checkbox-field";
|
|
33
30
|
export { Checkbox } from "./checkbox";
|
|
34
31
|
export { Vimeo } from "./vimeo";
|
|
35
32
|
export { VimeoPreviewImage } from "./vimeo-preview-image";
|
package/src/heading.ws.tsx
CHANGED
package/src/image.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type ElementRef,
|
|
4
4
|
forwardRef,
|
|
5
5
|
useMemo,
|
|
6
|
+
useContext,
|
|
6
7
|
} from "react";
|
|
7
8
|
import {
|
|
8
9
|
Image as WebstudioImage,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
import {
|
|
12
13
|
usePropAsset,
|
|
13
14
|
getInstanceIdFromComponentProps,
|
|
14
|
-
|
|
15
|
+
ReactSdkContext,
|
|
15
16
|
} from "@webstudio-is/react-sdk";
|
|
16
17
|
|
|
17
18
|
export const defaultTag = "img";
|
|
@@ -40,16 +41,16 @@ const imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
|
|
|
40
41
|
/>
|
|
41
42
|
</svg>`)}`;
|
|
42
43
|
|
|
43
|
-
type Props = ComponentPropsWithoutRef<typeof WebstudioImage>;
|
|
44
|
+
type Props = Omit<ComponentPropsWithoutRef<typeof WebstudioImage>, "loader">;
|
|
44
45
|
|
|
45
46
|
export const Image = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
46
47
|
(props, ref) => {
|
|
48
|
+
const { imageBaseUrl } = useContext(ReactSdkContext);
|
|
47
49
|
const asset = usePropAsset(getInstanceIdFromComponentProps(props), "src");
|
|
48
50
|
|
|
49
51
|
const loader = useMemo(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, []);
|
|
52
|
+
return createImageLoader({ imageBaseUrl });
|
|
53
|
+
}, [imageBaseUrl]);
|
|
53
54
|
|
|
54
55
|
const src = asset?.name ?? props.src;
|
|
55
56
|
|
package/src/image.ws.tsx
CHANGED
|
@@ -37,9 +37,6 @@ export const meta: WsComponentMeta = {
|
|
|
37
37
|
order: 0,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
// "loader" is our internal prop not intended to show up in the props panel
|
|
41
|
-
const { loader, ...publicProps } = props;
|
|
42
|
-
|
|
43
40
|
// Automatically generated props don't have the right control.
|
|
44
41
|
export const propsOverrides = {
|
|
45
42
|
src: {
|
|
@@ -52,7 +49,7 @@ export const propsOverrides = {
|
|
|
52
49
|
|
|
53
50
|
export const propsMeta: WsComponentPropsMeta = {
|
|
54
51
|
props: {
|
|
55
|
-
...
|
|
52
|
+
...props,
|
|
56
53
|
...propsOverrides,
|
|
57
54
|
},
|
|
58
55
|
initialProps: ["src", "width", "height", "alt", "loading"],
|
package/src/label.ws.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
type WsComponentMeta,
|
|
4
4
|
type WsComponentPropsMeta,
|
|
@@ -18,9 +18,9 @@ const presetStyle = {
|
|
|
18
18
|
|
|
19
19
|
export const meta: WsComponentMeta = {
|
|
20
20
|
category: "forms",
|
|
21
|
-
type: "
|
|
21
|
+
type: "container",
|
|
22
22
|
label: "Input Label",
|
|
23
|
-
icon:
|
|
23
|
+
icon: TextIcon,
|
|
24
24
|
states: defaultStates,
|
|
25
25
|
presetStyle,
|
|
26
26
|
order: 2,
|
|
@@ -37,10 +37,7 @@ export const propsMeta: WsComponentPropsMeta = {
|
|
|
37
37
|
props: {
|
|
38
38
|
...props,
|
|
39
39
|
htmlFor: {
|
|
40
|
-
|
|
41
|
-
control: "text",
|
|
42
|
-
type: "string",
|
|
43
|
-
rows: 0,
|
|
40
|
+
...props.htmlFor,
|
|
44
41
|
label: "For",
|
|
45
42
|
},
|
|
46
43
|
},
|
package/src/link.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { forwardRef, type ComponentProps } from "react";
|
|
1
|
+
import { forwardRef, type ComponentProps, useContext } from "react";
|
|
2
2
|
import {
|
|
3
3
|
usePropUrl,
|
|
4
4
|
getInstanceIdFromComponentProps,
|
|
5
|
-
|
|
5
|
+
ReactSdkContext,
|
|
6
6
|
} from "@webstudio-is/react-sdk";
|
|
7
7
|
|
|
8
8
|
export const defaultTag = "a";
|
|
@@ -13,10 +13,9 @@ type Props = Omit<ComponentProps<"a">, "target"> & {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const Link = forwardRef<HTMLAnchorElement, Props>((props, ref) => {
|
|
16
|
+
const { assetBaseUrl } = useContext(ReactSdkContext);
|
|
16
17
|
const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
|
|
17
18
|
|
|
18
|
-
const { assetBaseUrl } = getParams();
|
|
19
|
-
|
|
20
19
|
let url = "#";
|
|
21
20
|
|
|
22
21
|
switch (href?.type) {
|
package/src/link.ws.tsx
CHANGED
package/src/list-item.ws.tsx
CHANGED
package/src/metas.ts
CHANGED
|
@@ -3,11 +3,10 @@ export { meta as Fragment } from "./fragment.ws";
|
|
|
3
3
|
export { meta as HtmlEmbed } from "./html-embed.ws";
|
|
4
4
|
export { meta as Body } from "./body.ws";
|
|
5
5
|
export { meta as Box } from "./box.ws";
|
|
6
|
-
export { meta as
|
|
6
|
+
export { meta as Text } from "./text.ws";
|
|
7
7
|
export { meta as Heading } from "./heading.ws";
|
|
8
8
|
export { meta as Paragraph } from "./paragraph.ws";
|
|
9
9
|
export { meta as Link } from "./link.ws";
|
|
10
|
-
export { meta as LinkBlock } from "./link-block.ws";
|
|
11
10
|
export { meta as RichTextLink } from "./rich-text-link.ws";
|
|
12
11
|
export { meta as Span } from "./span.ws";
|
|
13
12
|
export { meta as Bold } from "./bold.ws";
|
|
@@ -27,9 +26,7 @@ export { meta as Label } from "./label.ws";
|
|
|
27
26
|
export { meta as SuccessMessage } from "./success-message.ws";
|
|
28
27
|
export { meta as ErrorMessage } from "./error-message.ws";
|
|
29
28
|
export { meta as Textarea } from "./textarea.ws";
|
|
30
|
-
export { meta as RadioButtonField } from "./radio-button-field.ws";
|
|
31
29
|
export { meta as RadioButton } from "./radio-button.ws";
|
|
32
|
-
export { meta as CheckboxField } from "./checkbox-field.ws";
|
|
33
30
|
export { meta as Checkbox } from "./checkbox.ws";
|
|
34
31
|
export { meta as Vimeo } from "./vimeo.ws";
|
|
35
32
|
export { meta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
package/src/paragraph.ws.tsx
CHANGED
|
@@ -15,7 +15,7 @@ const presetStyle = {
|
|
|
15
15
|
|
|
16
16
|
export const meta: WsComponentMeta = {
|
|
17
17
|
category: "text",
|
|
18
|
-
type: "
|
|
18
|
+
type: "container",
|
|
19
19
|
label: "Paragraph",
|
|
20
20
|
icon: TextAlignLeftIcon,
|
|
21
21
|
states: defaultStates,
|
|
@@ -24,7 +24,7 @@ export const meta: WsComponentMeta = {
|
|
|
24
24
|
{
|
|
25
25
|
type: "instance",
|
|
26
26
|
component: "Paragraph",
|
|
27
|
-
children: [{ type: "text", value: "
|
|
27
|
+
children: [{ type: "text", value: "Paragraph you can edit" }],
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
order: 2,
|
package/src/props.ts
CHANGED
|
@@ -3,11 +3,10 @@ export { propsMeta as Fragment } from "./fragment.ws";
|
|
|
3
3
|
export { propsMeta as HtmlEmbed } from "./html-embed.ws";
|
|
4
4
|
export { propsMeta as Body } from "./body.ws";
|
|
5
5
|
export { propsMeta as Box } from "./box.ws";
|
|
6
|
-
export { propsMeta as
|
|
6
|
+
export { propsMeta as Text } from "./text.ws";
|
|
7
7
|
export { propsMeta as Heading } from "./heading.ws";
|
|
8
8
|
export { propsMeta as Paragraph } from "./paragraph.ws";
|
|
9
9
|
export { propsMeta as Link } from "./link.ws";
|
|
10
|
-
export { propsMeta as LinkBlock } from "./link-block.ws";
|
|
11
10
|
export { propsMeta as RichTextLink } from "./rich-text-link.ws";
|
|
12
11
|
export { propsMeta as Span } from "./span.ws";
|
|
13
12
|
export { propsMeta as Bold } from "./bold.ws";
|
|
@@ -27,9 +26,7 @@ export { propsMeta as Label } from "./label.ws";
|
|
|
27
26
|
export { propsMeta as SuccessMessage } from "./success-message.ws";
|
|
28
27
|
export { propsMeta as ErrorMessage } from "./error-message.ws";
|
|
29
28
|
export { propsMeta as Textarea } from "./textarea.ws";
|
|
30
|
-
export { propsMeta as RadioButtonField } from "./radio-button-field.ws";
|
|
31
29
|
export { propsMeta as RadioButton } from "./radio-button.ws";
|
|
32
|
-
export { propsMeta as CheckboxField } from "./checkbox-field.ws";
|
|
33
30
|
export { propsMeta as Checkbox } from "./checkbox.ws";
|
|
34
31
|
export { propsMeta as Vimeo } from "./vimeo.ws";
|
|
35
32
|
export { propsMeta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
package/src/radio-button.ws.tsx
CHANGED
|
@@ -20,8 +20,9 @@ const presetStyle = {
|
|
|
20
20
|
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
21
|
|
|
22
22
|
export const meta: WsComponentMeta = {
|
|
23
|
+
category: "forms",
|
|
23
24
|
type: "control",
|
|
24
|
-
label: "Radio
|
|
25
|
+
label: "Radio",
|
|
25
26
|
icon: RadioCheckedIcon,
|
|
26
27
|
presetStyle,
|
|
27
28
|
order: 5,
|
|
@@ -35,6 +36,23 @@ export const meta: WsComponentMeta = {
|
|
|
35
36
|
{ selector: ":read-only", label: "Read Only" },
|
|
36
37
|
{ selector: ":read-write", label: "Read Write" },
|
|
37
38
|
],
|
|
39
|
+
template: [
|
|
40
|
+
{
|
|
41
|
+
type: "instance",
|
|
42
|
+
component: "Label",
|
|
43
|
+
label: "Radio Field",
|
|
44
|
+
children: [
|
|
45
|
+
{ type: "instance", component: "RadioButton", props: [], children: [] },
|
|
46
|
+
{
|
|
47
|
+
type: "instance",
|
|
48
|
+
component: "Text",
|
|
49
|
+
label: "Radio Label",
|
|
50
|
+
props: [{ type: "string", name: "tag", value: "span" }],
|
|
51
|
+
children: [{ type: "text", value: "Radio" }],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
38
56
|
};
|
|
39
57
|
|
|
40
58
|
export const propsMeta: WsComponentPropsMeta = {
|
package/src/span.ws.tsx
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Text as TextPrimitive } from "./text";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Text",
|
|
6
|
+
component: TextPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof TextPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof TextPrimitive> = (args) => (
|
|
10
|
+
<TextPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Text = Template.bind({});
|
|
14
|
+
Text.args = {
|
|
15
|
+
children: "text",
|
|
16
|
+
};
|
|
@@ -12,10 +12,10 @@ type Props = ComponentProps<typeof defaultTag> & {
|
|
|
12
12
|
tag?: "div" | "span" | "figcaption";
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export const
|
|
15
|
+
export const Text = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
16
16
|
({ tag = defaultTag, ...props }, ref) => {
|
|
17
17
|
return createElement(tag, { ...props, ref });
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Text.displayName = "Text";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates,
|
|
4
4
|
type PresetStyle,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
type WsComponentPropsMeta,
|
|
7
7
|
} from "@webstudio-is/react-sdk";
|
|
8
8
|
import { div } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import { props } from "./__generated__/text
|
|
10
|
-
import type { defaultTag } from "./text
|
|
9
|
+
import { props } from "./__generated__/text.props";
|
|
10
|
+
import type { defaultTag } from "./text";
|
|
11
11
|
|
|
12
12
|
const presetStyle = {
|
|
13
13
|
div: [
|
|
@@ -21,16 +21,16 @@ const presetStyle = {
|
|
|
21
21
|
|
|
22
22
|
export const meta: WsComponentMeta = {
|
|
23
23
|
category: "text",
|
|
24
|
-
type: "
|
|
25
|
-
label: "Text
|
|
26
|
-
icon:
|
|
24
|
+
type: "container",
|
|
25
|
+
label: "Text",
|
|
26
|
+
icon: TextIcon,
|
|
27
27
|
states: defaultStates,
|
|
28
28
|
presetStyle,
|
|
29
29
|
template: [
|
|
30
30
|
{
|
|
31
31
|
type: "instance",
|
|
32
|
-
component: "
|
|
33
|
-
children: [{ type: "text", value: "
|
|
32
|
+
component: "Text",
|
|
33
|
+
children: [{ type: "text", value: "The text you can edit" }],
|
|
34
34
|
},
|
|
35
35
|
],
|
|
36
36
|
order: 0,
|
package/src/vimeo.ws.ts
CHANGED
|
@@ -49,7 +49,7 @@ export const meta: WsComponentMeta = {
|
|
|
49
49
|
value: { type: "keyword", value: "absolute" },
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
property: "
|
|
52
|
+
property: "objectFit",
|
|
53
53
|
value: { type: "keyword", value: "cover" },
|
|
54
54
|
},
|
|
55
55
|
{
|
|
@@ -88,6 +88,11 @@ export const meta: WsComponentMeta = {
|
|
|
88
88
|
name: "alt",
|
|
89
89
|
value: "Vimeo video preview image",
|
|
90
90
|
},
|
|
91
|
+
{
|
|
92
|
+
type: "string",
|
|
93
|
+
name: "sizes",
|
|
94
|
+
value: "100vw",
|
|
95
|
+
},
|
|
91
96
|
],
|
|
92
97
|
},
|
|
93
98
|
{
|