@webstudio-is/sdk-components-react 0.90.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/form.ws.tsx
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { FormIcon } 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 { form } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import type { defaultTag } from "./form";
|
|
10
|
-
import { props } from "./__generated__/form.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
form: [
|
|
14
|
-
...form,
|
|
15
|
-
{ property: "minHeight", value: { type: "unit", unit: "px", value: 20 } },
|
|
16
|
-
],
|
|
17
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
18
|
-
|
|
19
|
-
export const meta: WsComponentMeta = {
|
|
20
|
-
category: "forms",
|
|
21
|
-
type: "container",
|
|
22
|
-
invalidAncestors: ["Form"],
|
|
23
|
-
label: "Form",
|
|
24
|
-
description: "Collect information from your users using validation rules.",
|
|
25
|
-
icon: FormIcon,
|
|
26
|
-
states: defaultStates,
|
|
27
|
-
presetStyle,
|
|
28
|
-
order: 0,
|
|
29
|
-
template: [
|
|
30
|
-
{
|
|
31
|
-
type: "instance",
|
|
32
|
-
component: "Form",
|
|
33
|
-
children: [
|
|
34
|
-
{
|
|
35
|
-
type: "instance",
|
|
36
|
-
component: "Label",
|
|
37
|
-
children: [{ type: "text", value: "Name" }],
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: "instance",
|
|
41
|
-
component: "Input",
|
|
42
|
-
props: [{ type: "string", name: "name", value: "name" }],
|
|
43
|
-
children: [],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
type: "instance",
|
|
47
|
-
component: "Label",
|
|
48
|
-
children: [{ type: "text", value: "Email" }],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: "instance",
|
|
52
|
-
component: "Input",
|
|
53
|
-
props: [{ type: "string", name: "name", value: "email" }],
|
|
54
|
-
children: [],
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: "instance",
|
|
58
|
-
component: "Button",
|
|
59
|
-
children: [{ type: "text", value: "Submit" }],
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
67
|
-
props,
|
|
68
|
-
initialProps: ["id", "action"],
|
|
69
|
-
};
|
package/src/fragment.tsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
type Props = {
|
|
4
|
-
children?: ReactNode;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const Fragment = forwardRef<ElementRef<"div">, Props>((props, ref) => {
|
|
8
|
-
return <div {...props} ref={ref} style={{ display: "contents" }} />;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
Fragment.displayName = "Fragment";
|
package/src/fragment.ws.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
WsComponentMeta,
|
|
3
|
-
WsComponentPropsMeta,
|
|
4
|
-
} from "@webstudio-is/react-sdk";
|
|
5
|
-
|
|
6
|
-
export const meta: WsComponentMeta = {
|
|
7
|
-
type: "container",
|
|
8
|
-
label: "Fragment",
|
|
9
|
-
icon: "",
|
|
10
|
-
stylable: false,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
14
|
-
props: {},
|
|
15
|
-
};
|
package/src/heading.stories.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Heading as HeadingPrimitive } from "./heading";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Heading",
|
|
6
|
-
component: HeadingPrimitive,
|
|
7
|
-
} satisfies Meta<typeof HeadingPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Heading: StoryObj<typeof HeadingPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "Heading",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/heading.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
createElement,
|
|
4
|
-
type ElementRef,
|
|
5
|
-
type ComponentProps,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
const defaultTag = "h1";
|
|
9
|
-
|
|
10
|
-
type Props = ComponentProps<typeof defaultTag> & {
|
|
11
|
-
/** Use HTML heading levels (h1-h6) to structure content hierarchically, with h1 as the main title and subsequent levels representing sub-sections. Maintain a logical order and avoid skipping levels to ensure consistent and meaningful organization. */
|
|
12
|
-
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const Heading = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
16
|
-
({ tag = defaultTag, ...props }, ref) => {
|
|
17
|
-
return createElement(tag, { ...props, ref });
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
Heading.displayName = "Heading";
|
package/src/heading.ws.tsx
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { HeadingIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
type WsComponentMeta,
|
|
7
|
-
type WsComponentPropsMeta,
|
|
8
|
-
} from "@webstudio-is/react-sdk";
|
|
9
|
-
import { h1, h2, h3, h4, h5, h6 } from "@webstudio-is/react-sdk/css-normalize";
|
|
10
|
-
import type { Heading } from "./heading";
|
|
11
|
-
import { props } from "./__generated__/heading.props";
|
|
12
|
-
|
|
13
|
-
type HeadingTags = NonNullable<ComponentProps<typeof Heading>["tag"]>;
|
|
14
|
-
|
|
15
|
-
const presetStyle = {
|
|
16
|
-
h1,
|
|
17
|
-
h2,
|
|
18
|
-
h3,
|
|
19
|
-
h4,
|
|
20
|
-
h5,
|
|
21
|
-
h6,
|
|
22
|
-
} satisfies PresetStyle<HeadingTags>;
|
|
23
|
-
|
|
24
|
-
export const meta: WsComponentMeta = {
|
|
25
|
-
category: "text",
|
|
26
|
-
type: "container",
|
|
27
|
-
label: "Heading",
|
|
28
|
-
description:
|
|
29
|
-
"Use HTML headings to structure and organize content. Use the Tag property in settings to change the heading level (h1-h6).",
|
|
30
|
-
icon: HeadingIcon,
|
|
31
|
-
invalidAncestors: ["Heading"],
|
|
32
|
-
states: defaultStates,
|
|
33
|
-
presetStyle,
|
|
34
|
-
template: [
|
|
35
|
-
{
|
|
36
|
-
type: "instance",
|
|
37
|
-
component: "Heading",
|
|
38
|
-
children: [{ type: "text", value: "Heading you can edit" }],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
order: 1,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
45
|
-
props,
|
|
46
|
-
initialProps: ["id", "tag"],
|
|
47
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { HtmlEmbed as HtmlEmbedPrimitive } from "./html-embed";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/HtmlEmbed",
|
|
6
|
-
component: HtmlEmbedPrimitive,
|
|
7
|
-
} satisfies Meta<typeof HtmlEmbedPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const HtmlEmbed: StoryObj<typeof HtmlEmbedPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
code: "<strong>custom code</strong>",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/html-embed.tsx
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useContext,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
type ForwardedRef,
|
|
7
|
-
} from "react";
|
|
8
|
-
import { mergeRefs } from "@react-aria/utils";
|
|
9
|
-
import { ReactSdkContext } from "@webstudio-is/react-sdk";
|
|
10
|
-
|
|
11
|
-
type Props = {
|
|
12
|
-
code: string;
|
|
13
|
-
executeScriptOnCanvas: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type ChildProps = {
|
|
17
|
-
innerRef: ForwardedRef<HTMLDivElement>;
|
|
18
|
-
// code can be actually undefined when prop is not provided
|
|
19
|
-
code?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Scripts are executed when rendered client side.
|
|
24
|
-
* Necessary on canvas which does not have server rendering.
|
|
25
|
-
*/
|
|
26
|
-
const ExecutableHtml = (props: ChildProps) => {
|
|
27
|
-
const { code, innerRef, ...rest } = props;
|
|
28
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const container = containerRef.current;
|
|
32
|
-
if (container === null || code === undefined) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
// the trick to execute inserted scripts
|
|
36
|
-
// https://ghinda.net/article/script-tags
|
|
37
|
-
const range = document.createRange();
|
|
38
|
-
range.setStart(container, 0);
|
|
39
|
-
const fragment = range.createContextualFragment(code);
|
|
40
|
-
while (container.firstChild) {
|
|
41
|
-
container.removeChild(container.firstChild);
|
|
42
|
-
}
|
|
43
|
-
container.append(fragment);
|
|
44
|
-
}, [code]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
{...rest}
|
|
49
|
-
ref={mergeRefs(innerRef, containerRef)}
|
|
50
|
-
style={{ display: "contents" }}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Scripts are executed when rendered server side
|
|
57
|
-
*/
|
|
58
|
-
const InnerHtml = (props: ChildProps) => {
|
|
59
|
-
const { code, innerRef, ...rest } = props;
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
{...rest}
|
|
64
|
-
ref={innerRef}
|
|
65
|
-
style={{ display: "contents" }}
|
|
66
|
-
dangerouslySetInnerHTML={{ __html: props.code ?? "" }}
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const Placeholder = (props: ChildProps) => {
|
|
72
|
-
const { code, innerRef, ...rest } = props;
|
|
73
|
-
return (
|
|
74
|
-
<div ref={innerRef} {...rest} style={{ padding: "20px" }}>
|
|
75
|
-
{'Open the "Settings" panel to insert HTML code'}
|
|
76
|
-
</div>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const HtmlEmbed = forwardRef<HTMLDivElement, Props>((props, ref) => {
|
|
81
|
-
const { renderer } = useContext(ReactSdkContext);
|
|
82
|
-
const { code, executeScriptOnCanvas, ...rest } = props;
|
|
83
|
-
|
|
84
|
-
// code can be actually undefined when prop is not provided
|
|
85
|
-
if (code === undefined || code.trim().length === 0) {
|
|
86
|
-
return <Placeholder innerRef={ref} {...rest} />;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
(renderer === "canvas" && executeScriptOnCanvas === true) ||
|
|
91
|
-
renderer === "preview"
|
|
92
|
-
) {
|
|
93
|
-
return <ExecutableHtml innerRef={ref} code={code} {...rest} />;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return <InnerHtml innerRef={ref} code={code} {...rest} />;
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
HtmlEmbed.displayName = "HtmlEmbed";
|
package/src/html-embed.ws.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EmbedIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import type {
|
|
3
|
-
WsComponentMeta,
|
|
4
|
-
WsComponentPropsMeta,
|
|
5
|
-
} from "@webstudio-is/react-sdk";
|
|
6
|
-
import { props } from "./__generated__/html-embed.props";
|
|
7
|
-
|
|
8
|
-
export const meta: WsComponentMeta = {
|
|
9
|
-
category: "general",
|
|
10
|
-
type: "embed",
|
|
11
|
-
label: "HTML Embed",
|
|
12
|
-
description: "Used to add HTML code to the page, such as an SVG or script.",
|
|
13
|
-
icon: EmbedIcon,
|
|
14
|
-
stylable: false,
|
|
15
|
-
order: 7,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
19
|
-
props: {
|
|
20
|
-
...props,
|
|
21
|
-
|
|
22
|
-
executeScriptOnCanvas: {
|
|
23
|
-
...props.executeScriptOnCanvas,
|
|
24
|
-
label: "Run script on canvas",
|
|
25
|
-
},
|
|
26
|
-
code: {
|
|
27
|
-
required: true,
|
|
28
|
-
control: "code",
|
|
29
|
-
type: "string",
|
|
30
|
-
rows: 10,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
initialProps: [],
|
|
34
|
-
};
|
package/src/image.stories.tsx
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Image as ImagePrimitive } from "./image";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Image",
|
|
6
|
-
component: ImagePrimitive,
|
|
7
|
-
} satisfies Meta<typeof ImagePrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Image: StoryObj<typeof ImagePrimitive> = {};
|
package/src/image.tsx
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ComponentPropsWithoutRef,
|
|
3
|
-
type ElementRef,
|
|
4
|
-
forwardRef,
|
|
5
|
-
useMemo,
|
|
6
|
-
useContext,
|
|
7
|
-
} from "react";
|
|
8
|
-
import {
|
|
9
|
-
Image as WebstudioImage,
|
|
10
|
-
createImageLoader,
|
|
11
|
-
} from "@webstudio-is/image";
|
|
12
|
-
import {
|
|
13
|
-
usePropAsset,
|
|
14
|
-
getInstanceIdFromComponentProps,
|
|
15
|
-
ReactSdkContext,
|
|
16
|
-
} from "@webstudio-is/react-sdk";
|
|
17
|
-
|
|
18
|
-
export const defaultTag = "img";
|
|
19
|
-
|
|
20
|
-
const imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
|
|
21
|
-
width="140"
|
|
22
|
-
height="140"
|
|
23
|
-
viewBox="0 0 600 600"
|
|
24
|
-
fill="none"
|
|
25
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
-
>
|
|
27
|
-
<rect width="600" height="600" fill="#CCCCCC" />
|
|
28
|
-
<path
|
|
29
|
-
fill-rule="evenodd"
|
|
30
|
-
clip-rule="evenodd"
|
|
31
|
-
d="M450 170H150C141.716 170 135 176.716 135 185V415C135 423.284 141.716 430 150 430H450C458.284 430 465 423.284 465 415V185C465 176.716 458.284 170 450 170ZM150 145C127.909 145 110 162.909 110 185V415C110 437.091 127.909 455 150 455H450C472.091 455 490 437.091 490 415V185C490 162.909 472.091 145 450 145H150Z"
|
|
32
|
-
fill="#A2A2A2"
|
|
33
|
-
/>
|
|
34
|
-
<path
|
|
35
|
-
d="M237.135 235.012C237.135 255.723 220.345 272.512 199.635 272.512C178.924 272.512 162.135 255.723 162.135 235.012C162.135 214.301 178.924 197.512 199.635 197.512C220.345 197.512 237.135 214.301 237.135 235.012Z"
|
|
36
|
-
fill="#A2A2A2"
|
|
37
|
-
/>
|
|
38
|
-
<path
|
|
39
|
-
d="M160 405V367.205L221.609 306.364L256.552 338.628L358.161 234L440 316.043V405H160Z"
|
|
40
|
-
fill="#A2A2A2"
|
|
41
|
-
/>
|
|
42
|
-
</svg>`)}`;
|
|
43
|
-
|
|
44
|
-
type Props = Omit<ComponentPropsWithoutRef<typeof WebstudioImage>, "loader">;
|
|
45
|
-
|
|
46
|
-
export const Image = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
47
|
-
({ loading = "lazy", ...props }, ref) => {
|
|
48
|
-
const { imageBaseUrl } = useContext(ReactSdkContext);
|
|
49
|
-
const asset = usePropAsset(getInstanceIdFromComponentProps(props), "src");
|
|
50
|
-
|
|
51
|
-
const loader = useMemo(() => {
|
|
52
|
-
return createImageLoader({ imageBaseUrl });
|
|
53
|
-
}, [imageBaseUrl]);
|
|
54
|
-
|
|
55
|
-
const src = asset?.name ?? props.src;
|
|
56
|
-
|
|
57
|
-
if (asset == null || loader == null) {
|
|
58
|
-
return (
|
|
59
|
-
<img
|
|
60
|
-
key={src}
|
|
61
|
-
loading={loading}
|
|
62
|
-
{...props}
|
|
63
|
-
src={src || imagePlaceholderSvg}
|
|
64
|
-
ref={ref}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<WebstudioImage
|
|
71
|
-
/**
|
|
72
|
-
* `key` is needed to recreate the image in case of asset change in builder,
|
|
73
|
-
* this gives immediate feedback when an asset is changed.
|
|
74
|
-
* Also, it visually fixes image distortion when another asset has a seriously different aspectRatio
|
|
75
|
-
* (we change aspectRatio CSS prop on asset change)
|
|
76
|
-
*
|
|
77
|
-
* In non-builder mode, key on images are usually also a good idea,
|
|
78
|
-
* prevents showing outdated images on route change.
|
|
79
|
-
**/
|
|
80
|
-
key={src}
|
|
81
|
-
loading={loading}
|
|
82
|
-
{...props}
|
|
83
|
-
loader={loader}
|
|
84
|
-
src={src}
|
|
85
|
-
ref={ref}
|
|
86
|
-
/>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
Image.displayName = "Image";
|
package/src/image.ws.tsx
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ImageIcon } 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 { img } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import type { defaultTag } from "./image";
|
|
10
|
-
import { props } from "./__generated__/image.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
img: [
|
|
14
|
-
...img,
|
|
15
|
-
|
|
16
|
-
// Otherwise on new image insert onto canvas it can overfit screen size multiple times
|
|
17
|
-
{
|
|
18
|
-
property: "maxWidth",
|
|
19
|
-
value: { type: "unit", unit: "%", value: 100 },
|
|
20
|
-
},
|
|
21
|
-
// inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
|
|
22
|
-
// see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
|
|
23
|
-
{
|
|
24
|
-
property: "display",
|
|
25
|
-
value: { type: "keyword", value: "block" },
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
29
|
-
|
|
30
|
-
export const meta: WsComponentMeta = {
|
|
31
|
-
category: "media",
|
|
32
|
-
type: "embed",
|
|
33
|
-
label: "Image",
|
|
34
|
-
description:
|
|
35
|
-
"Add an image asset to the page. Webstudio automatically converts images to WebP or AVIF format and makes them responsive for best performance.",
|
|
36
|
-
icon: ImageIcon,
|
|
37
|
-
states: defaultStates,
|
|
38
|
-
presetStyle,
|
|
39
|
-
order: 0,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Automatically generated props don't have the right control.
|
|
43
|
-
export const propsOverrides = {
|
|
44
|
-
src: {
|
|
45
|
-
type: "string",
|
|
46
|
-
control: "file",
|
|
47
|
-
label: "Source",
|
|
48
|
-
required: false,
|
|
49
|
-
},
|
|
50
|
-
} as const;
|
|
51
|
-
|
|
52
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
53
|
-
props: {
|
|
54
|
-
...props,
|
|
55
|
-
...propsOverrides,
|
|
56
|
-
},
|
|
57
|
-
initialProps: ["id", "src", "width", "height", "alt", "loading"],
|
|
58
|
-
};
|
package/src/input.stories.tsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Input as InputPrimitive } from "./input";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Input",
|
|
6
|
-
component: InputPrimitive,
|
|
7
|
-
} satisfies Meta<typeof InputPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Input: StoryObj<typeof InputPrimitive> = {
|
|
10
|
-
args: {},
|
|
11
|
-
};
|
package/src/input.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 Input = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag> & {
|
|
8
|
-
type?: "text" | "email" | "password" | "number" | "tel" | "url";
|
|
9
|
-
}
|
|
10
|
-
// Make sure children are not passed down to an input, because this will result in error.
|
|
11
|
-
>(({ children: _children, ...props }, ref) => <input {...props} ref={ref} />);
|
|
12
|
-
|
|
13
|
-
Input.displayName = "Input";
|
package/src/input.ws.tsx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { FormTextFieldIcon } 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 { input } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import type { defaultTag } from "./input";
|
|
10
|
-
import { props } from "./__generated__/input.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
input: [
|
|
14
|
-
...input,
|
|
15
|
-
{
|
|
16
|
-
property: "display",
|
|
17
|
-
value: { type: "keyword", value: "block" },
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
|
-
|
|
22
|
-
export const meta: WsComponentMeta = {
|
|
23
|
-
category: "forms",
|
|
24
|
-
invalidAncestors: ["Button"],
|
|
25
|
-
type: "control",
|
|
26
|
-
label: "Text Input",
|
|
27
|
-
description:
|
|
28
|
-
"A single-line text input for collecting string data from your users.",
|
|
29
|
-
icon: FormTextFieldIcon,
|
|
30
|
-
presetStyle,
|
|
31
|
-
order: 3,
|
|
32
|
-
states: [
|
|
33
|
-
...defaultStates,
|
|
34
|
-
{ selector: "::placeholder", label: "Placeholder" },
|
|
35
|
-
{ selector: ":valid", label: "Valid" },
|
|
36
|
-
{ selector: ":invalid", label: "Invalid" },
|
|
37
|
-
{ selector: ":required", label: "Required" },
|
|
38
|
-
{ selector: ":optional", label: "Optional" },
|
|
39
|
-
{ selector: ":disabled", label: "Disabled" },
|
|
40
|
-
{ selector: ":enabled", label: "Enabled" },
|
|
41
|
-
{ selector: ":read-only", label: "Read Only" },
|
|
42
|
-
{ selector: ":read-write", label: "Read Write" },
|
|
43
|
-
],
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
47
|
-
props,
|
|
48
|
-
initialProps: ["id", "name", "type", "placeholder", "required", "autoFocus"],
|
|
49
|
-
};
|
package/src/italic.stories.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Italic as ItalicPrimitive } from "./italic";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Italic",
|
|
6
|
-
component: ItalicPrimitive,
|
|
7
|
-
} satisfies Meta<typeof ItalicPrimitive>;
|
|
8
|
-
|
|
9
|
-
export const Italic: StoryObj<typeof ItalicPrimitive> = {
|
|
10
|
-
args: {
|
|
11
|
-
children: "some italic text",
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/italic.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "i";
|
|
4
|
-
|
|
5
|
-
export const Italic = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag>
|
|
8
|
-
>((props, ref) => <i {...props} ref={ref} />);
|
|
9
|
-
|
|
10
|
-
Italic.displayName = "Italic";
|
package/src/italic.ws.tsx
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { TextItalicIcon } from "@webstudio-is/icons/svg";
|
|
2
|
-
import type { defaultTag } from "./italic";
|
|
3
|
-
import {
|
|
4
|
-
defaultStates,
|
|
5
|
-
type PresetStyle,
|
|
6
|
-
type WsComponentMeta,
|
|
7
|
-
type WsComponentPropsMeta,
|
|
8
|
-
} from "@webstudio-is/react-sdk";
|
|
9
|
-
import { i } from "@webstudio-is/react-sdk/css-normalize";
|
|
10
|
-
import { props } from "./__generated__/italic.props";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
i: [
|
|
14
|
-
...i,
|
|
15
|
-
{
|
|
16
|
-
property: "fontStyle",
|
|
17
|
-
value: { type: "keyword", value: "italic" },
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
21
|
-
|
|
22
|
-
export const meta: WsComponentMeta = {
|
|
23
|
-
type: "rich-text-child",
|
|
24
|
-
label: "Italic Text",
|
|
25
|
-
icon: TextItalicIcon,
|
|
26
|
-
states: defaultStates,
|
|
27
|
-
presetStyle,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
31
|
-
props,
|
|
32
|
-
initialProps: ["id"],
|
|
33
|
-
};
|
package/src/label.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultTag = "label";
|
|
4
|
-
|
|
5
|
-
export const Label = forwardRef<
|
|
6
|
-
ElementRef<typeof defaultTag>,
|
|
7
|
-
ComponentProps<typeof defaultTag>
|
|
8
|
-
>((props, ref) => <label {...props} ref={ref} />);
|
|
9
|
-
|
|
10
|
-
Label.displayName = "Label";
|
package/src/label.ws.tsx
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LabelIcon } 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 { label } from "@webstudio-is/react-sdk/css-normalize";
|
|
9
|
-
import { props } from "./__generated__/label.props";
|
|
10
|
-
import type { defaultTag } from "./label";
|
|
11
|
-
|
|
12
|
-
const presetStyle = {
|
|
13
|
-
label: [
|
|
14
|
-
...label,
|
|
15
|
-
{ property: "display", value: { type: "keyword", value: "block" } },
|
|
16
|
-
],
|
|
17
|
-
} satisfies PresetStyle<typeof defaultTag>;
|
|
18
|
-
|
|
19
|
-
export const meta: WsComponentMeta = {
|
|
20
|
-
category: "forms",
|
|
21
|
-
invalidAncestors: ["Button", "Label"],
|
|
22
|
-
type: "container",
|
|
23
|
-
label: "Input Label",
|
|
24
|
-
icon: LabelIcon,
|
|
25
|
-
states: defaultStates,
|
|
26
|
-
presetStyle,
|
|
27
|
-
order: 2,
|
|
28
|
-
template: [
|
|
29
|
-
{
|
|
30
|
-
type: "instance",
|
|
31
|
-
component: "Label",
|
|
32
|
-
children: [{ type: "text", value: "Form Label" }],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const propsMeta: WsComponentPropsMeta = {
|
|
38
|
-
props: {
|
|
39
|
-
...props,
|
|
40
|
-
htmlFor: {
|
|
41
|
-
...props.htmlFor,
|
|
42
|
-
label: "For",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
initialProps: ["id", "htmlFor"],
|
|
46
|
-
};
|