@webstudio-is/sdk-components-react 0.91.0 → 0.92.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__/blockquote.props.js +2 -4
- package/lib/__generated__/body.props.js +2 -4
- package/lib/__generated__/bold.props.js +2 -4
- package/lib/__generated__/box.props.js +2 -4
- package/lib/__generated__/button.props.js +2 -4
- package/lib/__generated__/checkbox.props.js +2 -4
- package/lib/__generated__/code-text.props.js +2 -4
- package/lib/__generated__/form.props.js +2 -4
- package/lib/__generated__/fragment.props.js +2 -4
- package/lib/__generated__/heading.props.js +2 -4
- package/lib/__generated__/html-embed.props.js +2 -4
- package/lib/__generated__/image.props.js +2 -4
- package/lib/__generated__/input.props.js +2 -4
- package/lib/__generated__/italic.props.js +2 -4
- package/lib/__generated__/label.props.js +2 -4
- package/lib/__generated__/link.props.js +2 -4
- package/lib/__generated__/list-item.props.js +2 -4
- package/lib/__generated__/list.props.js +2 -4
- package/lib/__generated__/paragraph.props.js +2 -4
- package/lib/__generated__/radio-button.props.js +2 -4
- package/lib/__generated__/rich-text-link.props.js +2 -4
- package/lib/__generated__/separator.props.js +2 -4
- package/lib/__generated__/slot.props.js +2 -4
- package/lib/__generated__/span.props.js +2 -4
- package/lib/__generated__/subscript.props.js +2 -4
- package/lib/__generated__/superscript.props.js +2 -4
- package/lib/__generated__/text.props.js +2 -4
- package/lib/__generated__/textarea.props.js +2 -4
- package/lib/__generated__/vimeo-play-button.props.js +2 -4
- package/lib/__generated__/vimeo-preview-image.props.js +2 -4
- package/lib/__generated__/vimeo-spinner.props.js +2 -4
- package/lib/__generated__/vimeo.props.js +2 -4
- package/lib/blockquote.js +3 -6
- package/lib/blockquote.stories.js +11 -0
- package/lib/blockquote.ws.js +3 -6
- package/lib/body.js +3 -6
- package/lib/body.stories.js +11 -0
- package/lib/body.ws.js +3 -6
- package/lib/bold.js +3 -6
- package/lib/bold.stories.js +11 -0
- package/lib/bold.ws.js +3 -6
- package/lib/box.js +3 -6
- package/lib/box.stories.js +11 -0
- package/lib/box.ws.js +3 -6
- package/lib/button.js +3 -6
- package/lib/button.stories.js +11 -0
- package/lib/button.ws.js +3 -6
- package/lib/checkbox.js +3 -6
- package/lib/checkbox.ws.js +3 -6
- package/lib/code-text.js +3 -6
- package/lib/code-text.stories.js +11 -0
- package/lib/code-text.ws.js +3 -6
- package/lib/components.js +33 -66
- package/lib/form.js +3 -6
- package/lib/form.stories.js +11 -0
- package/lib/form.ws.js +3 -6
- package/lib/fragment.js +2 -4
- package/lib/fragment.ws.js +3 -6
- package/lib/heading.js +2 -4
- package/lib/heading.stories.js +11 -0
- package/lib/heading.ws.js +3 -6
- package/lib/html-embed.js +2 -4
- package/lib/html-embed.stories.js +11 -0
- package/lib/html-embed.ws.js +3 -6
- package/lib/image.js +3 -6
- package/lib/image.stories.js +7 -0
- package/lib/image.ws.js +4 -8
- package/lib/input.js +3 -6
- package/lib/input.stories.js +9 -0
- package/lib/input.ws.js +9 -11
- package/lib/italic.js +3 -6
- package/lib/italic.stories.js +11 -0
- package/lib/italic.ws.js +3 -6
- package/lib/label.js +3 -6
- package/lib/label.ws.js +3 -6
- package/lib/link.js +3 -6
- package/lib/link.stories.js +11 -0
- package/lib/link.ws.js +3 -6
- package/lib/list-item.js +3 -6
- package/lib/list-item.stories.js +11 -0
- package/lib/list-item.ws.js +3 -6
- package/lib/list.js +2 -4
- package/lib/list.stories.js +13 -0
- package/lib/list.ws.js +3 -6
- package/lib/metas.js +33 -66
- package/lib/paragraph.js +3 -6
- package/lib/paragraph.stories.js +11 -0
- package/lib/paragraph.ws.js +3 -6
- package/lib/props.js +33 -66
- package/lib/radio-button.js +3 -6
- package/lib/radio-button.ws.js +9 -11
- package/lib/rich-text-link.js +2 -4
- package/lib/rich-text-link.stories.js +11 -0
- package/lib/rich-text-link.ws.js +3 -6
- package/lib/separator.js +3 -6
- package/lib/separator.stories.js +7 -0
- package/lib/separator.ws.js +3 -6
- package/lib/slot.js +2 -4
- package/lib/slot.stories.js +11 -0
- package/lib/slot.ws.js +3 -6
- package/lib/span.js +3 -6
- package/lib/span.stories.js +11 -0
- package/lib/span.ws.js +3 -6
- package/lib/subscript.js +3 -6
- package/lib/subscript.stories.js +11 -0
- package/lib/subscript.ws.js +3 -6
- package/lib/superscript.js +3 -6
- package/lib/superscript.stories.js +11 -0
- package/lib/superscript.ws.js +3 -6
- package/lib/text.js +3 -6
- package/lib/text.stories.js +11 -0
- package/lib/text.ws.js +3 -6
- package/lib/textarea.js +3 -6
- package/lib/textarea.ws.js +9 -11
- package/lib/types/__generated__/blockquote.props.d.ts +1 -1
- package/lib/types/__generated__/body.props.d.ts +1 -1
- package/lib/types/__generated__/bold.props.d.ts +1 -1
- package/lib/types/__generated__/box.props.d.ts +1 -1
- package/lib/types/__generated__/button.props.d.ts +1 -1
- package/lib/types/__generated__/checkbox.props.d.ts +1 -1
- package/lib/types/__generated__/code-text.props.d.ts +1 -1
- package/lib/types/__generated__/form.props.d.ts +1 -1
- package/lib/types/__generated__/fragment.props.d.ts +1 -1
- package/lib/types/__generated__/heading.props.d.ts +1 -1
- package/lib/types/__generated__/html-embed.props.d.ts +1 -1
- package/lib/types/__generated__/image.props.d.ts +1 -1
- package/lib/types/__generated__/input.props.d.ts +1 -1
- package/lib/types/__generated__/italic.props.d.ts +1 -1
- package/lib/types/__generated__/label.props.d.ts +1 -1
- package/lib/types/__generated__/link.props.d.ts +1 -1
- package/lib/types/__generated__/list-item.props.d.ts +1 -1
- package/lib/types/__generated__/list.props.d.ts +1 -1
- package/lib/types/__generated__/paragraph.props.d.ts +1 -1
- package/lib/types/__generated__/radio-button.props.d.ts +1 -1
- package/lib/types/__generated__/rich-text-link.props.d.ts +1 -1
- package/lib/types/__generated__/separator.props.d.ts +1 -1
- package/lib/types/__generated__/slot.props.d.ts +1 -1
- package/lib/types/__generated__/span.props.d.ts +1 -1
- package/lib/types/__generated__/subscript.props.d.ts +1 -1
- package/lib/types/__generated__/superscript.props.d.ts +1 -1
- package/lib/types/__generated__/text.props.d.ts +1 -1
- package/lib/types/__generated__/textarea.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo-play-button.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo-preview-image.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo-spinner.props.d.ts +1 -1
- package/lib/types/__generated__/vimeo.props.d.ts +1 -1
- package/lib/types/vimeo-preview-image.d.ts +1 -1
- package/lib/vimeo-play-button.js +3 -5
- package/lib/vimeo-play-button.stories.js +11 -0
- package/lib/vimeo-play-button.ws.js +3 -6
- package/lib/vimeo-preview-image.js +2 -4
- package/lib/vimeo-preview-image.stories.js +11 -0
- package/lib/vimeo-preview-image.ws.js +3 -6
- package/lib/vimeo-spinner.js +2 -4
- package/lib/vimeo-spinner.stories.js +11 -0
- package/lib/vimeo-spinner.ws.js +3 -6
- package/lib/vimeo.js +3 -6
- package/lib/vimeo.stories.js +11 -0
- package/lib/vimeo.ws.js +3 -6
- package/package.json +16 -20
- package/lib/cjs/__generated__/blockquote.props.js +0 -536
- package/lib/cjs/__generated__/body.props.js +0 -530
- package/lib/cjs/__generated__/bold.props.js +0 -530
- package/lib/cjs/__generated__/box.props.js +0 -549
- package/lib/cjs/__generated__/button.props.js +0 -586
- package/lib/cjs/__generated__/checkbox.props.js +0 -688
- package/lib/cjs/__generated__/code-text.props.js +0 -530
- package/lib/cjs/__generated__/form.props.js +0 -578
- package/lib/cjs/__generated__/fragment.props.js +0 -24
- package/lib/cjs/__generated__/heading.props.js +0 -538
- package/lib/cjs/__generated__/html-embed.props.js +0 -31
- package/lib/cjs/__generated__/image.props.js +0 -603
- package/lib/cjs/__generated__/input.props.js +0 -695
- package/lib/cjs/__generated__/italic.props.js +0 -530
- package/lib/cjs/__generated__/label.props.js +0 -542
- package/lib/cjs/__generated__/link.props.js +0 -584
- package/lib/cjs/__generated__/list-item.props.js +0 -530
- package/lib/cjs/__generated__/list.props.js +0 -556
- package/lib/cjs/__generated__/paragraph.props.js +0 -530
- package/lib/cjs/__generated__/radio-button.props.js +0 -688
- package/lib/cjs/__generated__/rich-text-link.props.js +0 -584
- package/lib/cjs/__generated__/separator.props.js +0 -530
- package/lib/cjs/__generated__/slot.props.js +0 -24
- package/lib/cjs/__generated__/span.props.js +0 -530
- package/lib/cjs/__generated__/subscript.props.js +0 -530
- package/lib/cjs/__generated__/superscript.props.js +0 -530
- package/lib/cjs/__generated__/text.props.js +0 -538
- package/lib/cjs/__generated__/textarea.props.js +0 -597
- package/lib/cjs/__generated__/vimeo-play-button.props.js +0 -585
- package/lib/cjs/__generated__/vimeo-preview-image.props.js +0 -602
- package/lib/cjs/__generated__/vimeo-spinner.props.js +0 -530
- package/lib/cjs/__generated__/vimeo.props.js +0 -687
- package/lib/cjs/blockquote.js +0 -32
- package/lib/cjs/blockquote.ws.js +0 -96
- package/lib/cjs/body.js +0 -29
- package/lib/cjs/body.ws.js +0 -52
- package/lib/cjs/bold.js +0 -29
- package/lib/cjs/bold.ws.js +0 -42
- package/lib/cjs/box.js +0 -32
- package/lib/cjs/box.ws.js +0 -54
- package/lib/cjs/button.js +0 -31
- package/lib/cjs/button.ws.js +0 -57
- package/lib/cjs/checkbox.js +0 -29
- package/lib/cjs/checkbox.ws.js +0 -78
- package/lib/cjs/code-text.js +0 -30
- package/lib/cjs/code-text.ws.js +0 -75
- package/lib/cjs/components.js +0 -86
- package/lib/cjs/form.js +0 -29
- package/lib/cjs/form.ws.js +0 -84
- package/lib/cjs/fragment.js +0 -29
- package/lib/cjs/fragment.ws.js +0 -33
- package/lib/cjs/heading.js +0 -31
- package/lib/cjs/heading.ws.js +0 -58
- package/lib/cjs/html-embed.js +0 -80
- package/lib/cjs/html-embed.ws.js +0 -51
- package/lib/cjs/image.js +0 -86
- package/lib/cjs/image.ws.js +0 -70
- package/lib/cjs/input.js +0 -29
- package/lib/cjs/input.ws.js +0 -63
- package/lib/cjs/italic.js +0 -29
- package/lib/cjs/italic.ws.js +0 -48
- package/lib/cjs/label.js +0 -29
- package/lib/cjs/label.ws.js +0 -61
- package/lib/cjs/link.js +0 -52
- package/lib/cjs/link.ws.js +0 -81
- package/lib/cjs/list-item.js +0 -32
- package/lib/cjs/list-item.ws.js +0 -53
- package/lib/cjs/list.js +0 -31
- package/lib/cjs/list.ws.js +0 -74
- package/lib/cjs/metas.js +0 -86
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/paragraph.js +0 -29
- package/lib/cjs/paragraph.ws.js +0 -53
- package/lib/cjs/props.js +0 -86
- package/lib/cjs/radio-button.js +0 -29
- package/lib/cjs/radio-button.ws.js +0 -78
- package/lib/cjs/rich-text-link.js +0 -28
- package/lib/cjs/rich-text-link.ws.js +0 -32
- package/lib/cjs/separator.js +0 -32
- package/lib/cjs/separator.ws.js +0 -71
- package/lib/cjs/slot.js +0 -36
- package/lib/cjs/slot.ws.js +0 -37
- package/lib/cjs/span.js +0 -29
- package/lib/cjs/span.ws.js +0 -42
- package/lib/cjs/subscript.js +0 -29
- package/lib/cjs/subscript.ws.js +0 -42
- package/lib/cjs/superscript.js +0 -29
- package/lib/cjs/superscript.ws.js +0 -42
- package/lib/cjs/text.js +0 -32
- package/lib/cjs/text.ws.js +0 -58
- package/lib/cjs/textarea.js +0 -29
- package/lib/cjs/textarea.ws.js +0 -64
- package/lib/cjs/vimeo-play-button.js +0 -38
- package/lib/cjs/vimeo-play-button.ws.js +0 -46
- package/lib/cjs/vimeo-preview-image.js +0 -40
- package/lib/cjs/vimeo-preview-image.ws.js +0 -37
- package/lib/cjs/vimeo-spinner.js +0 -37
- package/lib/cjs/vimeo-spinner.ws.js +0 -44
- package/lib/cjs/vimeo.js +0 -294
- package/lib/cjs/vimeo.ws.js +0 -348
- package/src/LICENSE +0 -661
- package/src/__generated__/blockquote.props.ts +0 -580
- package/src/__generated__/body.props.ts +0 -573
- package/src/__generated__/bold.props.ts +0 -573
- package/src/__generated__/box.props.ts +0 -593
- package/src/__generated__/button.props.ts +0 -636
- package/src/__generated__/checkbox.props.ts +0 -748
- package/src/__generated__/code-text.props.ts +0 -573
- package/src/__generated__/form.props.ts +0 -628
- package/src/__generated__/fragment.props.ts +0 -3
- package/src/__generated__/heading.props.ts +0 -582
- package/src/__generated__/html-embed.props.ts +0 -10
- package/src/__generated__/image.props.ts +0 -648
- package/src/__generated__/input.props.ts +0 -756
- package/src/__generated__/italic.props.ts +0 -573
- package/src/__generated__/label.props.ts +0 -586
- package/src/__generated__/link.props.ts +0 -630
- package/src/__generated__/list-item.props.ts +0 -573
- package/src/__generated__/list.props.ts +0 -601
- package/src/__generated__/paragraph.props.ts +0 -573
- package/src/__generated__/radio-button.props.ts +0 -748
- package/src/__generated__/rich-text-link.props.ts +0 -630
- package/src/__generated__/separator.props.ts +0 -573
- package/src/__generated__/slot.props.ts +0 -3
- package/src/__generated__/span.props.ts +0 -573
- package/src/__generated__/subscript.props.ts +0 -573
- package/src/__generated__/superscript.props.ts +0 -573
- package/src/__generated__/text.props.ts +0 -582
- package/src/__generated__/textarea.props.ts +0 -645
- package/src/__generated__/vimeo-play-button.props.ts +0 -634
- package/src/__generated__/vimeo-preview-image.props.ts +0 -647
- package/src/__generated__/vimeo-spinner.props.ts +0 -573
- package/src/__generated__/vimeo.props.ts +0 -751
- package/src/blockquote.stories.tsx +0 -13
- package/src/blockquote.tsx +0 -18
- package/src/blockquote.ws.tsx +0 -84
- package/src/body.stories.tsx +0 -13
- package/src/body.tsx +0 -10
- package/src/body.ws.tsx +0 -37
- package/src/bold.stories.tsx +0 -13
- package/src/bold.tsx +0 -10
- package/src/bold.ws.tsx +0 -27
- package/src/box.stories.tsx +0 -13
- package/src/box.tsx +0 -32
- package/src/box.ws.ts +0 -54
- package/src/button.stories.tsx +0 -13
- package/src/button.tsx +0 -15
- package/src/button.ws.tsx +0 -43
- package/src/checkbox.tsx +0 -13
- package/src/checkbox.ws.tsx +0 -64
- package/src/code-text.stories.tsx +0 -13
- package/src/code-text.tsx +0 -17
- package/src/code-text.ws.tsx +0 -61
- package/src/components.ts +0 -32
- package/src/form.stories.tsx +0 -13
- package/src/form.tsx +0 -14
- package/src/form.ws.tsx +0 -69
- package/src/fragment.tsx +0 -11
- package/src/fragment.ws.ts +0 -15
- package/src/heading.stories.tsx +0 -13
- package/src/heading.tsx +0 -21
- package/src/heading.ws.tsx +0 -47
- package/src/html-embed.stories.tsx +0 -13
- package/src/html-embed.tsx +0 -99
- package/src/html-embed.ws.ts +0 -34
- package/src/image.stories.tsx +0 -9
- package/src/image.tsx +0 -91
- package/src/image.ws.tsx +0 -58
- package/src/input.stories.tsx +0 -11
- package/src/input.tsx +0 -13
- package/src/input.ws.tsx +0 -49
- package/src/italic.stories.tsx +0 -13
- package/src/italic.tsx +0 -10
- package/src/italic.ws.tsx +0 -33
- package/src/label.tsx +0 -10
- package/src/label.ws.tsx +0 -46
- package/src/link.stories.tsx +0 -13
- package/src/link.tsx +0 -43
- package/src/link.ws.tsx +0 -67
- package/src/list-item.stories.tsx +0 -13
- package/src/list-item.tsx +0 -18
- package/src/list-item.ws.tsx +0 -38
- package/src/list.stories.tsx +0 -14
- package/src/list.tsx +0 -27
- package/src/list.ws.tsx +0 -59
- package/src/metas.ts +0 -32
- package/src/paragraph.stories.tsx +0 -13
- package/src/paragraph.tsx +0 -10
- package/src/paragraph.ws.tsx +0 -38
- package/src/props.ts +0 -32
- package/src/radio-button.tsx +0 -13
- package/src/radio-button.ws.tsx +0 -64
- package/src/rich-text-link.stories.tsx +0 -13
- package/src/rich-text-link.tsx +0 -8
- package/src/rich-text-link.ws.tsx +0 -14
- package/src/separator.stories.tsx +0 -9
- package/src/separator.tsx +0 -18
- package/src/separator.ws.tsx +0 -58
- package/src/slot.stories.tsx +0 -13
- package/src/slot.tsx +0 -17
- package/src/slot.ws.ts +0 -20
- package/src/span.stories.tsx +0 -13
- package/src/span.tsx +0 -10
- package/src/span.ws.tsx +0 -27
- package/src/subscript.stories.tsx +0 -13
- package/src/subscript.tsx +0 -10
- package/src/subscript.ws.tsx +0 -27
- package/src/superscript.stories.tsx +0 -13
- package/src/superscript.tsx +0 -10
- package/src/superscript.ws.tsx +0 -27
- package/src/text.stories.tsx +0 -13
- package/src/text.tsx +0 -22
- package/src/text.ws.tsx +0 -44
- package/src/textarea.tsx +0 -13
- package/src/textarea.ws.tsx +0 -50
- package/src/vimeo-play-button.stories.tsx +0 -13
- package/src/vimeo-play-button.tsx +0 -24
- package/src/vimeo-play-button.ws.ts +0 -30
- package/src/vimeo-preview-image.stories.tsx +0 -13
- package/src/vimeo-preview-image.tsx +0 -30
- package/src/vimeo-preview-image.ws.ts +0 -22
- package/src/vimeo-spinner.stories.tsx +0 -13
- package/src/vimeo-spinner.tsx +0 -25
- package/src/vimeo-spinner.ws.ts +0 -28
- package/src/vimeo.stories.tsx +0 -13
- package/src/vimeo.tsx +0 -431
- package/src/vimeo.ws.ts +0 -335
package/src/link.stories.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Link as LinkPrimitive } from "./link";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Link",
|
|
6
|
-
component: LinkPrimitive,
|
|
7
|
-
} satisfies Meta<typeof LinkPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Link: StoryObj<typeof LinkPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "Link",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/link.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ComponentProps, useContext } from "react";
|
|
2
|
-
import {
|
|
3
|
-
usePropUrl,
|
|
4
|
-
getInstanceIdFromComponentProps,
|
|
5
|
-
ReactSdkContext,
|
|
6
|
-
} from "@webstudio-is/react-sdk";
|
|
7
|
-
|
|
8
|
-
export const defaultTag = "a";
|
|
9
|
-
|
|
10
|
-
type Props = Omit<ComponentProps<"a">, "target"> & {
|
|
11
|
-
// override (string & {}) in target to generate keywords
|
|
12
|
-
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const Link = forwardRef<HTMLAnchorElement, Props>((props, ref) => {
|
|
16
|
-
const { assetBaseUrl } = useContext(ReactSdkContext);
|
|
17
|
-
const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
|
|
18
|
-
|
|
19
|
-
let url = "#";
|
|
20
|
-
|
|
21
|
-
switch (href?.type) {
|
|
22
|
-
case "page": {
|
|
23
|
-
url = href.page.path === "" ? "/" : href.page.path;
|
|
24
|
-
const urlTo = new URL(url, "https://any-valid.url");
|
|
25
|
-
url = urlTo.pathname;
|
|
26
|
-
|
|
27
|
-
if (href.hash !== undefined) {
|
|
28
|
-
urlTo.hash = encodeURIComponent(href.hash);
|
|
29
|
-
url = `${urlTo.pathname}${urlTo.hash}`;
|
|
30
|
-
}
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
case "asset":
|
|
34
|
-
url = `${assetBaseUrl}${href.asset.name}`;
|
|
35
|
-
break;
|
|
36
|
-
case "string":
|
|
37
|
-
url = href.url;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return <a {...props} href={url} ref={ref} />;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
Link.displayName = "Link";
|
package/src/link.ws.tsx
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { LinkIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { a } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import type { defaultTag } from "./link";
|
|
10
|
-
import { props } from "./__generated__/link.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
a: [
|
|
14
|
-
...a,
|
|
15
|
-
{
|
|
16
|
-
property: "minHeight",
|
|
17
|
-
value: { type: "unit", unit: "em", value: 1 },
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
property: "display",
|
|
21
|
-
value: { type: "keyword", value: "inline-block" },
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
25
|
-
|
|
26
|
-
export const meta: WsComponentMeta = {
|
|
27
|
-
category: "general",
|
|
28
|
-
type: "container",
|
|
29
|
-
label: "Link",
|
|
30
|
-
description:
|
|
31
|
-
"Use a link to send your users to another page, section, or resource. Configure links in the Settings panel.",
|
|
32
|
-
icon: LinkIcon,
|
|
33
|
-
invalidAncestors: ["Link"],
|
|
34
|
-
presetStyle,
|
|
35
|
-
order: 1,
|
|
36
|
-
states: [
|
|
37
|
-
...defaultStates,
|
|
38
|
-
{
|
|
39
|
-
selector: ":visited",
|
|
40
|
-
label: "Visited",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
category: "component-states",
|
|
44
|
-
selector: "[aria-current=page]",
|
|
45
|
-
label: "Current page",
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
template: [
|
|
49
|
-
{
|
|
50
|
-
type: "instance",
|
|
51
|
-
component: "Link",
|
|
52
|
-
children: [{ type: "text", value: "Link text you can edit" }],
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
58
|
-
props: {
|
|
59
|
-
...props,
|
|
60
|
-
href: {
|
|
61
|
-
type: "string",
|
|
62
|
-
control: "url",
|
|
63
|
-
required: false,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
initialProps: ["id", "href", "target"],
|
|
67
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ListItem as ListItemPrimitive } from "./list-item";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/List Item",
|
|
6
|
-
component: ListItemPrimitive,
|
|
7
|
-
} satisfies Meta<typeof ListItemPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const ListItem: StoryObj<typeof ListItemPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "ListItem",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/list-item.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
createElement,
|
|
4
|
-
type ElementRef,
|
|
5
|
-
type ComponentProps,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
export const defaultTag = "li";
|
|
9
|
-
|
|
10
|
-
type Props = ComponentProps<typeof defaultTag>;
|
|
11
|
-
|
|
12
|
-
export const ListItem = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
13
|
-
(props, ref) => {
|
|
14
|
-
return createElement(defaultTag, { ...props, ref });
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
ListItem.displayName = "ListItem";
|
package/src/list-item.ws.tsx
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ListItemIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { li } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import type { defaultTag } from "./list-item";
|
|
10
|
-
import { props } from "./__generated__/list-item.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
li,
|
|
14
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
15
|
-
|
|
16
|
-
export const meta: WsComponentMeta = {
|
|
17
|
-
category: "general",
|
|
18
|
-
type: "container",
|
|
19
|
-
requiredAncestors: ["List"],
|
|
20
|
-
label: "List Item",
|
|
21
|
-
description: "Adds a new item to an existing list.",
|
|
22
|
-
icon: ListItemIcon,
|
|
23
|
-
states: defaultStates,
|
|
24
|
-
presetStyle,
|
|
25
|
-
template: [
|
|
26
|
-
{
|
|
27
|
-
type: "instance",
|
|
28
|
-
component: "ListItem",
|
|
29
|
-
children: [{ type: "text", value: "List Item you can edit" }],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
order: 4,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
36
|
-
props,
|
|
37
|
-
initialProps: ["id"],
|
|
38
|
-
};
|
package/src/list.stories.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { List as ListPrimitive } from "./list";
|
|
3
|
-
import { ListItem } from "./list-item";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: "Components/List",
|
|
7
|
-
component: ListPrimitive,
|
|
8
|
-
} satisfies Meta<typeof ListPrimitive>;
|
|
9
|
-
|
|
10
|
-
export const List: StoryObj<typeof ListPrimitive> = {
|
|
11
|
-
args: {
|
|
12
|
-
children: <ListItem>List</ListItem>,
|
|
13
|
-
},
|
|
14
|
-
};
|
package/src/list.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
createElement,
|
|
4
|
-
type ElementRef,
|
|
5
|
-
type ComponentProps,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
const unorderedTag = "ul";
|
|
9
|
-
const orderedTag = "ol";
|
|
10
|
-
|
|
11
|
-
export type ListTag = typeof unorderedTag | typeof orderedTag;
|
|
12
|
-
|
|
13
|
-
type Props = ComponentProps<typeof unorderedTag> &
|
|
14
|
-
ComponentProps<typeof orderedTag> & {
|
|
15
|
-
/** Shows numbers instead of bullets when toggled. See the “List Style Type” property under the “List Item” section in the Style panel for more options. */
|
|
16
|
-
ordered?: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const List = forwardRef<
|
|
20
|
-
ElementRef<typeof unorderedTag | typeof orderedTag>,
|
|
21
|
-
Props
|
|
22
|
-
>(({ ordered = false, ...props }, ref) => {
|
|
23
|
-
const tag = ordered ? orderedTag : unorderedTag;
|
|
24
|
-
return createElement(tag, { ...props, ref });
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
List.displayName = "List";
|
package/src/list.ws.tsx
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ListIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { ol, ul } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import { props } from "./__generated__/list.props";
|
|
10
|
-
import type { ListTag } from "./list";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
ol: [
|
|
14
|
-
...ol,
|
|
15
|
-
{
|
|
16
|
-
property: "marginTop",
|
|
17
|
-
value: { type: "keyword", value: "0" },
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
property: "marginBottom",
|
|
21
|
-
value: { type: "keyword", value: "10px" },
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
property: "paddingLeft",
|
|
25
|
-
value: { type: "keyword", value: "40px" },
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
ul: [
|
|
29
|
-
...ul,
|
|
30
|
-
{
|
|
31
|
-
property: "marginTop",
|
|
32
|
-
value: { type: "keyword", value: "0" },
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
property: "marginBottom",
|
|
36
|
-
value: { type: "keyword", value: "10px" },
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
property: "paddingLeft",
|
|
40
|
-
value: { type: "keyword", value: "40px" },
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
} satisfies PresetStyle<ListTag>;
|
|
44
|
-
|
|
45
|
-
export const meta: WsComponentMeta = {
|
|
46
|
-
category: "general",
|
|
47
|
-
type: "container",
|
|
48
|
-
label: "List",
|
|
49
|
-
description: "Groups content, like links in a menu or steps in a recipe.",
|
|
50
|
-
icon: ListIcon,
|
|
51
|
-
states: defaultStates,
|
|
52
|
-
presetStyle,
|
|
53
|
-
order: 3,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
57
|
-
props,
|
|
58
|
-
initialProps: ["id", "ordered", "start", "reversed"],
|
|
59
|
-
};
|
package/src/metas.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export { meta as Slot } from "./slot.ws";
|
|
2
|
-
export { meta as Fragment } from "./fragment.ws";
|
|
3
|
-
export { meta as HtmlEmbed } from "./html-embed.ws";
|
|
4
|
-
export { meta as Body } from "./body.ws";
|
|
5
|
-
export { meta as Box } from "./box.ws";
|
|
6
|
-
export { meta as Text } from "./text.ws";
|
|
7
|
-
export { meta as Heading } from "./heading.ws";
|
|
8
|
-
export { meta as Paragraph } from "./paragraph.ws";
|
|
9
|
-
export { meta as Link } from "./link.ws";
|
|
10
|
-
export { meta as RichTextLink } from "./rich-text-link.ws";
|
|
11
|
-
export { meta as Span } from "./span.ws";
|
|
12
|
-
export { meta as Bold } from "./bold.ws";
|
|
13
|
-
export { meta as Italic } from "./italic.ws";
|
|
14
|
-
export { meta as Superscript } from "./superscript.ws";
|
|
15
|
-
export { meta as Subscript } from "./subscript.ws";
|
|
16
|
-
export { meta as Button } from "./button.ws";
|
|
17
|
-
export { meta as Input } from "./input.ws";
|
|
18
|
-
export { meta as Form } from "./form.ws";
|
|
19
|
-
export { meta as Image } from "./image.ws";
|
|
20
|
-
export { meta as Blockquote } from "./blockquote.ws";
|
|
21
|
-
export { meta as List } from "./list.ws";
|
|
22
|
-
export { meta as ListItem } from "./list-item.ws";
|
|
23
|
-
export { meta as Separator } from "./separator.ws";
|
|
24
|
-
export { meta as CodeText } from "./code-text.ws";
|
|
25
|
-
export { meta as Label } from "./label.ws";
|
|
26
|
-
export { meta as Textarea } from "./textarea.ws";
|
|
27
|
-
export { meta as RadioButton } from "./radio-button.ws";
|
|
28
|
-
export { meta as Checkbox } from "./checkbox.ws";
|
|
29
|
-
export { meta as Vimeo } from "./vimeo.ws";
|
|
30
|
-
export { meta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
|
31
|
-
export { meta as VimeoPlayButton } from "./vimeo-play-button.ws";
|
|
32
|
-
export { meta as VimeoSpinner } from "./vimeo-spinner.ws";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Paragraph as ParagraphPrimitive } from "./paragraph";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Paragraph",
|
|
6
|
-
component: ParagraphPrimitive,
|
|
7
|
-
} satisfies Meta<typeof ParagraphPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Paragraph: StoryObj<typeof ParagraphPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "paragraph",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/paragraph.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "p";
|
|
4
|
-
|
|
5
|
-
export const Paragraph = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag>
|
|
8
|
-
>((props, ref) => <p {...props} ref={ref} />);
|
|
9
|
-
|
|
10
|
-
Paragraph.displayName = "Paragraph";
|
package/src/paragraph.ws.tsx
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { TextAlignLeftIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { p } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import type { defaultTag } from "./paragraph";
|
|
10
|
-
import { props } from "./__generated__/paragraph.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
p,
|
|
14
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
15
|
-
|
|
16
|
-
export const meta: WsComponentMeta = {
|
|
17
|
-
category: "text",
|
|
18
|
-
type: "container",
|
|
19
|
-
label: "Paragraph",
|
|
20
|
-
description: "A container for multi-line text.",
|
|
21
|
-
icon: TextAlignLeftIcon,
|
|
22
|
-
invalidAncestors: ["Paragraph"],
|
|
23
|
-
states: defaultStates,
|
|
24
|
-
presetStyle,
|
|
25
|
-
template: [
|
|
26
|
-
{
|
|
27
|
-
type: "instance",
|
|
28
|
-
component: "Paragraph",
|
|
29
|
-
children: [{ type: "text", value: "Paragraph you can edit" }],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
order: 2,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
36
|
-
props,
|
|
37
|
-
initialProps: ["id"],
|
|
38
|
-
};
|
package/src/props.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export { propsMeta as Slot } from "./slot.ws";
|
|
2
|
-
export { propsMeta as Fragment } from "./fragment.ws";
|
|
3
|
-
export { propsMeta as HtmlEmbed } from "./html-embed.ws";
|
|
4
|
-
export { propsMeta as Body } from "./body.ws";
|
|
5
|
-
export { propsMeta as Box } from "./box.ws";
|
|
6
|
-
export { propsMeta as Text } from "./text.ws";
|
|
7
|
-
export { propsMeta as Heading } from "./heading.ws";
|
|
8
|
-
export { propsMeta as Paragraph } from "./paragraph.ws";
|
|
9
|
-
export { propsMeta as Link } from "./link.ws";
|
|
10
|
-
export { propsMeta as RichTextLink } from "./rich-text-link.ws";
|
|
11
|
-
export { propsMeta as Span } from "./span.ws";
|
|
12
|
-
export { propsMeta as Bold } from "./bold.ws";
|
|
13
|
-
export { propsMeta as Italic } from "./italic.ws";
|
|
14
|
-
export { propsMeta as Superscript } from "./superscript.ws";
|
|
15
|
-
export { propsMeta as Subscript } from "./subscript.ws";
|
|
16
|
-
export { propsMeta as Button } from "./button.ws";
|
|
17
|
-
export { propsMeta as Input } from "./input.ws";
|
|
18
|
-
export { propsMeta as Form } from "./form.ws";
|
|
19
|
-
export { propsMeta as Image } from "./image.ws";
|
|
20
|
-
export { propsMeta as Blockquote } from "./blockquote.ws";
|
|
21
|
-
export { propsMeta as List } from "./list.ws";
|
|
22
|
-
export { propsMeta as ListItem } from "./list-item.ws";
|
|
23
|
-
export { propsMeta as Separator } from "./separator.ws";
|
|
24
|
-
export { propsMeta as CodeText } from "./code-text.ws";
|
|
25
|
-
export { propsMeta as Label } from "./label.ws";
|
|
26
|
-
export { propsMeta as Textarea } from "./textarea.ws";
|
|
27
|
-
export { propsMeta as RadioButton } from "./radio-button.ws";
|
|
28
|
-
export { propsMeta as Checkbox } from "./checkbox.ws";
|
|
29
|
-
export { propsMeta as Vimeo } from "./vimeo.ws";
|
|
30
|
-
export { propsMeta as VimeoPreviewImage } from "./vimeo-preview-image.ws";
|
|
31
|
-
export { propsMeta as VimeoPlayButton } from "./vimeo-play-button.ws";
|
|
32
|
-
export { propsMeta as VimeoSpinner } from "./vimeo-spinner.ws";
|
package/src/radio-button.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "input";
|
|
4
|
-
|
|
5
|
-
export const RadioButton = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
Omit<ComponentProps<typeof defaultTag>, "type">
|
|
8
|
-
// Make sure children are not passed down to an input, because this will result in error.
|
|
9
|
-
>(({ children: _children, ...props }, ref) => (
|
|
10
|
-
<input {...props} type="radio" ref={ref} />
|
|
11
|
-
));
|
|
12
|
-
|
|
13
|
-
RadioButton.displayName = "RadioButton";
|
package/src/radio-button.ws.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { RadioCheckedIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
type WsComponentMeta,
|
|
4
|
-
type WsComponentPropsMeta,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
defaultStates,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import type { defaultTag } from "./radio-button";
|
|
9
|
-
import { input } from "@webstudio-is/react-sdk/css-normalize";
|
|
10
|
-
import { props } from "./__generated__/radio-button.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
input: [
|
|
14
|
-
...input,
|
|
15
|
-
{
|
|
16
|
-
property: "marginRight",
|
|
17
|
-
value: { type: "unit", unit: "em", value: 0.5 },
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
|
-
|
|
22
|
-
export const meta: WsComponentMeta = {
|
|
23
|
-
category: "forms",
|
|
24
|
-
invalidAncestors: ["Button"],
|
|
25
|
-
type: "control",
|
|
26
|
-
label: "Radio",
|
|
27
|
-
description:
|
|
28
|
-
"Use within a form to allow your users to select a single option from a set of mutually exclusive choices. Group multiple radios by matching their “Name” properties.",
|
|
29
|
-
icon: RadioCheckedIcon,
|
|
30
|
-
presetStyle,
|
|
31
|
-
order: 5,
|
|
32
|
-
states: [
|
|
33
|
-
...defaultStates,
|
|
34
|
-
{ selector: ":checked", label: "Checked" },
|
|
35
|
-
{ selector: ":required", label: "Required" },
|
|
36
|
-
{ selector: ":optional", label: "Optional" },
|
|
37
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
38
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
39
|
-
{ selector: ":read-only", label: "Read Only" },
|
|
40
|
-
{ selector: ":read-write", label: "Read Write" },
|
|
41
|
-
],
|
|
42
|
-
template: [
|
|
43
|
-
{
|
|
44
|
-
type: "instance",
|
|
45
|
-
component: "Label",
|
|
46
|
-
label: "Radio Field",
|
|
47
|
-
children: [
|
|
48
|
-
{ type: "instance", component: "RadioButton", props: [], children: [] },
|
|
49
|
-
{
|
|
50
|
-
type: "instance",
|
|
51
|
-
component: "Text",
|
|
52
|
-
label: "Radio Label",
|
|
53
|
-
props: [{ type: "string", name: "tag", value: "span" }],
|
|
54
|
-
children: [{ type: "text", value: "Radio" }],
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
62
|
-
props,
|
|
63
|
-
initialProps: ["id", "name"],
|
|
64
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { RichTextLink as LinkPrimitive } from "./rich-text-link";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/RichTextLink",
|
|
6
|
-
component: LinkPrimitive,
|
|
7
|
-
} satisfies Meta<typeof LinkPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const RichTextLink: StoryObj<typeof LinkPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "RichTextLink",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/rich-text-link.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
WsComponentMeta,
|
|
3
|
-
WsComponentPropsMeta,
|
|
4
|
-
} from "@webstudio-is/react-sdk";
|
|
5
|
-
import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
|
|
6
|
-
|
|
7
|
-
export const meta: WsComponentMeta = {
|
|
8
|
-
...linkMeta,
|
|
9
|
-
category: "hidden",
|
|
10
|
-
type: "rich-text-child",
|
|
11
|
-
template: [],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const propsMeta: WsComponentPropsMeta = linkPropsMeta;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Separator as SeparatorPrimitive } from "./separator";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Separator",
|
|
6
|
-
component: SeparatorPrimitive,
|
|
7
|
-
} satisfies Meta<typeof SeparatorPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Separator: StoryObj<typeof SeparatorPrimitive> = {};
|
package/src/separator.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
createElement,
|
|
4
|
-
type ElementRef,
|
|
5
|
-
type ComponentProps,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
export const defaultTag = "hr";
|
|
9
|
-
|
|
10
|
-
type Props = ComponentProps<typeof defaultTag>;
|
|
11
|
-
|
|
12
|
-
export const Separator = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
13
|
-
(props, ref) => {
|
|
14
|
-
return createElement(defaultTag, { ...props, ref });
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
Separator.displayName = "Separator";
|
package/src/separator.ws.tsx
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { DashIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import {
|
|
3
|
-
defaultStates,
|
|
4
|
-
type PresetStyle,
|
|
5
|
-
type WsComponentMeta,
|
|
6
|
-
type WsComponentPropsMeta,
|
|
7
|
-
} from "@webstudio-is/react-sdk";
|
|
8
|
-
import { hr } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import { props } from "./__generated__/separator.props";
|
|
10
|
-
import type { defaultTag } from "./separator";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
hr: [
|
|
14
|
-
...hr,
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
property: "height",
|
|
18
|
-
value: { type: "keyword", value: "1px" },
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
property: "backgroundColor",
|
|
22
|
-
value: { type: "keyword", value: "gray" },
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
property: "borderTopStyle",
|
|
26
|
-
value: { type: "keyword", value: "none" },
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
property: "borderRightStyle",
|
|
30
|
-
value: { type: "keyword", value: "none" },
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
property: "borderLeftStyle",
|
|
34
|
-
value: { type: "keyword", value: "none" },
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
property: "borderBottomStyle",
|
|
38
|
-
value: { type: "keyword", value: "none" },
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
42
|
-
|
|
43
|
-
export const meta: WsComponentMeta = {
|
|
44
|
-
category: "general",
|
|
45
|
-
type: "embed",
|
|
46
|
-
label: "Separator",
|
|
47
|
-
description:
|
|
48
|
-
"Used to visually divide sections of content, helping to improve readability and organization within a webpage.",
|
|
49
|
-
icon: DashIcon,
|
|
50
|
-
states: defaultStates,
|
|
51
|
-
presetStyle,
|
|
52
|
-
order: 5,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
56
|
-
props,
|
|
57
|
-
initialProps: ["id"],
|
|
58
|
-
};
|
package/src/slot.stories.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Slot as SlotPrimitive } from "./slot";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Slot",
|
|
6
|
-
component: SlotPrimitive,
|
|
7
|
-
} satisfies Meta<typeof SlotPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Slot: StoryObj<typeof SlotPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "Slot",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/slot.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
type Props = {
|
|
4
|
-
children?: ReactNode;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const Slot = forwardRef<ElementRef<"div">, Props>((props, ref) => {
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
{...props}
|
|
11
|
-
ref={ref}
|
|
12
|
-
style={{ display: props.children ? "contents" : "block" }}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
Slot.displayName = "Slot";
|