@webstudio-is/sdk-components-react-remix 0.118.0 → 0.119.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/components.js +24 -10
- package/lib/metas.js +5 -0
- package/lib/props.js +5 -0
- package/lib/types/body.d.ts +2 -0
- package/lib/types/body.ws.d.ts +2 -0
- package/lib/types/components.d.ts +1 -0
- package/lib/types/metas.d.ts +1 -0
- package/lib/types/props.d.ts +1 -0
- package/package.json +6 -6
package/lib/components.js
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
|
+
// src/body.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Scripts, ScrollRestoration } from "@remix-run/react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
var Body = forwardRef(
|
|
6
|
+
({ children, ...props }, ref) => /* @__PURE__ */ jsxs("body", { ...props, ref, children: [
|
|
7
|
+
children,
|
|
8
|
+
/* @__PURE__ */ jsx(Scripts, {}),
|
|
9
|
+
/* @__PURE__ */ jsx(ScrollRestoration, {})
|
|
10
|
+
] })
|
|
11
|
+
);
|
|
12
|
+
Body.displayName = "Body";
|
|
13
|
+
|
|
1
14
|
// src/link.tsx
|
|
2
15
|
import { Link as BaseLink } from "@webstudio-is/sdk-components-react";
|
|
3
16
|
|
|
4
17
|
// src/shared/remix-link.tsx
|
|
5
|
-
import { forwardRef, useContext } from "react";
|
|
18
|
+
import { forwardRef as forwardRef2, useContext } from "react";
|
|
6
19
|
import { NavLink as RemixLink } from "@remix-run/react";
|
|
7
20
|
import { ReactSdkContext } from "@webstudio-is/react-sdk";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
9
22
|
var wrapLinkComponent = (BaseLink3) => {
|
|
10
|
-
const Component =
|
|
23
|
+
const Component = forwardRef2((props, ref) => {
|
|
11
24
|
const { pagesPaths } = useContext(ReactSdkContext);
|
|
12
25
|
const href = props.href;
|
|
13
26
|
if (href !== void 0) {
|
|
14
27
|
const url = new URL(href, "https://any-valid.url");
|
|
15
28
|
if (pagesPaths.has(url.pathname === "/" ? "" : url.pathname)) {
|
|
16
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx2(RemixLink, { ...props, to: href, ref });
|
|
17
30
|
}
|
|
18
31
|
}
|
|
19
32
|
const { prefetch, reloadDocument, replace, preventScrollReset, ...rest } = props;
|
|
20
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ jsx2(BaseLink3, { ...rest, ref });
|
|
21
34
|
});
|
|
22
35
|
Component.displayName = BaseLink3.displayName;
|
|
23
36
|
return Component;
|
|
@@ -32,14 +45,14 @@ var RichTextLink = wrapLinkComponent(BaseLink2);
|
|
|
32
45
|
|
|
33
46
|
// src/form.tsx
|
|
34
47
|
import {
|
|
35
|
-
forwardRef as
|
|
48
|
+
forwardRef as forwardRef3,
|
|
36
49
|
useRef,
|
|
37
50
|
useEffect
|
|
38
51
|
} from "react";
|
|
39
52
|
import { useFetcher } from "@remix-run/react";
|
|
40
53
|
import { formIdFieldName } from "@webstudio-is/form-handlers";
|
|
41
54
|
import { getInstanceIdFromComponentProps } from "@webstudio-is/react-sdk";
|
|
42
|
-
import { jsx as
|
|
55
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
43
56
|
var useOnFetchEnd = (fetcher, handler) => {
|
|
44
57
|
const latestHandler = useRef(handler);
|
|
45
58
|
latestHandler.current = handler;
|
|
@@ -51,7 +64,7 @@ var useOnFetchEnd = (fetcher, handler) => {
|
|
|
51
64
|
prevFetcher.current = fetcher;
|
|
52
65
|
}, [fetcher]);
|
|
53
66
|
};
|
|
54
|
-
var Form =
|
|
67
|
+
var Form = forwardRef3(
|
|
55
68
|
({ children, action, method, state = "initial", onStateChange, ...rest }, ref) => {
|
|
56
69
|
const fetcher = useFetcher();
|
|
57
70
|
const instanceId = getInstanceIdFromComponentProps(rest);
|
|
@@ -59,14 +72,15 @@ var Form = forwardRef2(
|
|
|
59
72
|
const state2 = data?.success === true ? "success" : "error";
|
|
60
73
|
onStateChange?.(state2);
|
|
61
74
|
});
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ jsxs2(fetcher.Form, { ...rest, method: "post", "data-state": state, ref, children: [
|
|
76
|
+
/* @__PURE__ */ jsx3("input", { type: "hidden", name: formIdFieldName, value: instanceId }),
|
|
64
77
|
children
|
|
65
78
|
] });
|
|
66
79
|
}
|
|
67
80
|
);
|
|
68
81
|
Form.displayName = "Form";
|
|
69
82
|
export {
|
|
83
|
+
Body,
|
|
70
84
|
Form,
|
|
71
85
|
Link,
|
|
72
86
|
RichTextLink
|
package/lib/metas.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// src/body.ws.tsx
|
|
2
|
+
import { Body } from "@webstudio-is/sdk-components-react/metas";
|
|
3
|
+
import { Body as Body2 } from "@webstudio-is/sdk-components-react/props";
|
|
4
|
+
|
|
1
5
|
// src/__generated__/link.props.ts
|
|
2
6
|
var props = {
|
|
3
7
|
about: { required: false, control: "text", type: "string" },
|
|
@@ -709,6 +713,7 @@ var meta = {
|
|
|
709
713
|
]
|
|
710
714
|
};
|
|
711
715
|
export {
|
|
716
|
+
Body,
|
|
712
717
|
meta as Form,
|
|
713
718
|
Link,
|
|
714
719
|
RichTextLink
|
package/lib/props.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// src/body.ws.tsx
|
|
2
|
+
import { Body } from "@webstudio-is/sdk-components-react/metas";
|
|
3
|
+
import { Body as Body2 } from "@webstudio-is/sdk-components-react/props";
|
|
4
|
+
|
|
1
5
|
// src/__generated__/link.props.ts
|
|
2
6
|
var props = {
|
|
3
7
|
about: { required: false, control: "text", type: "string" },
|
|
@@ -1178,6 +1182,7 @@ var propsMeta3 = {
|
|
|
1178
1182
|
initialProps: ["id", "state", "action"]
|
|
1179
1183
|
};
|
|
1180
1184
|
export {
|
|
1185
|
+
Body2 as Body,
|
|
1181
1186
|
propsMeta3 as Form,
|
|
1182
1187
|
propsMeta as Link,
|
|
1183
1188
|
propsMeta2 as RichTextLink
|
package/lib/types/metas.d.ts
CHANGED
package/lib/types/props.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk-components-react-remix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.119.0",
|
|
4
4
|
"description": "Webstudio components for Remix",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"react-dom": "^18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@webstudio-is/
|
|
42
|
-
"@webstudio-is/
|
|
43
|
-
"@webstudio-is/react-sdk": "0.
|
|
44
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
41
|
+
"@webstudio-is/form-handlers": "0.119.0",
|
|
42
|
+
"@webstudio-is/icons": "0.119.0",
|
|
43
|
+
"@webstudio-is/react-sdk": "0.119.0",
|
|
44
|
+
"@webstudio-is/sdk-components-react": "0.119.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@remix-run/react": "^1.19.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-dom": "^18.2.0",
|
|
52
52
|
"typescript": "5.2.2",
|
|
53
|
-
"@webstudio-is/generate-arg-types": "0.
|
|
53
|
+
"@webstudio-is/generate-arg-types": "0.119.0",
|
|
54
54
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|