@webstudio-is/react-sdk 0.61.0 → 0.63.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 (251) hide show
  1. package/lib/app/custom-components/__generated__/form.props.js +412 -0
  2. package/lib/app/custom-components/__generated__/image.props.js +442 -0
  3. package/lib/app/custom-components/__generated__/link-block.props.js +432 -0
  4. package/lib/app/custom-components/__generated__/link.props.js +432 -0
  5. package/lib/app/custom-components/__generated__/rich-text-link.props.js +432 -0
  6. package/lib/app/custom-components/form.js +54 -0
  7. package/lib/app/custom-components/form.ws.js +81 -0
  8. package/lib/app/custom-components/index.js +10 -4
  9. package/lib/cjs/app/custom-components/__generated__/form.props.js +432 -0
  10. package/lib/cjs/app/custom-components/__generated__/image.props.js +462 -0
  11. package/lib/cjs/app/custom-components/__generated__/link-block.props.js +452 -0
  12. package/lib/cjs/app/custom-components/__generated__/link.props.js +452 -0
  13. package/lib/cjs/app/custom-components/__generated__/rich-text-link.props.js +452 -0
  14. package/lib/cjs/app/custom-components/form.js +70 -0
  15. package/lib/cjs/app/custom-components/form.ws.js +101 -0
  16. package/lib/cjs/app/custom-components/index.js +12 -6
  17. package/lib/cjs/components/__generated__/checkbox-field.props.js +419 -0
  18. package/lib/cjs/components/__generated__/checkbox.props.js +459 -0
  19. package/lib/cjs/components/__generated__/error-message.props.js +418 -0
  20. package/lib/cjs/components/__generated__/input.props.js +8 -3
  21. package/lib/cjs/components/__generated__/label.props.js +420 -0
  22. package/lib/cjs/components/__generated__/radio-button-field.props.js +419 -0
  23. package/lib/cjs/components/__generated__/radio-button.props.js +459 -0
  24. package/lib/cjs/components/__generated__/success-message.props.js +418 -0
  25. package/lib/cjs/components/__generated__/textarea.props.js +432 -0
  26. package/lib/cjs/components/blockquote.ws.js +2 -0
  27. package/lib/cjs/components/body.ws.js +2 -0
  28. package/lib/cjs/components/bold.ws.js +2 -0
  29. package/lib/cjs/components/box.ws.js +2 -0
  30. package/lib/cjs/components/button.ws.js +8 -2
  31. package/lib/cjs/components/checkbox-field.js +29 -0
  32. package/lib/cjs/components/checkbox-field.ws.js +55 -0
  33. package/lib/cjs/components/checkbox.js +29 -0
  34. package/lib/cjs/components/checkbox.ws.js +57 -0
  35. package/lib/cjs/components/code.ws.js +2 -0
  36. package/lib/cjs/components/component-meta.js +13 -1
  37. package/lib/cjs/components/components-utils.js +9 -1
  38. package/lib/cjs/components/components.js +17 -1
  39. package/lib/cjs/components/error-message.js +29 -0
  40. package/lib/cjs/components/error-message.ws.js +40 -0
  41. package/lib/cjs/components/form.js +1 -1
  42. package/lib/cjs/components/form.ws.js +27 -6
  43. package/lib/cjs/components/heading.ws.js +2 -0
  44. package/lib/cjs/components/image.ws.js +2 -0
  45. package/lib/cjs/components/index.js +43 -2
  46. package/lib/cjs/components/input.ws.js +17 -3
  47. package/lib/cjs/components/italic.ws.js +2 -0
  48. package/lib/cjs/components/label.js +29 -0
  49. package/lib/cjs/components/label.ws.js +56 -0
  50. package/lib/cjs/components/link-block.ws.js +1 -1
  51. package/lib/cjs/components/link.ws.js +13 -1
  52. package/lib/cjs/components/list-item.ws.js +3 -0
  53. package/lib/cjs/components/list.ws.js +2 -0
  54. package/lib/cjs/components/paragraph.ws.js +2 -0
  55. package/lib/cjs/components/radio-button-field.js +29 -0
  56. package/lib/cjs/components/radio-button-field.ws.js +55 -0
  57. package/lib/cjs/components/radio-button.js +29 -0
  58. package/lib/cjs/components/radio-button.ws.js +57 -0
  59. package/lib/cjs/components/separator.ws.js +2 -0
  60. package/lib/cjs/components/span.ws.js +2 -0
  61. package/lib/cjs/components/subscript.ws.js +2 -0
  62. package/lib/cjs/components/success-message.js +29 -0
  63. package/lib/cjs/components/success-message.ws.js +40 -0
  64. package/lib/cjs/components/superscript.ws.js +2 -0
  65. package/lib/cjs/components/text-block.ws.js +2 -0
  66. package/lib/cjs/components/textarea.js +29 -0
  67. package/lib/cjs/components/textarea.ws.js +58 -0
  68. package/lib/cjs/css/normalize.js +3 -1
  69. package/lib/cjs/css/presets.js +19 -1
  70. package/lib/cjs/index.js +2 -1
  71. package/lib/components/__generated__/checkbox-field.props.js +399 -0
  72. package/lib/components/__generated__/checkbox.props.js +439 -0
  73. package/lib/components/__generated__/error-message.props.js +398 -0
  74. package/lib/components/__generated__/input.props.js +8 -3
  75. package/lib/components/__generated__/label.props.js +400 -0
  76. package/lib/components/__generated__/radio-button-field.props.js +399 -0
  77. package/lib/components/__generated__/radio-button.props.js +439 -0
  78. package/lib/components/__generated__/success-message.props.js +398 -0
  79. package/lib/components/__generated__/textarea.props.js +412 -0
  80. package/lib/components/blockquote.ws.js +4 -0
  81. package/lib/components/body.ws.js +4 -0
  82. package/lib/components/bold.ws.js +4 -0
  83. package/lib/components/box.ws.js +4 -0
  84. package/lib/components/button.ws.js +10 -2
  85. package/lib/components/checkbox-field.js +9 -0
  86. package/lib/components/checkbox-field.ws.js +37 -0
  87. package/lib/components/checkbox.js +9 -0
  88. package/lib/components/checkbox.ws.js +39 -0
  89. package/lib/components/code.ws.js +4 -0
  90. package/lib/components/component-meta.js +13 -1
  91. package/lib/components/components-utils.js +9 -1
  92. package/lib/components/components.js +17 -1
  93. package/lib/components/error-message.js +9 -0
  94. package/lib/components/error-message.ws.js +20 -0
  95. package/lib/components/form.js +1 -1
  96. package/lib/components/form.ws.js +29 -6
  97. package/lib/components/heading.ws.js +4 -0
  98. package/lib/components/image.ws.js +4 -0
  99. package/lib/components/index.js +43 -2
  100. package/lib/components/input.ws.js +19 -3
  101. package/lib/components/italic.ws.js +4 -0
  102. package/lib/components/label.js +9 -0
  103. package/lib/components/label.ws.js +38 -0
  104. package/lib/components/link-block.ws.js +2 -2
  105. package/lib/components/link.ws.js +15 -1
  106. package/lib/components/list-item.ws.js +5 -0
  107. package/lib/components/list.ws.js +4 -0
  108. package/lib/components/paragraph.ws.js +4 -0
  109. package/lib/components/radio-button-field.js +9 -0
  110. package/lib/components/radio-button-field.ws.js +37 -0
  111. package/lib/components/radio-button.js +9 -0
  112. package/lib/components/radio-button.ws.js +39 -0
  113. package/lib/components/separator.ws.js +4 -0
  114. package/lib/components/span.ws.js +4 -0
  115. package/lib/components/subscript.ws.js +4 -0
  116. package/lib/components/success-message.js +9 -0
  117. package/lib/components/success-message.ws.js +20 -0
  118. package/lib/components/superscript.ws.js +4 -0
  119. package/lib/components/text-block.ws.js +4 -0
  120. package/lib/components/textarea.js +9 -0
  121. package/lib/components/textarea.ws.js +40 -0
  122. package/lib/css/normalize.js +4 -2
  123. package/lib/css/presets.js +19 -1
  124. package/lib/index.js +4 -2
  125. package/lib/types/app/custom-components/__generated__/form.props.d.ts +2 -0
  126. package/lib/types/app/custom-components/__generated__/image.props.d.ts +2 -0
  127. package/lib/types/app/custom-components/__generated__/link-block.props.d.ts +2 -0
  128. package/lib/types/app/custom-components/__generated__/link.props.d.ts +2 -0
  129. package/lib/types/app/custom-components/__generated__/rich-text-link.props.d.ts +2 -0
  130. package/lib/types/app/custom-components/form.d.ts +5 -0
  131. package/lib/types/app/custom-components/form.ws.d.ts +3 -0
  132. package/lib/types/app/custom-components/index.d.ts +6 -1
  133. package/lib/types/components/__generated__/checkbox-field.props.d.ts +2 -0
  134. package/lib/types/components/__generated__/checkbox.props.d.ts +2 -0
  135. package/lib/types/components/__generated__/error-message.props.d.ts +2 -0
  136. package/lib/types/components/__generated__/label.props.d.ts +2 -0
  137. package/lib/types/components/__generated__/radio-button-field.props.d.ts +2 -0
  138. package/lib/types/components/__generated__/radio-button.props.d.ts +2 -0
  139. package/lib/types/components/__generated__/success-message.props.d.ts +2 -0
  140. package/lib/types/components/__generated__/textarea.props.d.ts +2 -0
  141. package/lib/types/components/blockquote.ws.d.ts +1 -1
  142. package/lib/types/components/body.ws.d.ts +1 -1
  143. package/lib/types/components/bold.ws.d.ts +1 -1
  144. package/lib/types/components/box.ws.d.ts +1 -1
  145. package/lib/types/components/button.ws.d.ts +1 -1
  146. package/lib/types/components/checkbox-field.d.ts +3 -0
  147. package/lib/types/components/checkbox-field.ws.d.ts +3 -0
  148. package/lib/types/components/checkbox.d.ts +3 -0
  149. package/lib/types/components/checkbox.ws.d.ts +3 -0
  150. package/lib/types/components/code.ws.d.ts +1 -1
  151. package/lib/types/components/component-meta.d.ts +17 -4
  152. package/lib/types/components/components-utils.d.ts +5 -20
  153. package/lib/types/components/components.d.ts +8 -0
  154. package/lib/types/components/error-message.d.ts +3 -0
  155. package/lib/types/components/error-message.ws.d.ts +3 -0
  156. package/lib/types/components/form.ws.d.ts +1 -1
  157. package/lib/types/components/heading.ws.d.ts +1 -1
  158. package/lib/types/components/image.ws.d.ts +1 -1
  159. package/lib/types/components/index.d.ts +1 -0
  160. package/lib/types/components/input.d.ts +3 -1
  161. package/lib/types/components/input.stories.d.ts +6 -2
  162. package/lib/types/components/input.ws.d.ts +1 -1
  163. package/lib/types/components/italic.ws.d.ts +1 -1
  164. package/lib/types/components/label.d.ts +3 -0
  165. package/lib/types/components/label.ws.d.ts +3 -0
  166. package/lib/types/components/link.ws.d.ts +1 -1
  167. package/lib/types/components/list-item.ws.d.ts +1 -1
  168. package/lib/types/components/list.ws.d.ts +1 -1
  169. package/lib/types/components/paragraph.ws.d.ts +1 -1
  170. package/lib/types/components/radio-button-field.d.ts +3 -0
  171. package/lib/types/components/radio-button-field.ws.d.ts +3 -0
  172. package/lib/types/components/radio-button.d.ts +3 -0
  173. package/lib/types/components/radio-button.ws.d.ts +3 -0
  174. package/lib/types/components/separator.ws.d.ts +1 -1
  175. package/lib/types/components/span.ws.d.ts +1 -1
  176. package/lib/types/components/subscript.ws.d.ts +1 -1
  177. package/lib/types/components/success-message.d.ts +3 -0
  178. package/lib/types/components/success-message.ws.d.ts +3 -0
  179. package/lib/types/components/superscript.ws.d.ts +1 -1
  180. package/lib/types/components/text-block.ws.d.ts +1 -1
  181. package/lib/types/components/textarea.d.ts +3 -0
  182. package/lib/types/components/textarea.ws.d.ts +3 -0
  183. package/lib/types/css/normalize.d.ts +239 -46
  184. package/lib/types/css/presets.d.ts +3 -2
  185. package/lib/types/css/style-rules.d.ts +1 -1
  186. package/lib/types/embed-template.d.ts +4 -4
  187. package/lib/types/index.d.ts +1 -1
  188. package/package.json +12 -12
  189. package/src/app/custom-components/__generated__/form.props.ts +457 -0
  190. package/src/app/custom-components/__generated__/image.props.ts +487 -0
  191. package/src/app/custom-components/__generated__/link-block.props.ts +477 -0
  192. package/src/app/custom-components/__generated__/link.props.ts +477 -0
  193. package/src/app/custom-components/__generated__/rich-text-link.props.ts +477 -0
  194. package/src/app/custom-components/form.tsx +94 -0
  195. package/src/app/custom-components/form.ws.tsx +86 -0
  196. package/src/app/custom-components/index.ts +9 -4
  197. package/src/components/__generated__/checkbox-field.props.ts +444 -0
  198. package/src/components/__generated__/checkbox.props.ts +484 -0
  199. package/src/components/__generated__/error-message.props.ts +443 -0
  200. package/src/components/__generated__/input.props.ts +8 -3
  201. package/src/components/__generated__/label.props.ts +445 -0
  202. package/src/components/__generated__/radio-button-field.props.ts +444 -0
  203. package/src/components/__generated__/radio-button.props.ts +484 -0
  204. package/src/components/__generated__/success-message.props.ts +443 -0
  205. package/src/components/__generated__/textarea.props.ts +457 -0
  206. package/src/components/blockquote.ws.tsx +6 -4
  207. package/src/components/body.ws.tsx +6 -4
  208. package/src/components/bold.ws.tsx +6 -4
  209. package/src/components/box.ws.ts +6 -4
  210. package/src/components/button.ws.tsx +11 -5
  211. package/src/components/checkbox-field.tsx +10 -0
  212. package/src/components/checkbox-field.ws.tsx +40 -0
  213. package/src/components/checkbox.tsx +13 -0
  214. package/src/components/checkbox.ws.tsx +42 -0
  215. package/src/components/code.ws.tsx +6 -4
  216. package/src/components/component-meta.ts +12 -0
  217. package/src/components/components-utils.ts +16 -10
  218. package/src/components/components.ts +8 -0
  219. package/src/components/error-message.tsx +10 -0
  220. package/src/components/error-message.ws.tsx +24 -0
  221. package/src/components/form.tsx +5 -1
  222. package/src/components/form.ws.tsx +30 -9
  223. package/src/components/heading.ws.tsx +6 -4
  224. package/src/components/image.ws.tsx +6 -4
  225. package/src/components/index.ts +47 -0
  226. package/src/components/input.tsx +3 -1
  227. package/src/components/input.ws.tsx +19 -5
  228. package/src/components/italic.ws.tsx +6 -4
  229. package/src/components/label.tsx +10 -0
  230. package/src/components/label.ws.tsx +41 -0
  231. package/src/components/link-block.ws.tsx +2 -2
  232. package/src/components/link.ws.tsx +17 -5
  233. package/src/components/list-item.ws.tsx +7 -4
  234. package/src/components/list.ws.tsx +6 -4
  235. package/src/components/paragraph.ws.tsx +6 -4
  236. package/src/components/radio-button-field.tsx +10 -0
  237. package/src/components/radio-button-field.ws.tsx +40 -0
  238. package/src/components/radio-button.tsx +13 -0
  239. package/src/components/radio-button.ws.tsx +42 -0
  240. package/src/components/separator.ws.tsx +6 -4
  241. package/src/components/span.ws.tsx +6 -4
  242. package/src/components/subscript.ws.tsx +6 -4
  243. package/src/components/success-message.tsx +10 -0
  244. package/src/components/success-message.ws.tsx +24 -0
  245. package/src/components/superscript.ws.tsx +6 -4
  246. package/src/components/text-block.ws.tsx +6 -4
  247. package/src/components/textarea.tsx +13 -0
  248. package/src/components/textarea.ws.tsx +43 -0
  249. package/src/css/normalize.ts +21 -18
  250. package/src/css/presets.ts +20 -2
  251. package/src/index.ts +1 -0
@@ -22,29 +22,45 @@ import { List } from "./list";
22
22
  import { ListItem } from "./list-item";
23
23
  import { Separator } from "./separator";
24
24
  import { Code } from "./code";
25
+ import { Label } from "./label";
26
+ import { SuccessMessage } from "./success-message";
27
+ import { ErrorMessage } from "./error-message";
28
+ import { Textarea } from "./textarea";
29
+ import { RadioButtonField } from "./radio-button-field";
30
+ import { RadioButton } from "./radio-button";
31
+ import { CheckboxField } from "./checkbox-field";
32
+ import { Checkbox } from "./checkbox";
25
33
  export {
26
34
  Blockquote,
27
35
  Body,
28
36
  Bold,
29
37
  Box,
30
38
  Button,
39
+ Checkbox,
40
+ CheckboxField,
31
41
  Code,
42
+ ErrorMessage,
32
43
  Form,
33
44
  Fragment,
34
45
  Heading,
35
46
  Image,
36
47
  Input,
37
48
  Italic,
49
+ Label,
38
50
  Link,
39
51
  LinkBlock,
40
52
  List,
41
53
  ListItem,
42
54
  Paragraph,
55
+ RadioButton,
56
+ RadioButtonField,
43
57
  RichTextLink,
44
58
  Separator,
45
59
  Slot,
46
60
  Span,
47
61
  Subscript,
62
+ SuccessMessage,
48
63
  Superscript,
49
- TextBlock
64
+ TextBlock,
65
+ Textarea
50
66
  };
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const defaultTag = "div";
4
+ const ErrorMessage = forwardRef((props, ref) => /* @__PURE__ */ jsx("div", { ...props, ref }));
5
+ ErrorMessage.displayName = "ErrorMessage";
6
+ export {
7
+ ErrorMessage,
8
+ defaultTag
9
+ };
@@ -0,0 +1,20 @@
1
+ import { BoxIcon } from "@webstudio-is/icons";
2
+ import { props } from "./__generated__/error-message.props";
3
+ import { div } from "../css/normalize";
4
+ const presetStyle = {
5
+ div
6
+ };
7
+ const meta = {
8
+ type: "container",
9
+ label: "Error Message",
10
+ Icon: BoxIcon,
11
+ presetStyle
12
+ };
13
+ const propsMeta = {
14
+ props,
15
+ initialProps: []
16
+ };
17
+ export {
18
+ meta,
19
+ propsMeta
20
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  const defaultTag = "form";
4
- const Form = forwardRef((props, ref) => /* @__PURE__ */ jsx("form", { ...props, ref }));
4
+ const Form = forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx("form", { ...props, ref, children }));
5
5
  Form.displayName = "Form";
6
6
  export {
7
7
  Form,
@@ -1,13 +1,13 @@
1
1
  import { FormIcon } from "@webstudio-is/icons";
2
2
  import { form } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/form.props";
4
7
  const presetStyle = {
5
8
  form: [
6
9
  ...form,
7
- {
8
- property: "minHeight",
9
- value: { type: "unit", unit: "px", value: 20 }
10
- }
10
+ { property: "minHeight", value: { type: "unit", unit: "px", value: 20 } }
11
11
  ]
12
12
  };
13
13
  const meta = {
@@ -15,9 +15,31 @@ const meta = {
15
15
  type: "container",
16
16
  label: "Form",
17
17
  Icon: FormIcon,
18
+ states: defaultStates,
18
19
  presetStyle,
19
20
  children: [
20
- { type: "instance", component: "Input", children: [] },
21
+ {
22
+ type: "instance",
23
+ component: "Label",
24
+ children: [{ type: "text", value: "Name" }]
25
+ },
26
+ {
27
+ type: "instance",
28
+ component: "Input",
29
+ props: [{ type: "string", name: "name", value: "name" }],
30
+ children: []
31
+ },
32
+ {
33
+ type: "instance",
34
+ component: "Label",
35
+ children: [{ type: "text", value: "Email" }]
36
+ },
37
+ {
38
+ type: "instance",
39
+ component: "Input",
40
+ props: [{ type: "string", name: "email", value: "email" }],
41
+ children: []
42
+ },
21
43
  {
22
44
  type: "instance",
23
45
  component: "Button",
@@ -26,7 +48,8 @@ const meta = {
26
48
  ]
27
49
  };
28
50
  const propsMeta = {
29
- props
51
+ props,
52
+ initialProps: []
30
53
  };
31
54
  export {
32
55
  meta,
@@ -1,5 +1,8 @@
1
1
  import { HeadingIcon } from "@webstudio-is/icons";
2
2
  import { h1, h2, h3, h4, h5, h6 } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/heading.props";
4
7
  const presetStyle = {
5
8
  h1,
@@ -15,6 +18,7 @@ const meta = {
15
18
  label: "Heading",
16
19
  Icon: HeadingIcon,
17
20
  children: [{ type: "text", value: "Heading you can edit" }],
21
+ states: defaultStates,
18
22
  presetStyle
19
23
  };
20
24
  const propsMeta = {
@@ -1,5 +1,8 @@
1
1
  import { ImageIcon } from "@webstudio-is/icons";
2
2
  import { img } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/image.props";
4
7
  const presetStyle = {
5
8
  img: [
@@ -22,6 +25,7 @@ const meta = {
22
25
  type: "embed",
23
26
  label: "Image",
24
27
  Icon: ImageIcon,
28
+ states: defaultStates,
25
29
  presetStyle
26
30
  };
27
31
  const propsMeta = {
@@ -23,6 +23,14 @@ import { meta as ListMeta } from "./list.ws";
23
23
  import { meta as ListItemMeta } from "./list-item.ws";
24
24
  import { meta as SeparatorMeta } from "./separator.ws";
25
25
  import { meta as CodeMeta } from "./code.ws";
26
+ import { meta as LabelMeta } from "./label.ws";
27
+ import { meta as SuccessMessageMeta } from "./success-message.ws";
28
+ import { meta as ErrorMessageMeta } from "./error-message.ws";
29
+ import { meta as TextareaMeta } from "./textarea.ws";
30
+ import { meta as RadioButtonFieldMeta } from "./radio-button-field.ws";
31
+ import { meta as RadioButtonMeta } from "./radio-button.ws";
32
+ import { meta as CheckboxFieldMeta } from "./checkbox-field.ws";
33
+ import { meta as CheckboxMeta } from "./checkbox.ws";
26
34
  import { propsMeta as SlotMetaPropsMeta } from "./slot.ws";
27
35
  import { propsMeta as FragmentMetaPropsMeta } from "./fragment.ws";
28
36
  import { propsMeta as BodyMetaPropsMeta } from "./body.ws";
@@ -47,6 +55,14 @@ import { propsMeta as ListPropsMeta } from "./list.ws";
47
55
  import { propsMeta as ListItemPropsMeta } from "./list-item.ws";
48
56
  import { propsMeta as SeparatorPropsMeta } from "./separator.ws";
49
57
  import { propsMeta as CodePropsMeta } from "./code.ws";
58
+ import { propsMeta as LabelPropsMeta } from "./label.ws";
59
+ import { propsMeta as SuccessMessagePropsMeta } from "./success-message.ws";
60
+ import { propsMeta as ErrorMessagePropsMeta } from "./error-message.ws";
61
+ import { propsMeta as TextareaPropsMeta } from "./textarea.ws";
62
+ import { propsMeta as RadioButtonFieldPropsMeta } from "./radio-button-field.ws";
63
+ import { propsMeta as RadioButtonPropsMeta } from "./radio-button.ws";
64
+ import { propsMeta as CheckboxFieldPropsMeta } from "./checkbox-field.ws";
65
+ import { propsMeta as CheckboxPropsMeta } from "./checkbox.ws";
50
66
  const defaultMetas = {
51
67
  Slot: SlotMeta,
52
68
  Fragment: FragmentMeta,
@@ -71,7 +87,15 @@ const defaultMetas = {
71
87
  List: ListMeta,
72
88
  ListItem: ListItemMeta,
73
89
  Separator: SeparatorMeta,
74
- Code: CodeMeta
90
+ Code: CodeMeta,
91
+ Label: LabelMeta,
92
+ SuccessMessage: SuccessMessageMeta,
93
+ ErrorMessage: ErrorMessageMeta,
94
+ Textarea: TextareaMeta,
95
+ RadioButtonField: RadioButtonFieldMeta,
96
+ RadioButton: RadioButtonMeta,
97
+ CheckboxField: CheckboxFieldMeta,
98
+ Checkbox: CheckboxMeta
75
99
  };
76
100
  let currentMetas = defaultMetas;
77
101
  const getComponentMeta = (name) => {
@@ -108,7 +132,15 @@ const defaultPropsMetasRaw = {
108
132
  List: ListPropsMeta,
109
133
  ListItem: ListItemPropsMeta,
110
134
  Separator: SeparatorPropsMeta,
111
- Code: CodePropsMeta
135
+ Code: CodePropsMeta,
136
+ Label: LabelPropsMeta,
137
+ SuccessMessage: SuccessMessagePropsMeta,
138
+ ErrorMessage: ErrorMessagePropsMeta,
139
+ Textarea: TextareaPropsMeta,
140
+ RadioButtonField: RadioButtonFieldPropsMeta,
141
+ RadioButton: RadioButtonPropsMeta,
142
+ CheckboxField: CheckboxFieldPropsMeta,
143
+ Checkbox: CheckboxPropsMeta
112
144
  };
113
145
  const defaultPropsMetas = defaultPropsMetasRaw;
114
146
  let registeredPropsMetas = {};
@@ -163,7 +195,16 @@ const computeInitialProps = (props, defaults, overrides) => {
163
195
  ).map(([name]) => name) : [];
164
196
  return [...initialProps, ...requiredProps];
165
197
  };
198
+ const canAcceptComponent = (parentComponent, childComponent) => {
199
+ const parentMeta = getComponentMeta(parentComponent);
200
+ const childMeta = getComponentMeta(childComponent);
201
+ if (parentMeta?.type !== "container" || childMeta === void 0) {
202
+ return false;
203
+ }
204
+ return childMeta.acceptedParents === void 0 || childMeta.acceptedParents.includes(parentComponent);
205
+ };
166
206
  export {
207
+ canAcceptComponent,
167
208
  getComponentMeta,
168
209
  getComponentPropsMeta,
169
210
  registerComponentMetas,
@@ -1,5 +1,8 @@
1
1
  import { FormTextFieldIcon } from "@webstudio-is/icons";
2
2
  import { input } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/input.props";
4
7
  const presetStyle = {
5
8
  input
@@ -7,12 +10,25 @@ const presetStyle = {
7
10
  const meta = {
8
11
  category: "forms",
9
12
  type: "control",
10
- label: "Input",
13
+ label: "Text Field",
11
14
  Icon: FormTextFieldIcon,
12
- presetStyle
15
+ presetStyle,
16
+ states: [
17
+ ...defaultStates,
18
+ { selector: "::placeholder", label: "Placeholder" },
19
+ { selector: ":valid", label: "Valid" },
20
+ { selector: ":invalid", label: "Invalid" },
21
+ { selector: ":required", label: "Required" },
22
+ { selector: ":optional", label: "Optional" },
23
+ { selector: ":disabled", label: "Disabled" },
24
+ { selector: ":enabled", label: "Enabled" },
25
+ { selector: ":read-only", label: "Read Only" },
26
+ { selector: ":read-write", label: "Read Write" }
27
+ ]
13
28
  };
14
29
  const propsMeta = {
15
- props
30
+ props,
31
+ initialProps: ["name", "type", "placeholder", "required", "autoFocus"]
16
32
  };
17
33
  export {
18
34
  meta,
@@ -1,4 +1,7 @@
1
1
  import { TextItalicIcon } from "@webstudio-is/icons";
2
+ import {
3
+ defaultStates
4
+ } from "./component-meta";
2
5
  import { props } from "./__generated__/italic.props";
3
6
  import { i } from "../css/normalize";
4
7
  const presetStyle = {
@@ -14,6 +17,7 @@ const meta = {
14
17
  type: "rich-text-child",
15
18
  label: "Italic Text",
16
19
  Icon: TextItalicIcon,
20
+ states: defaultStates,
17
21
  presetStyle
18
22
  };
19
23
  const propsMeta = {
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const defaultTag = "label";
4
+ const Label = forwardRef((props, ref) => /* @__PURE__ */ jsx("label", { ...props, ref }));
5
+ Label.displayName = "Label";
6
+ export {
7
+ Label,
8
+ defaultTag
9
+ };
@@ -0,0 +1,38 @@
1
+ import { TextBlockIcon } from "@webstudio-is/icons";
2
+ import {
3
+ defaultStates
4
+ } from "./component-meta";
5
+ import { props } from "./__generated__/label.props";
6
+ import { label } from "../css/normalize";
7
+ const presetStyle = {
8
+ label: [
9
+ ...label,
10
+ { property: "display", value: { type: "keyword", value: "block" } }
11
+ ]
12
+ };
13
+ const meta = {
14
+ category: "forms",
15
+ type: "rich-text",
16
+ label: "Input Label",
17
+ Icon: TextBlockIcon,
18
+ states: defaultStates,
19
+ presetStyle,
20
+ children: [{ type: "text", value: "Form Label" }]
21
+ };
22
+ const propsMeta = {
23
+ props: {
24
+ ...props,
25
+ htmlFor: {
26
+ required: false,
27
+ control: "text",
28
+ type: "string",
29
+ rows: 0,
30
+ label: "For"
31
+ }
32
+ },
33
+ initialProps: ["htmlFor"]
34
+ };
35
+ export {
36
+ meta,
37
+ propsMeta
38
+ };
@@ -1,4 +1,4 @@
1
- import { BoxLinkIcon } from "@webstudio-is/icons";
1
+ import { LinkBlockIcon } from "@webstudio-is/icons";
2
2
  import { props } from "./__generated__/link-block.props";
3
3
  import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
4
4
  import { a } from "../css/normalize";
@@ -15,7 +15,7 @@ const meta = {
15
15
  category: "general",
16
16
  type: "container",
17
17
  label: "Link Block",
18
- Icon: BoxLinkIcon,
18
+ Icon: LinkBlockIcon,
19
19
  states: linkMeta.states,
20
20
  presetStyle
21
21
  };
@@ -1,5 +1,8 @@
1
1
  import { LinkIcon } from "@webstudio-is/icons";
2
2
  import { a } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/link.props";
4
7
  const presetStyle = {
5
8
  a: [
@@ -20,7 +23,18 @@ const meta = {
20
23
  label: "Link Text",
21
24
  Icon: LinkIcon,
22
25
  presetStyle,
23
- states: [{ selector: "[aria-current=page]", label: "Current page" }],
26
+ states: [
27
+ ...defaultStates,
28
+ {
29
+ selector: ":visited",
30
+ label: "Visited"
31
+ },
32
+ {
33
+ category: "component-states",
34
+ selector: "[aria-current=page]",
35
+ label: "Current page"
36
+ }
37
+ ],
24
38
  children: [{ type: "text", value: "Link text you can edit" }]
25
39
  };
26
40
  const propsMeta = {
@@ -1,5 +1,8 @@
1
1
  import { ListItemIcon } from "@webstudio-is/icons";
2
2
  import { li } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/list-item.props";
4
7
  const presetStyle = {
5
8
  li
@@ -7,9 +10,11 @@ const presetStyle = {
7
10
  const meta = {
8
11
  category: "typography",
9
12
  type: "rich-text",
13
+ acceptedParents: ["List"],
10
14
  label: "List Item",
11
15
  Icon: ListItemIcon,
12
16
  children: [{ type: "text", value: "List Item you can edit" }],
17
+ states: defaultStates,
13
18
  presetStyle
14
19
  };
15
20
  const propsMeta = {
@@ -1,4 +1,7 @@
1
1
  import { ListIcon } from "@webstudio-is/icons";
2
+ import {
3
+ defaultStates
4
+ } from "./component-meta";
2
5
  import { props } from "./__generated__/list.props";
3
6
  import { ol, ul } from "../css/normalize";
4
7
  const presetStyle = {
@@ -38,6 +41,7 @@ const meta = {
38
41
  type: "container",
39
42
  label: "List",
40
43
  Icon: ListIcon,
44
+ states: defaultStates,
41
45
  presetStyle,
42
46
  children: []
43
47
  };
@@ -1,5 +1,8 @@
1
1
  import { TextAlignLeftIcon } from "@webstudio-is/icons";
2
2
  import { p } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/paragraph.props";
4
7
  const presetStyle = {
5
8
  p
@@ -10,6 +13,7 @@ const meta = {
10
13
  label: "Paragraph",
11
14
  Icon: TextAlignLeftIcon,
12
15
  children: [{ type: "text", value: "Pragraph you can edit" }],
16
+ states: defaultStates,
13
17
  presetStyle
14
18
  };
15
19
  const propsMeta = {
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const defaultTag = "label";
4
+ const RadioButtonField = forwardRef((props, ref) => /* @__PURE__ */ jsx("label", { ...props, ref }));
5
+ RadioButtonField.displayName = "RadioButtonField";
6
+ export {
7
+ RadioButtonField,
8
+ defaultTag
9
+ };
@@ -0,0 +1,37 @@
1
+ import { RadioCheckedIcon } from "@webstudio-is/icons";
2
+ import {
3
+ defaultStates
4
+ } from "./component-meta";
5
+ import { props } from "./__generated__/radio-button-field.props";
6
+ import { label } from "../css/normalize";
7
+ const presetStyle = {
8
+ label: [
9
+ ...label,
10
+ { property: "display", value: { type: "keyword", value: "flex" } }
11
+ ]
12
+ };
13
+ const meta = {
14
+ category: "forms",
15
+ type: "container",
16
+ label: "Radio Button Field",
17
+ Icon: RadioCheckedIcon,
18
+ states: defaultStates,
19
+ presetStyle,
20
+ children: [
21
+ { type: "instance", component: "RadioButton", props: [], children: [] },
22
+ {
23
+ type: "instance",
24
+ component: "TextBlock",
25
+ props: [],
26
+ children: [{ type: "text", value: "Radio" }]
27
+ }
28
+ ]
29
+ };
30
+ const propsMeta = {
31
+ props,
32
+ initialProps: []
33
+ };
34
+ export {
35
+ meta,
36
+ propsMeta
37
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const defaultTag = "input";
4
+ const RadioButton = forwardRef(({ children: _children, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, type: "radio", ref }));
5
+ RadioButton.displayName = "RadioButton";
6
+ export {
7
+ RadioButton,
8
+ defaultTag
9
+ };
@@ -0,0 +1,39 @@
1
+ import { RadioCheckedIcon } from "@webstudio-is/icons";
2
+ import {
3
+ defaultStates
4
+ } from "./component-meta";
5
+ import { input } from "../css/normalize";
6
+ import { props } from "./__generated__/radio-button.props";
7
+ const presetStyle = {
8
+ input: [
9
+ ...input,
10
+ {
11
+ property: "marginRight",
12
+ value: { type: "unit", unit: "em", value: 0.5 }
13
+ }
14
+ ]
15
+ };
16
+ const meta = {
17
+ type: "control",
18
+ label: "Radio Button",
19
+ Icon: RadioCheckedIcon,
20
+ presetStyle,
21
+ states: [
22
+ ...defaultStates,
23
+ { selector: ":checked", label: "Checked" },
24
+ { selector: ":required", label: "Required" },
25
+ { selector: ":optional", label: "Optional" },
26
+ { selector: ":disabled", label: "Disabled" },
27
+ { selector: ":enabled", label: "Enabled" },
28
+ { selector: ":read-only", label: "Read Only" },
29
+ { selector: ":read-write", label: "Read Write" }
30
+ ]
31
+ };
32
+ const propsMeta = {
33
+ props,
34
+ initialProps: ["name"]
35
+ };
36
+ export {
37
+ meta,
38
+ propsMeta
39
+ };
@@ -1,4 +1,7 @@
1
1
  import { DashIcon } from "@webstudio-is/icons";
2
+ import {
3
+ defaultStates
4
+ } from "./component-meta";
2
5
  import { props } from "./__generated__/separator.props";
3
6
  import { hr } from "../css/normalize";
4
7
  const presetStyle = {
@@ -35,6 +38,7 @@ const meta = {
35
38
  type: "embed",
36
39
  label: "Separator",
37
40
  Icon: DashIcon,
41
+ states: defaultStates,
38
42
  presetStyle,
39
43
  children: []
40
44
  };
@@ -1,5 +1,8 @@
1
1
  import { PaintBrushIcon } from "@webstudio-is/icons";
2
2
  import { span } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/span.props";
4
7
  const presetStyle = {
5
8
  span
@@ -8,6 +11,7 @@ const meta = {
8
11
  type: "rich-text-child",
9
12
  label: "Styled Text",
10
13
  Icon: PaintBrushIcon,
14
+ states: defaultStates,
11
15
  presetStyle
12
16
  };
13
17
  const propsMeta = {
@@ -1,5 +1,8 @@
1
1
  import { SubscriptIcon } from "@webstudio-is/icons";
2
2
  import { sub } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/subscript.props";
4
7
  const presetStyle = {
5
8
  sub
@@ -8,6 +11,7 @@ const meta = {
8
11
  type: "rich-text-child",
9
12
  label: "Subscript Text",
10
13
  Icon: SubscriptIcon,
14
+ states: defaultStates,
11
15
  presetStyle
12
16
  };
13
17
  const propsMeta = {
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const defaultTag = "div";
4
+ const SuccessMessage = forwardRef((props, ref) => /* @__PURE__ */ jsx("div", { ...props, ref }));
5
+ SuccessMessage.displayName = "SuccessMessage";
6
+ export {
7
+ SuccessMessage,
8
+ defaultTag
9
+ };
@@ -0,0 +1,20 @@
1
+ import { BoxIcon } from "@webstudio-is/icons";
2
+ import { props } from "./__generated__/success-message.props";
3
+ import { div } from "../css/normalize";
4
+ const presetStyle = {
5
+ div
6
+ };
7
+ const meta = {
8
+ type: "container",
9
+ label: "Success Message",
10
+ Icon: BoxIcon,
11
+ presetStyle
12
+ };
13
+ const propsMeta = {
14
+ props,
15
+ initialProps: []
16
+ };
17
+ export {
18
+ meta,
19
+ propsMeta
20
+ };
@@ -1,5 +1,8 @@
1
1
  import { SuperscriptIcon } from "@webstudio-is/icons";
2
2
  import { sup } from "../css/normalize";
3
+ import {
4
+ defaultStates
5
+ } from "./component-meta";
3
6
  import { props } from "./__generated__/superscript.props";
4
7
  const presetStyle = {
5
8
  sup
@@ -8,6 +11,7 @@ const meta = {
8
11
  type: "rich-text-child",
9
12
  label: "Superscript Text",
10
13
  Icon: SuperscriptIcon,
14
+ states: defaultStates,
11
15
  presetStyle
12
16
  };
13
17
  const propsMeta = {