@webstudio-is/sdk-components-react 0.70.0 → 0.72.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__/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__/vimeo-play-button.props.js +414 -0
- package/lib/__generated__/vimeo-preview-image.props.js +442 -0
- package/lib/__generated__/vimeo-spinner.props.js +398 -0
- package/lib/__generated__/vimeo.props.js +555 -0
- package/lib/box.js +2 -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__/vimeo-play-button.props.js +434 -0
- package/lib/cjs/__generated__/vimeo-preview-image.props.js +462 -0
- package/lib/cjs/__generated__/vimeo-spinner.props.js +418 -0
- package/lib/cjs/__generated__/vimeo.props.js +575 -0
- package/lib/cjs/box.js +2 -1
- package/lib/cjs/components.js +9 -1
- package/lib/cjs/image.ws.js +11 -7
- package/lib/cjs/link-block.ws.js +1 -8
- package/lib/cjs/link.ws.js +1 -1
- package/lib/cjs/metas.js +9 -1
- package/lib/cjs/props.js +9 -1
- package/lib/cjs/rich-text-link.ws.js +3 -10
- package/lib/cjs/vimeo-play-button.js +38 -0
- package/lib/cjs/vimeo-play-button.ws.js +44 -0
- package/lib/cjs/vimeo-preview-image.js +40 -0
- package/lib/cjs/vimeo-preview-image.ws.js +36 -0
- package/lib/cjs/vimeo-spinner.js +37 -0
- package/lib/cjs/vimeo-spinner.ws.js +43 -0
- package/lib/cjs/vimeo.js +294 -0
- package/lib/cjs/vimeo.ws.js +340 -0
- package/lib/components.js +9 -1
- package/lib/image.ws.js +11 -7
- package/lib/link-block.ws.js +1 -8
- package/lib/link.ws.js +1 -1
- package/lib/metas.js +9 -1
- package/lib/props.js +9 -1
- package/lib/rich-text-link.ws.js +3 -10
- package/lib/types/__generated__/vimeo-play-button.props.d.ts +2 -0
- package/lib/types/__generated__/vimeo-preview-image.props.d.ts +2 -0
- 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/components.d.ts +4 -0
- package/lib/types/image.ws.d.ts +8 -0
- package/lib/types/link-block.stories.d.ts +2 -6
- package/lib/types/link.d.ts +1 -3
- package/lib/types/link.stories.d.ts +2 -6
- package/lib/types/metas.d.ts +4 -0
- package/lib/types/props.d.ts +4 -0
- package/lib/types/rich-text-link.stories.d.ts +2 -6
- package/lib/types/vimeo-play-button.d.ts +6 -0
- package/lib/types/vimeo-play-button.stories.d.ts +9 -0
- package/lib/types/vimeo-play-button.ws.d.ts +3 -0
- package/lib/types/vimeo-preview-image.d.ts +6 -0
- package/lib/types/vimeo-preview-image.stories.d.ts +13 -0
- package/lib/types/vimeo-preview-image.ws.d.ts +3 -0
- package/lib/types/vimeo-spinner.d.ts +2 -0
- package/lib/types/vimeo-spinner.stories.d.ts +5 -0
- package/lib/types/vimeo-spinner.ws.d.ts +3 -0
- 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 +322 -0
- package/package.json +8 -6
- package/src/LICENSE +21 -0
- 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__/vimeo-play-button.props.ts +459 -0
- package/src/__generated__/vimeo-preview-image.props.ts +487 -0
- package/src/__generated__/vimeo-spinner.props.ts +443 -0
- package/src/__generated__/vimeo.props.ts +621 -0
- package/src/box.tsx +1 -1
- package/src/components.ts +4 -0
- package/src/image.ws.tsx +11 -6
- package/src/link-block.ws.tsx +1 -8
- package/src/link.tsx +2 -7
- package/src/link.ws.tsx +1 -1
- package/src/metas.ts +4 -0
- package/src/props.ts +4 -0
- package/src/rich-text-link.ws.tsx +3 -11
- 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 +326 -0
package/src/link.tsx
CHANGED
|
@@ -7,14 +7,9 @@ import {
|
|
|
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) => {
|
package/src/link.ws.tsx
CHANGED
package/src/metas.ts
CHANGED
|
@@ -31,3 +31,7 @@ export { meta as RadioButtonField } from "./radio-button-field.ws";
|
|
|
31
31
|
export { meta as RadioButton } from "./radio-button.ws";
|
|
32
32
|
export { meta as CheckboxField } from "./checkbox-field.ws";
|
|
33
33
|
export { meta as Checkbox } from "./checkbox.ws";
|
|
34
|
+
export { meta as Vimeo } from "./vimeo.ws";
|
|
35
|
+
export { meta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
|
36
|
+
export { meta as VimeoPlayButton } from "./vimeo-play-button.ws";
|
|
37
|
+
export { meta as VimeoSpinner } from "./vimeo-spinner.ws";
|
package/src/props.ts
CHANGED
|
@@ -31,3 +31,7 @@ export { propsMeta as RadioButtonField } from "./radio-button-field.ws";
|
|
|
31
31
|
export { propsMeta as RadioButton } from "./radio-button.ws";
|
|
32
32
|
export { propsMeta as CheckboxField } from "./checkbox-field.ws";
|
|
33
33
|
export { propsMeta as Checkbox } from "./checkbox.ws";
|
|
34
|
+
export { propsMeta as Vimeo } from "./vimeo.ws";
|
|
35
|
+
export { propsMeta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
|
36
|
+
export { propsMeta as VimeoPlayButton } from "./vimeo-play-button.ws";
|
|
37
|
+
export { propsMeta as VimeoSpinner } from "./vimeo-spinner.ws";
|
|
@@ -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;
|
|
@@ -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";
|
|
@@ -0,0 +1,27 @@
|
|
|
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-spinner.props";
|
|
8
|
+
import { div } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
+
import { BoxIcon } from "@webstudio-is/icons/svg";
|
|
10
|
+
|
|
11
|
+
const presetStyle = {
|
|
12
|
+
div,
|
|
13
|
+
} satisfies PresetStyle<"div">;
|
|
14
|
+
|
|
15
|
+
export const meta: WsComponentMeta = {
|
|
16
|
+
type: "container",
|
|
17
|
+
icon: BoxIcon,
|
|
18
|
+
states: defaultStates,
|
|
19
|
+
presetStyle,
|
|
20
|
+
category: "hidden",
|
|
21
|
+
label: "Spinner",
|
|
22
|
+
requiredAncestors: ["Vimeo"],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const propsMeta: WsComponentPropsMeta = {
|
|
26
|
+
props,
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Vimeo as VimeoPrimitive } from "./vimeo";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Vimeo",
|
|
6
|
+
component: VimeoPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof VimeoPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof VimeoPrimitive> = (args) => (
|
|
10
|
+
<VimeoPrimitive
|
|
11
|
+
{...args}
|
|
12
|
+
style={{ minHeight: 20, outline: "1px solid black" }}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Vimeo = Template.bind({});
|
|
17
|
+
Vimeo.args = {};
|