@webstudio-is/sdk-components-react 0.71.0 → 0.73.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__/link-block.props.js +1 -7
- package/lib/__generated__/link.props.js +1 -7
- package/lib/__generated__/rich-text-link.props.js +1 -7
- package/lib/__generated__/{radio-button-field.props.js → vimeo-play-button.props.js} +14 -0
- package/lib/__generated__/vimeo-preview-image.props.js +441 -0
- package/lib/__generated__/{checkbox-field.props.js → vimeo-spinner.props.js} +0 -1
- package/lib/__generated__/vimeo.props.js +555 -0
- package/lib/blockquote.ws.js +1 -1
- package/lib/box.js +2 -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__/link-block.props.js +1 -7
- package/lib/cjs/__generated__/link.props.js +1 -7
- package/lib/cjs/__generated__/rich-text-link.props.js +1 -7
- package/lib/cjs/__generated__/{text-block.props.js → text.props.js} +3 -3
- package/lib/cjs/__generated__/{radio-button-field.props.js → vimeo-play-button.props.js} +17 -3
- package/lib/cjs/__generated__/vimeo-preview-image.props.js +461 -0
- package/lib/cjs/__generated__/{checkbox-field.props.js → vimeo-spinner.props.js} +3 -4
- package/lib/cjs/__generated__/vimeo.props.js +575 -0
- package/lib/cjs/blockquote.ws.js +1 -1
- package/lib/cjs/box.js +2 -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 +11 -9
- package/lib/cjs/heading.ws.js +1 -1
- package/lib/cjs/image.js +3 -3
- package/lib/cjs/image.ws.js +12 -9
- package/lib/cjs/label.ws.js +3 -6
- package/lib/cjs/link.js +1 -1
- package/lib/cjs/link.ws.js +3 -3
- package/lib/cjs/list-item.ws.js +1 -1
- package/lib/cjs/metas.js +11 -9
- package/lib/cjs/paragraph.ws.js +2 -2
- package/lib/cjs/props.js +11 -9
- package/lib/cjs/radio-button.ws.js +19 -1
- package/lib/cjs/rich-text-link.ws.js +3 -10
- 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/{link-block.js → vimeo-play-button.js} +17 -9
- package/lib/cjs/{link-block.ws.js → vimeo-play-button.ws.js} +13 -22
- package/lib/cjs/vimeo-preview-image.js +40 -0
- package/lib/cjs/{radio-button-field.js → vimeo-preview-image.ws.js} +17 -10
- package/lib/cjs/{checkbox-field.js → vimeo-spinner.js} +16 -8
- package/lib/cjs/{checkbox-field.ws.js → vimeo-spinner.ws.js} +11 -30
- package/lib/cjs/vimeo.js +294 -0
- package/lib/cjs/vimeo.ws.js +345 -0
- package/lib/code-text.ws.js +1 -1
- package/lib/components.js +11 -9
- package/lib/heading.ws.js +1 -1
- package/lib/image.js +6 -5
- package/lib/image.ws.js +12 -9
- package/lib/label.ws.js +4 -7
- package/lib/link.js +3 -3
- package/lib/link.ws.js +3 -3
- package/lib/list-item.ws.js +1 -1
- package/lib/metas.js +52 -50
- package/lib/paragraph.ws.js +2 -2
- package/lib/props.js +52 -50
- package/lib/radio-button.ws.js +19 -1
- package/lib/rich-text-link.ws.js +3 -10
- 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/__generated__/vimeo-spinner.props.d.ts +2 -0
- package/lib/types/__generated__/vimeo.props.d.ts +2 -0
- package/lib/types/box.d.ts +1 -1
- package/lib/types/button.d.ts +2 -6
- package/lib/types/button.stories.d.ts +2 -6
- package/lib/types/components.d.ts +5 -4
- package/lib/types/image.d.ts +5 -6
- package/lib/types/image.stories.d.ts +555 -6
- package/lib/types/image.ws.d.ts +8 -0
- package/lib/types/link.d.ts +1 -3
- package/lib/types/link.stories.d.ts +2 -6
- package/lib/types/metas.d.ts +5 -4
- package/lib/types/props.d.ts +5 -4
- package/lib/types/rich-text-link.stories.d.ts +2 -6
- 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 +4 -0
- package/lib/types/vimeo-play-button.stories.d.ts +5 -0
- package/lib/types/vimeo-preview-image.d.ts +281 -0
- package/lib/types/vimeo-preview-image.stories.d.ts +562 -0
- package/lib/types/vimeo-spinner.d.ts +2 -0
- package/lib/types/vimeo-spinner.stories.d.ts +5 -0
- package/lib/types/{link-block.ws.d.ts → vimeo-spinner.ws.d.ts} +1 -1
- package/lib/types/vimeo.d.ts +73 -0
- package/lib/types/vimeo.stories.d.ts +71 -0
- package/lib/types/vimeo.ws.d.ts +3 -0
- package/lib/vimeo-play-button.js +21 -0
- package/lib/vimeo-play-button.ws.js +26 -0
- package/lib/vimeo-preview-image.js +23 -0
- package/lib/vimeo-preview-image.ws.js +20 -0
- package/lib/vimeo-spinner.js +20 -0
- package/lib/vimeo-spinner.ws.js +25 -0
- package/lib/vimeo.js +282 -0
- package/lib/vimeo.ws.js +327 -0
- package/package.json +9 -7
- package/src/LICENSE +21 -0
- package/src/__generated__/button.props.ts +0 -6
- package/src/__generated__/image.props.ts +0 -1
- package/src/__generated__/link-block.props.ts +1 -7
- package/src/__generated__/link.props.ts +1 -7
- package/src/__generated__/rich-text-link.props.ts +1 -7
- package/src/__generated__/{checkbox-field.props.ts → vimeo-play-button.props.ts} +14 -0
- package/src/__generated__/vimeo-preview-image.props.ts +486 -0
- package/src/__generated__/{radio-button-field.props.ts → vimeo-spinner.props.ts} +0 -1
- package/src/__generated__/vimeo.props.ts +621 -0
- package/src/blockquote.ws.tsx +1 -1
- package/src/box.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 +5 -4
- package/src/heading.ws.tsx +1 -1
- package/src/image.tsx +6 -5
- package/src/image.ws.tsx +11 -9
- package/src/label.ws.tsx +4 -7
- package/src/link.tsx +5 -11
- package/src/link.ws.tsx +3 -3
- package/src/list-item.ws.tsx +1 -1
- package/src/metas.ts +5 -4
- package/src/paragraph.ws.tsx +2 -2
- package/src/props.ts +5 -4
- package/src/radio-button.ws.tsx +19 -1
- package/src/rich-text-link.ws.tsx +3 -11
- 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-play-button.stories.tsx +17 -0
- package/src/vimeo-play-button.tsx +24 -0
- package/src/vimeo-play-button.ws.ts +29 -0
- package/src/vimeo-preview-image.stories.tsx +17 -0
- package/src/vimeo-preview-image.tsx +30 -0
- package/src/vimeo-preview-image.ws.ts +22 -0
- package/src/vimeo-spinner.stories.tsx +17 -0
- package/src/vimeo-spinner.tsx +25 -0
- package/src/vimeo-spinner.ws.ts +27 -0
- package/src/vimeo.stories.tsx +17 -0
- package/src/vimeo.tsx +430 -0
- package/src/vimeo.ws.ts +331 -0
- package/lib/checkbox-field.js +0 -9
- package/lib/checkbox-field.ws.js +0 -44
- package/lib/cjs/radio-button-field.ws.js +0 -62
- package/lib/link-block.js +0 -10
- package/lib/link-block.ws.js +0 -33
- package/lib/radio-button-field.js +0 -9
- package/lib/radio-button-field.ws.js +0 -44
- 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 -13
- package/lib/types/radio-button-field.d.ts +0 -3
- 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 -38
- 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/__generated__/{radio-button-field.props.d.ts → vimeo-play-button.props.d.ts} +0 -0
- /package/lib/types/__generated__/{text-block.props.d.ts → vimeo-preview-image.props.d.ts} +0 -0
- /package/lib/types/{checkbox-field.ws.d.ts → text.ws.d.ts} +0 -0
- /package/lib/types/{radio-button-field.ws.d.ts → vimeo-play-button.ws.d.ts} +0 -0
- /package/lib/types/{text-block.ws.d.ts → vimeo-preview-image.ws.d.ts} +0 -0
- /package/src/__generated__/{text-block.props.ts → text.props.ts} +0 -0
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,7 +26,9 @@ 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";
|
|
31
|
+
export { Vimeo } from "./vimeo";
|
|
32
|
+
export { VimeoPreviewImage } from "./vimeo-preview-image";
|
|
33
|
+
export { VimeoPlayButton } from "./vimeo-play-button";
|
|
34
|
+
export { VimeoSpinner } from "./vimeo-spinner";
|
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,18 +37,20 @@ export const meta: WsComponentMeta = {
|
|
|
37
37
|
order: 0,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
//
|
|
41
|
-
const
|
|
40
|
+
// Automatically generated props don't have the right control.
|
|
41
|
+
export const propsOverrides = {
|
|
42
|
+
src: {
|
|
43
|
+
type: "string",
|
|
44
|
+
control: "file",
|
|
45
|
+
label: "Source",
|
|
46
|
+
required: false,
|
|
47
|
+
},
|
|
48
|
+
} as const;
|
|
42
49
|
|
|
43
50
|
export const propsMeta: WsComponentPropsMeta = {
|
|
44
51
|
props: {
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
type: "string",
|
|
48
|
-
control: "file",
|
|
49
|
-
label: "Source",
|
|
50
|
-
required: false,
|
|
51
|
-
},
|
|
52
|
+
...props,
|
|
53
|
+
...propsOverrides,
|
|
52
54
|
},
|
|
53
55
|
initialProps: ["src", "width", "height", "alt", "loading"],
|
|
54
56
|
};
|
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,27 +1,21 @@
|
|
|
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";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
// - props meta should be generated from Remix link
|
|
13
|
-
// - changing this requires update in app/canvas/custom-components/link.tsx
|
|
14
|
-
type Props = Omit<ComponentProps<"a">, "href" | "target"> & {
|
|
15
|
-
href?: string;
|
|
10
|
+
type Props = Omit<ComponentProps<"a">, "target"> & {
|
|
11
|
+
// override (string & {}) in target to generate keywords
|
|
16
12
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
17
|
-
prefetch?: "none" | "intent" | "render";
|
|
18
13
|
};
|
|
19
14
|
|
|
20
15
|
export const Link = forwardRef<HTMLAnchorElement, Props>((props, ref) => {
|
|
16
|
+
const { assetBaseUrl } = useContext(ReactSdkContext);
|
|
21
17
|
const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
|
|
22
18
|
|
|
23
|
-
const { assetBaseUrl } = getParams();
|
|
24
|
-
|
|
25
19
|
let url = "#";
|
|
26
20
|
|
|
27
21
|
switch (href?.type) {
|
package/src/link.ws.tsx
CHANGED
|
@@ -25,8 +25,8 @@ const presetStyle = {
|
|
|
25
25
|
|
|
26
26
|
export const meta: WsComponentMeta = {
|
|
27
27
|
category: "general",
|
|
28
|
-
type: "
|
|
29
|
-
label: "Link
|
|
28
|
+
type: "container",
|
|
29
|
+
label: "Link",
|
|
30
30
|
icon: LinkIcon,
|
|
31
31
|
presetStyle,
|
|
32
32
|
order: 1,
|
|
@@ -60,5 +60,5 @@ export const propsMeta: WsComponentPropsMeta = {
|
|
|
60
60
|
required: false,
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
|
-
initialProps: ["href", "target"
|
|
63
|
+
initialProps: ["href", "target"],
|
|
64
64
|
};
|
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,7 +26,9 @@ 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";
|
|
31
|
+
export { meta as Vimeo } from "./vimeo.ws";
|
|
32
|
+
export { meta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
|
33
|
+
export { meta as VimeoPlayButton } from "./vimeo-play-button.ws";
|
|
34
|
+
export { meta as VimeoSpinner } from "./vimeo-spinner.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,7 +26,9 @@ 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";
|
|
31
|
+
export { propsMeta as Vimeo } from "./vimeo.ws";
|
|
32
|
+
export { propsMeta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
|
33
|
+
export { propsMeta as VimeoPlayButton } from "./vimeo-play-button.ws";
|
|
34
|
+
export { propsMeta as VimeoSpinner } from "./vimeo-spinner.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 = {
|
|
@@ -2,21 +2,13 @@ import type {
|
|
|
2
2
|
WsComponentMeta,
|
|
3
3
|
WsComponentPropsMeta,
|
|
4
4
|
} from "@webstudio-is/react-sdk";
|
|
5
|
-
import { props } from "./__generated__/rich-text-link.props";
|
|
6
5
|
import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
|
|
7
6
|
|
|
8
|
-
const { category, ...linkMetaRest } = linkMeta;
|
|
9
|
-
|
|
10
7
|
export const meta: WsComponentMeta = {
|
|
11
|
-
...
|
|
8
|
+
...linkMeta,
|
|
9
|
+
category: "hidden",
|
|
12
10
|
type: "rich-text-child",
|
|
13
11
|
template: [],
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
export const propsMeta: WsComponentPropsMeta =
|
|
17
|
-
initialProps: linkPropsMeta.initialProps,
|
|
18
|
-
props: {
|
|
19
|
-
...props,
|
|
20
|
-
href: linkPropsMeta.props.href,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
14
|
+
export const propsMeta: WsComponentPropsMeta = linkPropsMeta;
|
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,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { VimeoPlayButton as VimeoPlayButtonPrimitive } from "./vimeo-play-button";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Vimeo Preview Image",
|
|
6
|
+
component: VimeoPlayButtonPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof VimeoPlayButtonPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof VimeoPlayButtonPrimitive> = (args) => (
|
|
10
|
+
<VimeoPlayButtonPrimitive
|
|
11
|
+
{...args}
|
|
12
|
+
style={{ minHeight: 20, outline: "1px solid black" }}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const VimeoPlayButton = Template.bind({});
|
|
17
|
+
VimeoPlayButton.args = {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
type ElementRef,
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
useContext,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { VimeoContext } from "./vimeo";
|
|
8
|
+
import { Button, defaultTag } from "./button";
|
|
9
|
+
|
|
10
|
+
export { defaultTag };
|
|
11
|
+
|
|
12
|
+
type Props = ComponentProps<typeof Button>;
|
|
13
|
+
|
|
14
|
+
export const VimeoPlayButton = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
15
|
+
(props, ref) => {
|
|
16
|
+
const vimeoContext = useContext(VimeoContext);
|
|
17
|
+
if (vimeoContext.status !== "initial") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return <Button {...props} onClick={vimeoContext.onInitPlayer} ref={ref} />;
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
VimeoPlayButton.displayName = "VimeoPlayButton";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultStates,
|
|
3
|
+
type PresetStyle,
|
|
4
|
+
type WsComponentMeta,
|
|
5
|
+
type WsComponentPropsMeta,
|
|
6
|
+
} from "@webstudio-is/react-sdk";
|
|
7
|
+
import { props } from "./__generated__/vimeo-play-button.props";
|
|
8
|
+
import { ButtonElementIcon } from "@webstudio-is/icons/svg";
|
|
9
|
+
import { button } from "@webstudio-is/react-sdk/css-normalize";
|
|
10
|
+
import { defaultTag } from "./vimeo-play-button";
|
|
11
|
+
|
|
12
|
+
const presetStyle = {
|
|
13
|
+
button,
|
|
14
|
+
} satisfies PresetStyle<typeof defaultTag>;
|
|
15
|
+
|
|
16
|
+
export const meta: WsComponentMeta = {
|
|
17
|
+
category: "hidden",
|
|
18
|
+
type: "container",
|
|
19
|
+
invalidAncestors: ["Button"],
|
|
20
|
+
requiredAncestors: ["Vimeo"],
|
|
21
|
+
label: "Play Button",
|
|
22
|
+
icon: ButtonElementIcon,
|
|
23
|
+
presetStyle,
|
|
24
|
+
states: defaultStates,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
28
|
+
props,
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { VimeoPreviewImage as VimeoPreviewImagePrimitive } from "./vimeo-preview-image";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Vimeo Preview Image",
|
|
6
|
+
component: VimeoPreviewImagePrimitive,
|
|
7
|
+
} as ComponentMeta<typeof VimeoPreviewImagePrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof VimeoPreviewImagePrimitive> = (args) => (
|
|
10
|
+
<VimeoPreviewImagePrimitive
|
|
11
|
+
{...args}
|
|
12
|
+
style={{ minHeight: 20, outline: "1px solid black" }}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const VimeoPreviewImage = Template.bind({});
|
|
17
|
+
VimeoPreviewImage.args = {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
type ElementRef,
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
useContext,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { Image, defaultTag } from "./image";
|
|
8
|
+
import { VimeoContext } from "./vimeo";
|
|
9
|
+
|
|
10
|
+
// Generated using https://png-pixel.com/
|
|
11
|
+
const base64Preview = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkOAMAANIAzr59FiYAAAAASUVORK5CYII=`;
|
|
12
|
+
|
|
13
|
+
type Props = ComponentProps<typeof Image>;
|
|
14
|
+
|
|
15
|
+
export const VimeoPreviewImage = forwardRef<
|
|
16
|
+
ElementRef<typeof defaultTag>,
|
|
17
|
+
Props
|
|
18
|
+
>(({ src, ...rest }, ref) => {
|
|
19
|
+
const vimeoContext = useContext(VimeoContext);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Image
|
|
23
|
+
{...rest}
|
|
24
|
+
src={String(vimeoContext.previewImageUrl ?? src ?? base64Preview)}
|
|
25
|
+
ref={ref}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
VimeoPreviewImage.displayName = "VimeoPreviewImage";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type WsComponentMeta,
|
|
3
|
+
type WsComponentPropsMeta,
|
|
4
|
+
} from "@webstudio-is/react-sdk";
|
|
5
|
+
import {
|
|
6
|
+
propsOverrides as imagePropsOverrides,
|
|
7
|
+
propsMeta as imagePropsMeta,
|
|
8
|
+
meta as imageMeta,
|
|
9
|
+
} from "./image.ws";
|
|
10
|
+
import { props } from "./__generated__/vimeo-preview-image.props";
|
|
11
|
+
|
|
12
|
+
export const meta: WsComponentMeta = {
|
|
13
|
+
...imageMeta,
|
|
14
|
+
category: "hidden",
|
|
15
|
+
label: "Preview Image",
|
|
16
|
+
requiredAncestors: ["Vimeo"],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
20
|
+
props: { ...props, ...imagePropsOverrides },
|
|
21
|
+
initialProps: imagePropsMeta.initialProps,
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { VimeoSpinner as VimeoSpinnerPrimitive } from "./vimeo-spinner";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Vimeo Preview Image",
|
|
6
|
+
component: VimeoSpinnerPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof VimeoSpinnerPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof VimeoSpinnerPrimitive> = (args) => (
|
|
10
|
+
<VimeoSpinnerPrimitive
|
|
11
|
+
{...args}
|
|
12
|
+
style={{ minHeight: 20, outline: "1px solid black" }}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const VimeoSpinner = Template.bind({});
|
|
17
|
+
VimeoSpinner.args = {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
type ElementRef,
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
useContext,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { VimeoContext } from "./vimeo";
|
|
8
|
+
|
|
9
|
+
const defaultTag = "div";
|
|
10
|
+
|
|
11
|
+
type Props = ComponentProps<typeof defaultTag>;
|
|
12
|
+
|
|
13
|
+
export const VimeoSpinner = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
14
|
+
(props, ref) => {
|
|
15
|
+
const vimeoContext = useContext(VimeoContext);
|
|
16
|
+
|
|
17
|
+
if (vimeoContext.status !== "initialized") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return <div {...props} ref={ref} />;
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
VimeoSpinner.displayName = "VimeoSpinner";
|