@webstudio-is/react-sdk 0.61.0 → 0.62.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 (175) 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/button.ws.js +7 -2
  27. package/lib/cjs/components/checkbox-field.js +29 -0
  28. package/lib/cjs/components/checkbox-field.ws.js +53 -0
  29. package/lib/cjs/components/checkbox.js +29 -0
  30. package/lib/cjs/components/checkbox.ws.js +55 -0
  31. package/lib/cjs/components/component-meta.js +1 -0
  32. package/lib/cjs/components/components-utils.js +9 -1
  33. package/lib/cjs/components/components.js +17 -1
  34. package/lib/cjs/components/error-message.js +29 -0
  35. package/lib/cjs/components/error-message.ws.js +40 -0
  36. package/lib/cjs/components/form.js +1 -1
  37. package/lib/cjs/components/form.ws.js +25 -6
  38. package/lib/cjs/components/index.js +43 -2
  39. package/lib/cjs/components/input.ws.js +15 -3
  40. package/lib/cjs/components/label.js +29 -0
  41. package/lib/cjs/components/label.ws.js +54 -0
  42. package/lib/cjs/components/link-block.ws.js +1 -1
  43. package/lib/cjs/components/list-item.ws.js +1 -0
  44. package/lib/cjs/components/radio-button-field.js +29 -0
  45. package/lib/cjs/components/radio-button-field.ws.js +53 -0
  46. package/lib/cjs/components/radio-button.js +29 -0
  47. package/lib/cjs/components/radio-button.ws.js +55 -0
  48. package/lib/cjs/components/success-message.js +29 -0
  49. package/lib/cjs/components/success-message.ws.js +40 -0
  50. package/lib/cjs/components/textarea.js +29 -0
  51. package/lib/cjs/components/textarea.ws.js +56 -0
  52. package/lib/cjs/css/normalize.js +2 -0
  53. package/lib/components/__generated__/checkbox-field.props.js +399 -0
  54. package/lib/components/__generated__/checkbox.props.js +439 -0
  55. package/lib/components/__generated__/error-message.props.js +398 -0
  56. package/lib/components/__generated__/input.props.js +8 -3
  57. package/lib/components/__generated__/label.props.js +400 -0
  58. package/lib/components/__generated__/radio-button-field.props.js +399 -0
  59. package/lib/components/__generated__/radio-button.props.js +439 -0
  60. package/lib/components/__generated__/success-message.props.js +398 -0
  61. package/lib/components/__generated__/textarea.props.js +412 -0
  62. package/lib/components/button.ws.js +7 -2
  63. package/lib/components/checkbox-field.js +9 -0
  64. package/lib/components/checkbox-field.ws.js +33 -0
  65. package/lib/components/checkbox.js +9 -0
  66. package/lib/components/checkbox.ws.js +35 -0
  67. package/lib/components/component-meta.js +1 -0
  68. package/lib/components/components-utils.js +9 -1
  69. package/lib/components/components.js +17 -1
  70. package/lib/components/error-message.js +9 -0
  71. package/lib/components/error-message.ws.js +20 -0
  72. package/lib/components/form.js +1 -1
  73. package/lib/components/form.ws.js +25 -6
  74. package/lib/components/index.js +43 -2
  75. package/lib/components/input.ws.js +15 -3
  76. package/lib/components/label.js +9 -0
  77. package/lib/components/label.ws.js +34 -0
  78. package/lib/components/link-block.ws.js +2 -2
  79. package/lib/components/list-item.ws.js +1 -0
  80. package/lib/components/radio-button-field.js +9 -0
  81. package/lib/components/radio-button-field.ws.js +33 -0
  82. package/lib/components/radio-button.js +9 -0
  83. package/lib/components/radio-button.ws.js +35 -0
  84. package/lib/components/success-message.js +9 -0
  85. package/lib/components/success-message.ws.js +20 -0
  86. package/lib/components/textarea.js +9 -0
  87. package/lib/components/textarea.ws.js +36 -0
  88. package/lib/css/normalize.js +2 -0
  89. package/lib/types/app/custom-components/__generated__/form.props.d.ts +2 -0
  90. package/lib/types/app/custom-components/__generated__/image.props.d.ts +2 -0
  91. package/lib/types/app/custom-components/__generated__/link-block.props.d.ts +2 -0
  92. package/lib/types/app/custom-components/__generated__/link.props.d.ts +2 -0
  93. package/lib/types/app/custom-components/__generated__/rich-text-link.props.d.ts +2 -0
  94. package/lib/types/app/custom-components/form.d.ts +5 -0
  95. package/lib/types/app/custom-components/form.ws.d.ts +3 -0
  96. package/lib/types/app/custom-components/index.d.ts +6 -1
  97. package/lib/types/components/__generated__/checkbox-field.props.d.ts +2 -0
  98. package/lib/types/components/__generated__/checkbox.props.d.ts +2 -0
  99. package/lib/types/components/__generated__/error-message.props.d.ts +2 -0
  100. package/lib/types/components/__generated__/label.props.d.ts +2 -0
  101. package/lib/types/components/__generated__/radio-button-field.props.d.ts +2 -0
  102. package/lib/types/components/__generated__/radio-button.props.d.ts +2 -0
  103. package/lib/types/components/__generated__/success-message.props.d.ts +2 -0
  104. package/lib/types/components/__generated__/textarea.props.d.ts +2 -0
  105. package/lib/types/components/checkbox-field.d.ts +3 -0
  106. package/lib/types/components/checkbox-field.ws.d.ts +3 -0
  107. package/lib/types/components/checkbox.d.ts +3 -0
  108. package/lib/types/components/checkbox.ws.d.ts +3 -0
  109. package/lib/types/components/component-meta.d.ts +3 -0
  110. package/lib/types/components/components-utils.d.ts +5 -20
  111. package/lib/types/components/components.d.ts +8 -0
  112. package/lib/types/components/error-message.d.ts +3 -0
  113. package/lib/types/components/error-message.ws.d.ts +3 -0
  114. package/lib/types/components/index.d.ts +1 -0
  115. package/lib/types/components/input.d.ts +3 -1
  116. package/lib/types/components/input.stories.d.ts +6 -2
  117. package/lib/types/components/label.d.ts +3 -0
  118. package/lib/types/components/label.ws.d.ts +3 -0
  119. package/lib/types/components/radio-button-field.d.ts +3 -0
  120. package/lib/types/components/radio-button-field.ws.d.ts +3 -0
  121. package/lib/types/components/radio-button.d.ts +3 -0
  122. package/lib/types/components/radio-button.ws.d.ts +3 -0
  123. package/lib/types/components/success-message.d.ts +3 -0
  124. package/lib/types/components/success-message.ws.d.ts +3 -0
  125. package/lib/types/components/textarea.d.ts +3 -0
  126. package/lib/types/components/textarea.ws.d.ts +3 -0
  127. package/lib/types/css/normalize.d.ts +237 -46
  128. package/lib/types/css/style-rules.d.ts +1 -1
  129. package/lib/types/embed-template.d.ts +4 -4
  130. package/package.json +12 -12
  131. package/src/app/custom-components/__generated__/form.props.ts +457 -0
  132. package/src/app/custom-components/__generated__/image.props.ts +487 -0
  133. package/src/app/custom-components/__generated__/link-block.props.ts +477 -0
  134. package/src/app/custom-components/__generated__/link.props.ts +477 -0
  135. package/src/app/custom-components/__generated__/rich-text-link.props.ts +477 -0
  136. package/src/app/custom-components/form.tsx +94 -0
  137. package/src/app/custom-components/form.ws.tsx +86 -0
  138. package/src/app/custom-components/index.ts +9 -4
  139. package/src/components/__generated__/checkbox-field.props.ts +444 -0
  140. package/src/components/__generated__/checkbox.props.ts +484 -0
  141. package/src/components/__generated__/error-message.props.ts +443 -0
  142. package/src/components/__generated__/input.props.ts +8 -3
  143. package/src/components/__generated__/label.props.ts +445 -0
  144. package/src/components/__generated__/radio-button-field.props.ts +444 -0
  145. package/src/components/__generated__/radio-button.props.ts +484 -0
  146. package/src/components/__generated__/success-message.props.ts +443 -0
  147. package/src/components/__generated__/textarea.props.ts +457 -0
  148. package/src/components/button.ws.tsx +6 -1
  149. package/src/components/checkbox-field.tsx +10 -0
  150. package/src/components/checkbox-field.ws.tsx +38 -0
  151. package/src/components/checkbox.tsx +13 -0
  152. package/src/components/checkbox.ws.tsx +40 -0
  153. package/src/components/component-meta.ts +1 -0
  154. package/src/components/components-utils.ts +16 -10
  155. package/src/components/components.ts +8 -0
  156. package/src/components/error-message.tsx +10 -0
  157. package/src/components/error-message.ws.tsx +24 -0
  158. package/src/components/form.tsx +5 -1
  159. package/src/components/form.ws.tsx +24 -5
  160. package/src/components/index.ts +47 -0
  161. package/src/components/input.tsx +3 -1
  162. package/src/components/input.ws.tsx +13 -1
  163. package/src/components/label.tsx +10 -0
  164. package/src/components/label.ws.tsx +39 -0
  165. package/src/components/link-block.ws.tsx +2 -2
  166. package/src/components/list-item.ws.tsx +1 -0
  167. package/src/components/radio-button-field.tsx +10 -0
  168. package/src/components/radio-button-field.ws.tsx +38 -0
  169. package/src/components/radio-button.tsx +13 -0
  170. package/src/components/radio-button.ws.tsx +40 -0
  171. package/src/components/success-message.tsx +10 -0
  172. package/src/components/success-message.ws.tsx +24 -0
  173. package/src/components/textarea.tsx +13 -0
  174. package/src/components/textarea.ws.tsx +41 -0
  175. package/src/css/normalize.ts +1 -0
@@ -4,10 +4,7 @@ import { props } from "./__generated__/form.props";
4
4
  const presetStyle = {
5
5
  form: [
6
6
  ...form,
7
- {
8
- property: "minHeight",
9
- value: { type: "unit", unit: "px", value: 20 }
10
- }
7
+ { property: "minHeight", value: { type: "unit", unit: "px", value: 20 } }
11
8
  ]
12
9
  };
13
10
  const meta = {
@@ -17,7 +14,28 @@ const meta = {
17
14
  Icon: FormIcon,
18
15
  presetStyle,
19
16
  children: [
20
- { type: "instance", component: "Input", children: [] },
17
+ {
18
+ type: "instance",
19
+ component: "Label",
20
+ children: [{ type: "text", value: "Name" }]
21
+ },
22
+ {
23
+ type: "instance",
24
+ component: "Input",
25
+ props: [{ type: "string", name: "name", value: "name" }],
26
+ children: []
27
+ },
28
+ {
29
+ type: "instance",
30
+ component: "Label",
31
+ children: [{ type: "text", value: "Email" }]
32
+ },
33
+ {
34
+ type: "instance",
35
+ component: "Input",
36
+ props: [{ type: "string", name: "email", value: "email" }],
37
+ children: []
38
+ },
21
39
  {
22
40
  type: "instance",
23
41
  component: "Button",
@@ -26,7 +44,8 @@ const meta = {
26
44
  ]
27
45
  };
28
46
  const propsMeta = {
29
- props
47
+ props,
48
+ initialProps: []
30
49
  };
31
50
  export {
32
51
  meta,
@@ -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,
@@ -7,12 +7,24 @@ const presetStyle = {
7
7
  const meta = {
8
8
  category: "forms",
9
9
  type: "control",
10
- label: "Input",
10
+ label: "Text Field",
11
11
  Icon: FormTextFieldIcon,
12
- presetStyle
12
+ presetStyle,
13
+ states: [
14
+ { selector: "::placeholder", label: "Placeholder" },
15
+ { selector: ":valid", label: "Valid" },
16
+ { selector: ":invalid", label: "Invalid" },
17
+ { selector: ":required", label: "Required" },
18
+ { selector: ":optional", label: "Optional" },
19
+ { selector: ":disabled", label: "Disabled" },
20
+ { selector: ":enabled", label: "Enabled" },
21
+ { selector: ":read-only", label: "Read Only" },
22
+ { selector: ":read-write", label: "Read Write" }
23
+ ]
13
24
  };
14
25
  const propsMeta = {
15
- props
26
+ props,
27
+ initialProps: ["name", "type", "placeholder", "required", "autoFocus"]
16
28
  };
17
29
  export {
18
30
  meta,
@@ -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,34 @@
1
+ import { TextBlockIcon } from "@webstudio-is/icons";
2
+ import { props } from "./__generated__/label.props";
3
+ import { label } from "../css/normalize";
4
+ const presetStyle = {
5
+ label: [
6
+ ...label,
7
+ { property: "display", value: { type: "keyword", value: "block" } }
8
+ ]
9
+ };
10
+ const meta = {
11
+ category: "forms",
12
+ type: "rich-text",
13
+ label: "Input Label",
14
+ Icon: TextBlockIcon,
15
+ presetStyle,
16
+ children: [{ type: "text", value: "Form Label" }]
17
+ };
18
+ const propsMeta = {
19
+ props: {
20
+ ...props,
21
+ htmlFor: {
22
+ required: false,
23
+ control: "text",
24
+ type: "string",
25
+ rows: 0,
26
+ label: "For"
27
+ }
28
+ },
29
+ initialProps: ["htmlFor"]
30
+ };
31
+ export {
32
+ meta,
33
+ propsMeta
34
+ };
@@ -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
  };
@@ -7,6 +7,7 @@ const presetStyle = {
7
7
  const meta = {
8
8
  category: "typography",
9
9
  type: "rich-text",
10
+ acceptedParents: ["List"],
10
11
  label: "List Item",
11
12
  Icon: ListItemIcon,
12
13
  children: [{ type: "text", value: "List Item you can edit" }],
@@ -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,33 @@
1
+ import { RadioCheckedIcon } from "@webstudio-is/icons";
2
+ import { props } from "./__generated__/radio-button-field.props";
3
+ import { label } from "../css/normalize";
4
+ const presetStyle = {
5
+ label: [
6
+ ...label,
7
+ { property: "display", value: { type: "keyword", value: "flex" } }
8
+ ]
9
+ };
10
+ const meta = {
11
+ category: "forms",
12
+ type: "container",
13
+ label: "Radio Button Field",
14
+ Icon: RadioCheckedIcon,
15
+ presetStyle,
16
+ children: [
17
+ { type: "instance", component: "RadioButton", props: [], children: [] },
18
+ {
19
+ type: "instance",
20
+ component: "TextBlock",
21
+ props: [],
22
+ children: [{ type: "text", value: "Radio" }]
23
+ }
24
+ ]
25
+ };
26
+ const propsMeta = {
27
+ props,
28
+ initialProps: []
29
+ };
30
+ export {
31
+ meta,
32
+ propsMeta
33
+ };
@@ -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,35 @@
1
+ import { RadioCheckedIcon } from "@webstudio-is/icons";
2
+ import { input } from "../css/normalize";
3
+ import { props } from "./__generated__/radio-button.props";
4
+ const presetStyle = {
5
+ input: [
6
+ ...input,
7
+ {
8
+ property: "marginRight",
9
+ value: { type: "unit", unit: "em", value: 0.5 }
10
+ }
11
+ ]
12
+ };
13
+ const meta = {
14
+ type: "control",
15
+ label: "Radio Button",
16
+ Icon: RadioCheckedIcon,
17
+ presetStyle,
18
+ states: [
19
+ { selector: ":checked", label: "Checked" },
20
+ { selector: ":required", label: "Required" },
21
+ { selector: ":optional", label: "Optional" },
22
+ { selector: ":disabled", label: "Disabled" },
23
+ { selector: ":enabled", label: "Enabled" },
24
+ { selector: ":read-only", label: "Read Only" },
25
+ { selector: ":read-write", label: "Read Write" }
26
+ ]
27
+ };
28
+ const propsMeta = {
29
+ props,
30
+ initialProps: ["name"]
31
+ };
32
+ export {
33
+ meta,
34
+ propsMeta
35
+ };
@@ -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
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ const defaultTag = "textarea";
4
+ const Textarea = forwardRef(({ children: _children, ...props }, ref) => /* @__PURE__ */ jsx("textarea", { ...props, ref }));
5
+ Textarea.displayName = "Textarea";
6
+ export {
7
+ Textarea,
8
+ defaultTag
9
+ };
@@ -0,0 +1,36 @@
1
+ import { FormTextAreaIcon } from "@webstudio-is/icons";
2
+ import { textarea } from "../css/normalize";
3
+ import { props } from "./__generated__/textarea.props";
4
+ const presetStyle = {
5
+ textarea: [
6
+ ...textarea,
7
+ // resize doesn't work well while on canvas
8
+ { property: "resize", value: { type: "keyword", value: "none" } }
9
+ ]
10
+ };
11
+ const meta = {
12
+ category: "forms",
13
+ type: "control",
14
+ label: "Text Area",
15
+ Icon: FormTextAreaIcon,
16
+ presetStyle,
17
+ states: [
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
+ ]
28
+ };
29
+ const propsMeta = {
30
+ props,
31
+ initialProps: ["name", "placeholder", "required", "autoFocus"]
32
+ };
33
+ export {
34
+ meta,
35
+ propsMeta
36
+ };
@@ -15,6 +15,7 @@ const main = baseStyle;
15
15
  const nav = baseStyle;
16
16
  const section = baseStyle;
17
17
  const form = baseStyle;
18
+ const label = baseStyle;
18
19
  const h1 = baseStyle;
19
20
  const h2 = baseStyle;
20
21
  const h3 = baseStyle;
@@ -295,6 +296,7 @@ export {
295
296
  img,
296
297
  input,
297
298
  kbd,
299
+ label,
298
300
  legend,
299
301
  li,
300
302
  main,
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const defaultTag = "form";
3
+ export declare const Form: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLFormElement> & import("react").FormHTMLAttributes<HTMLFormElement> & {
4
+ initialState?: "error" | "initial" | "success" | undefined;
5
+ }, "ref"> & import("react").RefAttributes<HTMLFormElement>>;
@@ -0,0 +1,3 @@
1
+ import type { WsComponentMeta, WsComponentPropsMeta } from "../../components/component-meta";
2
+ export declare const meta: WsComponentMeta;
3
+ export declare const propsMeta: WsComponentPropsMeta;
@@ -21,6 +21,11 @@ export declare const customComponents: {
21
21
  target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
22
22
  prefetch?: "none" | "intent" | "render" | undefined;
23
23
  }, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
24
+ Form: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLFormElement> & import("react").FormHTMLAttributes<HTMLFormElement> & {
25
+ initialState?: "error" | "initial" | "success" | undefined;
26
+ }, "ref"> & import("react").RefAttributes<HTMLFormElement>>;
24
27
  };
25
28
  export declare const customComponentPropsMetas: Record<string, WsComponentPropsMeta>;
26
- export declare const customComponentMetas: {};
29
+ export declare const customComponentMetas: {
30
+ Form: import("../../components/component-meta").WsComponentMeta;
31
+ };
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,2 @@
1
+ import type { PropMeta } from "@webstudio-is/generate-arg-types";
2
+ export declare const props: Record<string, PropMeta>;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const defaultTag = "label";
3
+ export declare const CheckboxField: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor">, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,3 @@
1
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ export declare const meta: WsComponentMeta;
3
+ export declare const propsMeta: WsComponentPropsMeta;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const defaultTag = "input";
3
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,3 @@
1
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ export declare const meta: WsComponentMeta;
3
+ export declare const propsMeta: WsComponentPropsMeta;
@@ -595,6 +595,7 @@ export type ComponentState = z.infer<typeof ComponentState>;
595
595
  declare const WsComponentMeta: z.ZodObject<{
596
596
  category: z.ZodOptional<z.ZodEnum<["general", "typography", "media", "forms"]>>;
597
597
  type: z.ZodEnum<["container", "control", "embed", "rich-text", "rich-text-child"]>;
598
+ acceptedParents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
598
599
  label: z.ZodString;
599
600
  Icon: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
600
601
  presetStyle: z.ZodOptional<z.ZodAny>;
@@ -624,6 +625,7 @@ declare const WsComponentMeta: z.ZodObject<{
624
625
  value: string;
625
626
  } | import("../embed-template").EmbedTemplateInstance)[] | undefined;
626
627
  category?: "media" | "general" | "typography" | "forms" | undefined;
628
+ acceptedParents?: string[] | undefined;
627
629
  presetStyle?: any;
628
630
  states?: {
629
631
  label: string;
@@ -638,6 +640,7 @@ declare const WsComponentMeta: z.ZodObject<{
638
640
  value: string;
639
641
  } | import("../embed-template").EmbedTemplateInstance)[] | undefined;
640
642
  category?: "media" | "general" | "typography" | "forms" | undefined;
643
+ acceptedParents?: string[] | undefined;
641
644
  presetStyle?: any;
642
645
  states?: {
643
646
  label: string;
@@ -1,34 +1,19 @@
1
- /// <reference types="react" />
1
+ import type { forwardRef } from "react";
2
2
  import * as components from "./components";
3
3
  export type ComponentName = keyof typeof components;
4
4
  export declare const getComponentNames: () => ComponentName[];
5
+ type AnyComponent = ReturnType<typeof forwardRef<any, any>>;
5
6
  /**
6
7
  * Now used only in builder app
7
8
  * @todo Consider using the same approach in the builder app as in the published apps . A dynamic import is needed
8
9
  */
9
- export declare const getComponent: (name: string) => undefined | (typeof components)[ComponentName];
10
+ export declare const getComponent: (name: string) => undefined | AnyComponent;
10
11
  /**
11
12
  * The application imports only the components it uses, then pass them to createGetComponent i.e.
12
13
  * getComponent = createGetComponent({ Box, BlaBla })
13
14
  * <RootInstance data={data} getComponent={getComponent} />
14
15
  * see example /packages/sdk-size-test/app/routes/$.tsx
15
16
  **/
16
- export declare const createGetComponent: (comps: Partial<typeof components>) => (name: string) => import("react").ForwardRefExoticComponent<{
17
- children?: import("react").ReactNode;
18
- } & import("react").RefAttributes<HTMLDivElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>, "ref"> & import("react").RefAttributes<HTMLBodyElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
19
- tag?: "address" | "article" | "aside" | "div" | "figure" | "footer" | "header" | "main" | "nav" | "section" | undefined;
20
- }, "ref"> & import("react").RefAttributes<HTMLDivElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLHeadingElement> & import("react").HTMLAttributes<HTMLHeadingElement> & {
21
- tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | undefined;
22
- }, "ref"> & import("react").RefAttributes<HTMLHeadingElement>> | import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "href" | "target"> & {
23
- href?: string | undefined;
24
- target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
25
- prefetch?: "none" | "intent" | "render" | undefined;
26
- }, "ref"> & import("react").RefAttributes<HTMLAnchorElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
27
- innerText?: string | undefined;
28
- }, "ref"> & import("react").RefAttributes<HTMLButtonElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & import("react").RefAttributes<HTMLFormElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "ref"> & import("react").RefAttributes<HTMLImageElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>, "ref"> & import("react").RefAttributes<HTMLQuoteElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLUListElement> & import("react").HTMLAttributes<HTMLUListElement> & import("react").ClassAttributes<HTMLOListElement> & import("react").OlHTMLAttributes<HTMLOListElement> & {
29
- ordered?: boolean | undefined;
30
- }, "ref"> & import("react").RefAttributes<HTMLUListElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>> | import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHRElement>, HTMLHRElement>, "ref"> & import("react").RefAttributes<HTMLHRElement>> | import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "inline"> & {
31
- inline?: boolean | undefined;
32
- meta?: string | undefined;
33
- }, "ref"> & import("react").RefAttributes<HTMLElement>> | undefined;
17
+ export declare const createGetComponent: (comps: Partial<typeof components>) => (name: string) => undefined | AnyComponent;
34
18
  export type GetComponent = typeof getComponent;
19
+ export {};
@@ -29,3 +29,11 @@ export { List } from "./list";
29
29
  export { ListItem } from "./list-item";
30
30
  export { Separator } from "./separator";
31
31
  export { Code } from "./code";
32
+ export { Label } from "./label";
33
+ export { SuccessMessage } from "./success-message";
34
+ export { ErrorMessage } from "./error-message";
35
+ export { Textarea } from "./textarea";
36
+ export { RadioButtonField } from "./radio-button-field";
37
+ export { RadioButton } from "./radio-button";
38
+ export { CheckboxField } from "./checkbox-field";
39
+ export { Checkbox } from "./checkbox";
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const defaultTag = "div";
3
+ export declare const ErrorMessage: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ export declare const meta: WsComponentMeta;
3
+ export declare const propsMeta: WsComponentPropsMeta;
@@ -14,4 +14,5 @@ export declare let registeredComponents: RegisteredComponents | undefined;
14
14
  * break otherwise, see getComponent etc. So its overwriteComponent now
15
15
  **/
16
16
  export declare const registerComponents: (components: RegisteredComponents) => void;
17
+ export declare const canAcceptComponent: (parentComponent: string, childComponent: string) => boolean;
17
18
  export {};
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  export declare const defaultTag = "input";
3
- export declare const Input: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
3
+ export declare const Input: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
4
+ type?: "number" | "text" | "email" | "url" | "tel" | "password" | undefined;
5
+ }, "ref"> & import("react").RefAttributes<HTMLInputElement>>;