@webstudio-is/sdk-components-react 0.185.0 → 0.191.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.
Files changed (127) hide show
  1. package/lib/__generated__/blockquote.props.js +514 -0
  2. package/lib/__generated__/body.props.js +508 -0
  3. package/lib/__generated__/bold.props.js +508 -0
  4. package/lib/__generated__/box.props.js +527 -0
  5. package/lib/__generated__/button.props.js +570 -0
  6. package/lib/__generated__/checkbox.props.js +672 -0
  7. package/lib/__generated__/code-text.props.js +509 -0
  8. package/lib/__generated__/form.props.js +556 -0
  9. package/lib/__generated__/heading.props.js +516 -0
  10. package/lib/__generated__/html-embed.props.js +13 -0
  11. package/lib/__generated__/image.props.js +592 -0
  12. package/lib/__generated__/input.props.js +696 -0
  13. package/lib/__generated__/italic.props.js +508 -0
  14. package/lib/__generated__/label.props.js +520 -0
  15. package/lib/__generated__/link.props.js +568 -0
  16. package/lib/__generated__/list-item.props.js +514 -0
  17. package/lib/__generated__/list.props.js +534 -0
  18. package/lib/__generated__/markdown-embed.props.js +7 -0
  19. package/lib/__generated__/option.props.js +532 -0
  20. package/lib/__generated__/paragraph.props.js +508 -0
  21. package/lib/__generated__/radio-button.props.js +672 -0
  22. package/lib/__generated__/select.props.js +556 -0
  23. package/lib/__generated__/separator.props.js +508 -0
  24. package/lib/__generated__/span.props.js +508 -0
  25. package/lib/__generated__/subscript.props.js +508 -0
  26. package/lib/__generated__/superscript.props.js +508 -0
  27. package/lib/__generated__/text.props.js +516 -0
  28. package/lib/__generated__/textarea.props.js +587 -0
  29. package/lib/__generated__/time.props.js +312 -0
  30. package/lib/__generated__/vimeo-play-button.props.js +569 -0
  31. package/lib/__generated__/vimeo-preview-image.props.js +586 -0
  32. package/lib/__generated__/vimeo-spinner.props.js +508 -0
  33. package/lib/__generated__/vimeo.props.js +674 -0
  34. package/lib/__generated__/xml-node.props.js +7 -0
  35. package/lib/__generated__/xml-time.props.js +18 -0
  36. package/lib/blockquote.js +9 -0
  37. package/lib/blockquote.ws.js +79 -0
  38. package/lib/body.js +7 -0
  39. package/lib/body.ws.js +30 -0
  40. package/lib/bold.js +7 -0
  41. package/lib/bold.ws.js +20 -0
  42. package/lib/box.js +9 -0
  43. package/lib/box.ws.js +31 -0
  44. package/lib/button.js +9 -0
  45. package/lib/button.ws.js +44 -0
  46. package/lib/checkbox.js +15 -0
  47. package/lib/checkbox.ws.js +59 -0
  48. package/lib/code-text.js +10 -0
  49. package/lib/code-text.ws.js +60 -0
  50. package/lib/components.js +77 -1348
  51. package/lib/content-embed.ws.js +77 -0
  52. package/lib/form.js +7 -0
  53. package/lib/form.ws.js +31 -0
  54. package/lib/fragment.js +7 -0
  55. package/lib/fragment.ws.js +11 -0
  56. package/lib/heading.js +9 -0
  57. package/lib/heading.ws.js +45 -0
  58. package/lib/home_wsKvRSqvkajPPBeycZ-C8.svg +3 -0
  59. package/lib/hooks.js +5 -0
  60. package/lib/html-embed-patchers.js +29 -0
  61. package/lib/html-embed.js +112 -0
  62. package/lib/html-embed.ws.js +46 -0
  63. package/lib/image.js +40 -0
  64. package/lib/image.ws.js +65 -0
  65. package/lib/input.js +17 -0
  66. package/lib/input.ws.js +55 -0
  67. package/lib/italic.js +7 -0
  68. package/lib/italic.ws.js +26 -0
  69. package/lib/label.js +7 -0
  70. package/lib/label.ws.js +43 -0
  71. package/lib/link.js +15 -0
  72. package/lib/link.ws.js +68 -0
  73. package/lib/list-item.js +9 -0
  74. package/lib/list-item.ws.js +40 -0
  75. package/lib/list.js +6 -0
  76. package/lib/list.ws.js +92 -0
  77. package/lib/markdown-embed.js +14 -0
  78. package/lib/markdown-embed.ws.js +111 -0
  79. package/lib/metas.js +79 -4573
  80. package/lib/option.js +7 -0
  81. package/lib/option.ws.js +47 -0
  82. package/lib/paragraph.js +7 -0
  83. package/lib/paragraph.ws.js +40 -0
  84. package/lib/props.js +77 -17915
  85. package/lib/radio-button.js +15 -0
  86. package/lib/radio-button.ws.js +61 -0
  87. package/lib/rich-text-link.js +8 -0
  88. package/lib/rich-text-link.ws.js +11 -0
  89. package/lib/select.js +19 -0
  90. package/lib/select.ws.js +97 -0
  91. package/lib/separator.js +9 -0
  92. package/lib/separator.ws.js +48 -0
  93. package/lib/slot.js +14 -0
  94. package/lib/slot.ws.js +15 -0
  95. package/lib/span.js +7 -0
  96. package/lib/span.ws.js +20 -0
  97. package/lib/subscript.js +7 -0
  98. package/lib/subscript.ws.js +20 -0
  99. package/lib/superscript.js +7 -0
  100. package/lib/superscript.ws.js +20 -0
  101. package/lib/text.js +10 -0
  102. package/lib/text.ws.js +41 -0
  103. package/lib/textarea.js +7 -0
  104. package/lib/textarea.ws.js +56 -0
  105. package/lib/time.js +319 -0
  106. package/lib/time.ws.js +22 -0
  107. package/lib/types/__generated__/xml-time.props.d.ts +2 -0
  108. package/lib/types/components.d.ts +1 -0
  109. package/lib/types/metas.d.ts +1 -0
  110. package/lib/types/props.d.ts +1 -0
  111. package/lib/types/vimeo-preview-image.d.ts +96 -96
  112. package/lib/types/xml-node.d.ts +5 -1
  113. package/lib/types/xml-time.d.ts +6 -0
  114. package/lib/types/xml-time.ws.d.ts +3 -0
  115. package/lib/vimeo-play-button.js +15 -0
  116. package/lib/vimeo-play-button.ws.js +33 -0
  117. package/lib/vimeo-preview-image.js +19 -0
  118. package/lib/vimeo-preview-image.ws.js +20 -0
  119. package/lib/vimeo-spinner.js +13 -0
  120. package/lib/vimeo-spinner.ws.js +26 -0
  121. package/lib/vimeo.js +215 -0
  122. package/lib/vimeo.ws.js +330 -0
  123. package/lib/xml-node.js +44 -0
  124. package/lib/xml-node.ws.js +18 -0
  125. package/lib/xml-time.js +25 -0
  126. package/lib/xml-time.ws.js +18 -0
  127. package/package.json +11 -14
package/lib/link.js ADDED
@@ -0,0 +1,15 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ const a = n((e, o) => {
4
+ const {
5
+ children: s,
6
+ // @todo: it's a hack made for Image component for the builder and should't be in the runtime at all.
7
+ $webstudio$canvasOnly$assetId: i,
8
+ ...r
9
+ } = e;
10
+ return /* @__PURE__ */ t("a", { ...r, href: r.href ?? "#", ref: o, children: s });
11
+ });
12
+ a.displayName = "Link";
13
+ export {
14
+ a as Link
15
+ };
package/lib/link.ws.js ADDED
@@ -0,0 +1,68 @@
1
+ import { LinkIcon as e } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as t } from "@webstudio-is/react-sdk";
3
+ import { a as o } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as r } from "./__generated__/link.props.js";
5
+ const n = {
6
+ a: [
7
+ ...o,
8
+ {
9
+ property: "minHeight",
10
+ value: { type: "unit", unit: "em", value: 1 }
11
+ },
12
+ {
13
+ property: "display",
14
+ value: { type: "keyword", value: "inline-block" }
15
+ }
16
+ ]
17
+ }, l = {
18
+ category: "general",
19
+ type: "container",
20
+ description: "Use a link to send your users to another page, section, or resource. Configure links in the Settings panel.",
21
+ icon: e,
22
+ invalidAncestors: ["Link", "Button"],
23
+ constraints: {
24
+ relation: "ancestor",
25
+ component: { $nin: ["Button", "Link"] }
26
+ },
27
+ presetStyle: n,
28
+ order: 1,
29
+ states: [
30
+ ...t,
31
+ {
32
+ selector: ":visited",
33
+ label: "Visited"
34
+ },
35
+ {
36
+ category: "component-states",
37
+ selector: "[aria-current=page]",
38
+ label: "Current page"
39
+ }
40
+ ],
41
+ template: [
42
+ {
43
+ type: "instance",
44
+ component: "Link",
45
+ children: [
46
+ {
47
+ type: "text",
48
+ value: "Link text you can edit",
49
+ placeholder: !0
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ }, c = {
55
+ props: {
56
+ ...r,
57
+ href: {
58
+ type: "string",
59
+ control: "url",
60
+ required: !1
61
+ }
62
+ },
63
+ initialProps: ["id", "className", "href", "target", "download"]
64
+ };
65
+ export {
66
+ l as meta,
67
+ c as propsMeta
68
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as e } from "react";
3
+ const i = e(
4
+ ({ children: r, ...t }, m) => /* @__PURE__ */ o("li", { ...t, ref: m, children: r })
5
+ );
6
+ i.displayName = "ListItem";
7
+ export {
8
+ i as ListItem
9
+ };
@@ -0,0 +1,40 @@
1
+ import { ListItemIcon as t } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as e } from "@webstudio-is/react-sdk";
3
+ import { li as o } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as i } from "./__generated__/list-item.props.js";
5
+ const r = {
6
+ li: o
7
+ }, c = {
8
+ category: "general",
9
+ type: "container",
10
+ requiredAncestors: ["List"],
11
+ constraints: {
12
+ relation: "parent",
13
+ component: { $eq: "List" }
14
+ },
15
+ description: "Adds a new item to an existing list.",
16
+ icon: t,
17
+ states: e,
18
+ presetStyle: r,
19
+ order: 4,
20
+ template: [
21
+ {
22
+ type: "instance",
23
+ component: "ListItem",
24
+ children: [
25
+ {
26
+ type: "text",
27
+ value: "List Item text you can edit",
28
+ placeholder: !0
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }, m = {
34
+ props: i,
35
+ initialProps: ["id", "className"]
36
+ };
37
+ export {
38
+ c as meta,
39
+ m as propsMeta
40
+ };
package/lib/list.js ADDED
@@ -0,0 +1,6 @@
1
+ import { forwardRef as o, createElement as a } from "react";
2
+ const s = "ul", n = "ol", d = o(({ ordered: e = !1, ...t }, r) => a(e ? n : s, { ...t, ref: r }));
3
+ d.displayName = "List";
4
+ export {
5
+ d as List
6
+ };
package/lib/list.ws.js ADDED
@@ -0,0 +1,92 @@
1
+ import { ListIcon as e } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as t } from "@webstudio-is/react-sdk";
3
+ import { ol as o, ul as r } from "@webstudio-is/sdk/normalize.css";
4
+ import { props as p } from "./__generated__/list.props.js";
5
+ const a = {
6
+ ol: [
7
+ ...o,
8
+ {
9
+ property: "marginTop",
10
+ value: { type: "keyword", value: "0" }
11
+ },
12
+ {
13
+ property: "marginBottom",
14
+ value: { type: "keyword", value: "10px" }
15
+ },
16
+ {
17
+ property: "paddingLeft",
18
+ value: { type: "keyword", value: "40px" }
19
+ }
20
+ ],
21
+ ul: [
22
+ ...r,
23
+ {
24
+ property: "marginTop",
25
+ value: { type: "keyword", value: "0" }
26
+ },
27
+ {
28
+ property: "marginBottom",
29
+ value: { type: "keyword", value: "10px" }
30
+ },
31
+ {
32
+ property: "paddingLeft",
33
+ value: { type: "keyword", value: "40px" }
34
+ }
35
+ ]
36
+ }, y = {
37
+ category: "general",
38
+ type: "container",
39
+ description: "Groups content, like links in a menu or steps in a recipe.",
40
+ icon: e,
41
+ states: t,
42
+ presetStyle: a,
43
+ order: 3,
44
+ template: [
45
+ {
46
+ type: "instance",
47
+ component: "List",
48
+ children: [
49
+ {
50
+ type: "instance",
51
+ component: "ListItem",
52
+ children: [
53
+ {
54
+ type: "text",
55
+ value: "List Item text you can edit",
56
+ placeholder: !0
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ type: "instance",
62
+ component: "ListItem",
63
+ children: [
64
+ {
65
+ type: "text",
66
+ value: "List Item text you can edit",
67
+ placeholder: !0
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ type: "instance",
73
+ component: "ListItem",
74
+ children: [
75
+ {
76
+ type: "text",
77
+ value: "List Item text you can edit",
78
+ placeholder: !0
79
+ }
80
+ ]
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ }, c = {
86
+ props: p,
87
+ initialProps: ["id", "className", "ordered", "start", "reversed"]
88
+ };
89
+ export {
90
+ y as meta,
91
+ c as propsMeta
92
+ };
@@ -0,0 +1,14 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { micromark as s } from "micromark";
3
+ import { forwardRef as c, useMemo as d } from "react";
4
+ const u = /* @__PURE__ */ c((r, e) => {
5
+ const { code: o, children: l, ...t } = r, m = d(
6
+ // support data uri protocol in images
7
+ () => s(o ?? "", { allowDangerousProtocol: !0 }),
8
+ [o]
9
+ );
10
+ return /* @__PURE__ */ n("div", { ...t, ref: e, dangerouslySetInnerHTML: { __html: m } });
11
+ });
12
+ export {
13
+ u as MarkdownEmbed
14
+ };
@@ -0,0 +1,111 @@
1
+ import { MarkdownEmbedIcon as n } from "@webstudio-is/icons/svg";
2
+ import { imagePlaceholderDataUrl as a } from "@webstudio-is/image";
3
+ import { descendantComponent as r } from "@webstudio-is/react-sdk";
4
+ import { props as s } from "./__generated__/markdown-embed.props.js";
5
+ const i = `
6
+ # Styling Markdown with Markdown Embed
7
+
8
+ Markdown Embed allows styling of Markdown, which primarily comes from external data.
9
+
10
+ ## How to Use Markdown Embed
11
+
12
+ - Every element is shown in the Navigator.
13
+ - Apply styles and Tokens to each element.
14
+ - Adjustments to elements apply universally within this embed, ensuring consistency across your content.
15
+
16
+ ---
17
+
18
+ ## This sample text contains all the elements that can be styled.
19
+
20
+ Any elements that were not used above are used below.
21
+
22
+ ### Heading 3
23
+ #### Heading 4
24
+ ##### Heading 5
25
+ ###### Heading 6
26
+
27
+ [Links](#) connect your content to relevant resources.
28
+
29
+ **Bold text** makes your important points stand out.
30
+
31
+ *Italic text* is great for emphasizing terms.
32
+
33
+ 1. First Step
34
+ 2. Second Step
35
+
36
+ ![Image placeholder](${a})
37
+
38
+ > Capture attention with a powerful quote.
39
+
40
+ Using \`console.log("Hello World");\` will log to the console.
41
+ `.trim(), e = (t, o) => ({
42
+ type: "instance",
43
+ component: r,
44
+ label: t,
45
+ props: [{ type: "string", name: "selector", value: ` ${o}` }],
46
+ children: []
47
+ }), m = {
48
+ category: "data",
49
+ type: "embed",
50
+ description: "Used to add markdown code to the page",
51
+ icon: n,
52
+ presetStyle: {
53
+ div: [
54
+ {
55
+ property: "display",
56
+ value: { type: "keyword", value: "contents" }
57
+ },
58
+ {
59
+ property: "whiteSpaceCollapse",
60
+ value: { type: "keyword", value: "collapse" }
61
+ }
62
+ ]
63
+ },
64
+ order: 4,
65
+ template: [
66
+ {
67
+ type: "instance",
68
+ component: "MarkdownEmbed",
69
+ props: [
70
+ {
71
+ name: "code",
72
+ type: "string",
73
+ value: i
74
+ }
75
+ ],
76
+ children: [
77
+ e("Paragraph", "p"),
78
+ e("Heading 1", "h1"),
79
+ e("Heading 2", "h2"),
80
+ e("Heading 3", "h3"),
81
+ e("Heading 4", "h4"),
82
+ e("Heading 5", "h5"),
83
+ e("Heading 6", "h6"),
84
+ e("Bold", ":where(strong, b)"),
85
+ e("Italic", ":where(em, i)"),
86
+ e("Link", "a"),
87
+ e("Image", "img"),
88
+ e("Blockquote", "blockquote"),
89
+ e("Code Text", "code"),
90
+ e("List", ":where(ul, ol)"),
91
+ e("List Item", "li"),
92
+ e("Separator", "hr")
93
+ ]
94
+ }
95
+ ]
96
+ }, g = {
97
+ props: {
98
+ ...s,
99
+ code: {
100
+ required: !0,
101
+ control: "code",
102
+ language: "markdown",
103
+ type: "string"
104
+ }
105
+ },
106
+ initialProps: ["className"]
107
+ };
108
+ export {
109
+ m as meta,
110
+ g as propsMeta
111
+ };