@webstudio-is/react-sdk 0.45.0 → 0.47.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/cjs/components/__generated__/button.props.cjs +6 -0
- package/lib/cjs/components/__generated__/link-block.props.cjs +1 -1
- package/lib/cjs/components/__generated__/link.props.cjs +1 -2
- package/lib/cjs/components/__generated__/rich-text-link.props.cjs +1 -1
- package/lib/cjs/components/button.cjs +9 -5
- package/lib/cjs/components/button.ws.cjs +3 -4
- package/lib/cjs/components/link.cjs +1 -2
- package/lib/cjs/css/categories.cjs +2 -1
- package/lib/components/__generated__/button.props.js +6 -0
- package/lib/components/__generated__/link-block.props.js +1 -1
- package/lib/components/__generated__/link.props.js +1 -2
- package/lib/components/__generated__/rich-text-link.props.js +1 -1
- package/lib/components/button.js +9 -5
- package/lib/components/button.ws.js +3 -4
- package/lib/components/link.js +1 -2
- package/lib/css/categories.js +2 -1
- package/package.json +11 -12
- package/src/components/__generated__/button.props.ts +6 -0
- package/src/components/__generated__/link-block.props.ts +1 -1
- package/src/components/__generated__/link.props.ts +1 -2
- package/src/components/__generated__/rich-text-link.props.ts +1 -1
- package/src/components/button.stories.tsx +0 -4
- package/src/components/button.tsx +14 -5
- package/src/components/button.ws.tsx +2 -3
- package/src/components/link.tsx +4 -3
- package/src/css/categories.ts +1 -0
|
@@ -35,7 +35,7 @@ const props = {
|
|
|
35
35
|
required: false,
|
|
36
36
|
control: "select",
|
|
37
37
|
type: "string",
|
|
38
|
-
options: ["
|
|
38
|
+
options: ["_self", "_blank", "_parent", "_top"]
|
|
39
39
|
},
|
|
40
40
|
type: { required: false, control: "text", type: "string" },
|
|
41
41
|
referrerPolicy: {
|
|
@@ -35,8 +35,7 @@ const props = {
|
|
|
35
35
|
required: false,
|
|
36
36
|
control: "select",
|
|
37
37
|
type: "string",
|
|
38
|
-
|
|
39
|
-
options: ["self", "blank", "parent", "top"]
|
|
38
|
+
options: ["_self", "_blank", "_parent", "_top"]
|
|
40
39
|
},
|
|
41
40
|
type: { required: false, control: "text", type: "string" },
|
|
42
41
|
referrerPolicy: {
|
|
@@ -35,7 +35,7 @@ const props = {
|
|
|
35
35
|
required: false,
|
|
36
36
|
control: "select",
|
|
37
37
|
type: "string",
|
|
38
|
-
options: ["
|
|
38
|
+
options: ["_self", "_blank", "_parent", "_top"]
|
|
39
39
|
},
|
|
40
40
|
type: { required: false, control: "text", type: "string" },
|
|
41
41
|
referrerPolicy: {
|
|
@@ -25,12 +25,16 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const defaultTag = "button";
|
|
27
27
|
const Button = (0, import_react.forwardRef)(
|
|
28
|
-
(
|
|
28
|
+
({
|
|
29
|
+
type = "submit",
|
|
30
|
+
innerText = "Edit Inner Text in Properties",
|
|
31
|
+
children,
|
|
32
|
+
...props
|
|
33
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
34
|
+
type,
|
|
29
35
|
...props,
|
|
30
|
-
ref
|
|
36
|
+
ref,
|
|
37
|
+
children: children ? children : innerText
|
|
31
38
|
})
|
|
32
39
|
);
|
|
33
|
-
Button.defaultProps = {
|
|
34
|
-
type: "submit"
|
|
35
|
-
};
|
|
36
40
|
Button.displayName = "Button";
|
|
@@ -25,12 +25,11 @@ module.exports = __toCommonJS(button_ws_exports);
|
|
|
25
25
|
var import_icons = require("@webstudio-is/icons");
|
|
26
26
|
var import_button = require("./__generated__/button.props");
|
|
27
27
|
const meta = {
|
|
28
|
-
type: "
|
|
28
|
+
type: "container",
|
|
29
29
|
label: "Button",
|
|
30
|
-
Icon: import_icons.ButtonIcon
|
|
31
|
-
children: ["Button text you can edit"]
|
|
30
|
+
Icon: import_icons.ButtonIcon
|
|
32
31
|
};
|
|
33
32
|
const propsMeta = {
|
|
34
33
|
props: import_button.props,
|
|
35
|
-
initialProps: ["type"]
|
|
34
|
+
initialProps: ["type", "innerText", "aria-label"]
|
|
36
35
|
};
|
|
@@ -24,10 +24,9 @@ module.exports = __toCommonJS(link_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
const Link = (0, import_react.forwardRef)(
|
|
27
|
-
({ href = "",
|
|
27
|
+
({ href = "", ...props }, ref) => {
|
|
28
28
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
29
29
|
...props,
|
|
30
|
-
target: `_${target}`,
|
|
31
30
|
href,
|
|
32
31
|
ref
|
|
33
32
|
});
|
|
@@ -12,7 +12,7 @@ const props = {
|
|
|
12
12
|
required: false,
|
|
13
13
|
control: "select",
|
|
14
14
|
type: "string",
|
|
15
|
-
options: ["
|
|
15
|
+
options: ["_self", "_blank", "_parent", "_top"]
|
|
16
16
|
},
|
|
17
17
|
type: { required: false, control: "text", type: "string" },
|
|
18
18
|
referrerPolicy: {
|
|
@@ -12,8 +12,7 @@ const props = {
|
|
|
12
12
|
required: false,
|
|
13
13
|
control: "select",
|
|
14
14
|
type: "string",
|
|
15
|
-
|
|
16
|
-
options: ["self", "blank", "parent", "top"]
|
|
15
|
+
options: ["_self", "_blank", "_parent", "_top"]
|
|
17
16
|
},
|
|
18
17
|
type: { required: false, control: "text", type: "string" },
|
|
19
18
|
referrerPolicy: {
|
|
@@ -12,7 +12,7 @@ const props = {
|
|
|
12
12
|
required: false,
|
|
13
13
|
control: "select",
|
|
14
14
|
type: "string",
|
|
15
|
-
options: ["
|
|
15
|
+
options: ["_self", "_blank", "_parent", "_top"]
|
|
16
16
|
},
|
|
17
17
|
type: { required: false, control: "text", type: "string" },
|
|
18
18
|
referrerPolicy: {
|
package/lib/components/button.js
CHANGED
|
@@ -2,14 +2,18 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
const defaultTag = "button";
|
|
4
4
|
const Button = forwardRef(
|
|
5
|
-
(
|
|
5
|
+
({
|
|
6
|
+
type = "submit",
|
|
7
|
+
innerText = "Edit Inner Text in Properties",
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => /* @__PURE__ */ jsx("button", {
|
|
11
|
+
type,
|
|
6
12
|
...props,
|
|
7
|
-
ref
|
|
13
|
+
ref,
|
|
14
|
+
children: children ? children : innerText
|
|
8
15
|
})
|
|
9
16
|
);
|
|
10
|
-
Button.defaultProps = {
|
|
11
|
-
type: "submit"
|
|
12
|
-
};
|
|
13
17
|
Button.displayName = "Button";
|
|
14
18
|
export {
|
|
15
19
|
Button
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ButtonIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { props } from "./__generated__/button.props";
|
|
3
3
|
const meta = {
|
|
4
|
-
type: "
|
|
4
|
+
type: "container",
|
|
5
5
|
label: "Button",
|
|
6
|
-
Icon: ButtonIcon
|
|
7
|
-
children: ["Button text you can edit"]
|
|
6
|
+
Icon: ButtonIcon
|
|
8
7
|
};
|
|
9
8
|
const propsMeta = {
|
|
10
9
|
props,
|
|
11
|
-
initialProps: ["type"]
|
|
10
|
+
initialProps: ["type", "innerText", "aria-label"]
|
|
12
11
|
};
|
|
13
12
|
export {
|
|
14
13
|
meta,
|
package/lib/components/link.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
const Link = forwardRef(
|
|
4
|
-
({ href = "",
|
|
4
|
+
({ href = "", ...props }, ref) => {
|
|
5
5
|
return /* @__PURE__ */ jsx("a", {
|
|
6
6
|
...props,
|
|
7
|
-
target: `_${target}`,
|
|
8
7
|
href,
|
|
9
8
|
ref
|
|
10
9
|
});
|
package/lib/css/categories.js
CHANGED
package/package.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@babel/core": "^7.
|
|
9
|
+
"@babel/core": "^7.21.0",
|
|
10
10
|
"@esbuild-kit/esm-loader": "^2.4.2",
|
|
11
11
|
"@jest/globals": "^29.3.1",
|
|
12
12
|
"@remix-run/node": "1.12.0",
|
|
13
13
|
"@remix-run/react": "1.12.0",
|
|
14
14
|
"@remix-run/server-runtime": "1.12.0",
|
|
15
15
|
"@storybook/react": "^6.5.14",
|
|
16
|
-
"@storybook/testing-library": "^0.0.11",
|
|
17
16
|
"@types/node": "^18.11.18",
|
|
18
17
|
"@types/react": "^17.0.24",
|
|
19
18
|
"@types/react-dom": "^17.0.9",
|
|
20
|
-
"babel-loader": "^
|
|
19
|
+
"babel-loader": "^9.1.2",
|
|
21
20
|
"esbuild": "^0.14.25",
|
|
22
21
|
"esbuild-node-externals": "^1.4.1",
|
|
23
22
|
"jest": "^29.3.1",
|
|
@@ -46,14 +45,14 @@
|
|
|
46
45
|
"mitt": "^3.0.0",
|
|
47
46
|
"nanostores": "^0.7.1",
|
|
48
47
|
"warn-once": "^0.1.1",
|
|
49
|
-
"@webstudio-is/asset-uploader": "^0.
|
|
50
|
-
"@webstudio-is/css-data": "^0.
|
|
51
|
-
"@webstudio-is/css-vars": "^0.
|
|
52
|
-
"@webstudio-is/generate-arg-types": "^0.
|
|
53
|
-
"@webstudio-is/icons": "^0.
|
|
54
|
-
"@webstudio-is/image": "^0.
|
|
55
|
-
"@webstudio-is/prisma-client": "^0.
|
|
56
|
-
"@webstudio-is/project-build": "^0.
|
|
48
|
+
"@webstudio-is/asset-uploader": "^0.47.0",
|
|
49
|
+
"@webstudio-is/css-data": "^0.47.0",
|
|
50
|
+
"@webstudio-is/css-vars": "^0.47.0",
|
|
51
|
+
"@webstudio-is/generate-arg-types": "^0.47.0",
|
|
52
|
+
"@webstudio-is/icons": "^0.47.0",
|
|
53
|
+
"@webstudio-is/image": "^0.47.0",
|
|
54
|
+
"@webstudio-is/prisma-client": "^0.47.0",
|
|
55
|
+
"@webstudio-is/project-build": "^0.47.0"
|
|
57
56
|
},
|
|
58
57
|
"exports": {
|
|
59
58
|
".": {
|
|
@@ -14,7 +14,7 @@ export const props: Record<string, PropMeta> = {
|
|
|
14
14
|
required: false,
|
|
15
15
|
control: "select",
|
|
16
16
|
type: "string",
|
|
17
|
-
options: ["
|
|
17
|
+
options: ["_self", "_blank", "_parent", "_top"],
|
|
18
18
|
},
|
|
19
19
|
type: { required: false, control: "text", type: "string" },
|
|
20
20
|
referrerPolicy: {
|
|
@@ -14,8 +14,7 @@ export const props: Record<string, PropMeta> = {
|
|
|
14
14
|
required: false,
|
|
15
15
|
control: "select",
|
|
16
16
|
type: "string",
|
|
17
|
-
|
|
18
|
-
options: ["self", "blank", "parent", "top"],
|
|
17
|
+
options: ["_self", "_blank", "_parent", "_top"],
|
|
19
18
|
},
|
|
20
19
|
type: { required: false, control: "text", type: "string" },
|
|
21
20
|
referrerPolicy: {
|
|
@@ -14,7 +14,7 @@ export const props: Record<string, PropMeta> = {
|
|
|
14
14
|
required: false,
|
|
15
15
|
control: "select",
|
|
16
16
|
type: "string",
|
|
17
|
-
options: ["
|
|
17
|
+
options: ["_self", "_blank", "_parent", "_top"],
|
|
18
18
|
},
|
|
19
19
|
type: { required: false, control: "text", type: "string" },
|
|
20
20
|
referrerPolicy: {
|
|
@@ -2,13 +2,22 @@ import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
|
2
2
|
|
|
3
3
|
const defaultTag = "button";
|
|
4
4
|
|
|
5
|
-
type ButtonProps = ComponentProps<typeof defaultTag
|
|
5
|
+
type ButtonProps = ComponentProps<typeof defaultTag> & { innerText?: string };
|
|
6
6
|
|
|
7
7
|
export const Button = forwardRef<ElementRef<typeof defaultTag>, ButtonProps>(
|
|
8
|
-
(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
type = "submit",
|
|
11
|
+
innerText = "Edit Inner Text in Properties",
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
},
|
|
15
|
+
ref
|
|
16
|
+
) => (
|
|
17
|
+
<button type={type} {...props} ref={ref}>
|
|
18
|
+
{children ? children : innerText}
|
|
19
|
+
</button>
|
|
20
|
+
)
|
|
9
21
|
);
|
|
10
22
|
|
|
11
|
-
Button.defaultProps = {
|
|
12
|
-
type: "submit", // Match the platform default
|
|
13
|
-
};
|
|
14
23
|
Button.displayName = "Button";
|
|
@@ -3,13 +3,12 @@ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
|
|
|
3
3
|
import { props } from "./__generated__/button.props";
|
|
4
4
|
|
|
5
5
|
export const meta: WsComponentMeta = {
|
|
6
|
-
type: "
|
|
6
|
+
type: "container",
|
|
7
7
|
label: "Button",
|
|
8
8
|
Icon: ButtonIcon,
|
|
9
|
-
children: ["Button text you can edit"],
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export const propsMeta: WsComponentPropsMeta = {
|
|
13
12
|
props,
|
|
14
|
-
initialProps: ["type"],
|
|
13
|
+
initialProps: ["type", "innerText", "aria-label"],
|
|
15
14
|
};
|
package/src/components/link.tsx
CHANGED
|
@@ -3,15 +3,16 @@ import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
|
3
3
|
// @todo props that come from remix link, shouldn't be here at all
|
|
4
4
|
// - prefetch should be only on remix component and it already is
|
|
5
5
|
// - props meta should be generated from Remix link
|
|
6
|
+
// - changing this requires update in app/canvas/custom-components/link.tsx
|
|
6
7
|
type Props = Omit<ComponentProps<"a">, "href" | "target"> & {
|
|
7
8
|
href?: string;
|
|
8
|
-
target?: "
|
|
9
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
9
10
|
prefetch?: "none" | "intent" | "render";
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Link = forwardRef<ElementRef<"a">, Props>(
|
|
13
|
-
({ href = "",
|
|
14
|
-
return <a {...props}
|
|
14
|
+
({ href = "", ...props }, ref) => {
|
|
15
|
+
return <a {...props} href={href} ref={ref} />;
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
18
|
|