@webstudio-is/sdk-components-react-remix 0.173.0 → 0.175.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 +14 -14
- package/lib/metas.js +8 -1
- package/lib/props.js +8 -1
- package/lib/types/{sdk-components-react-remix/src/link.d.ts → link.d.ts} +4 -1
- package/lib/types/{sdk-components-react-remix/src/rich-text-link.d.ts → rich-text-link.d.ts} +4 -1
- package/lib/types/{sdk-components-react-remix/src/shared → shared}/remix-link.d.ts +4 -1
- package/package.json +8 -8
- package/lib/types/form-handlers/src/shared.d.ts +0 -29
- /package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/body.props.d.ts +0 -0
- /package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/link.props.d.ts +0 -0
- /package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/remix-form.props.d.ts +0 -0
- /package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/rich-text-link.props.d.ts +0 -0
- /package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/webhook-form.props.d.ts +0 -0
- /package/lib/types/{sdk-components-react-remix/src/body.d.ts → body.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/body.ws.d.ts → body.ws.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/components.d.ts → components.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/link.ws.d.ts → link.ws.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/metas.d.ts → metas.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/props.d.ts → props.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/remix-form.d.ts → remix-form.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/remix-form.ws.d.ts → remix-form.ws.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/rich-text-link.ws.d.ts → rich-text-link.ws.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/webhook-form.d.ts → webhook-form.d.ts} +0 -0
- /package/lib/types/{sdk-components-react-remix/src/webhook-form.ws.d.ts → webhook-form.ws.d.ts} +0 -0
package/lib/components.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Link as BaseLink } from "@webstudio-is/sdk-components-react";
|
|
|
17
17
|
// src/shared/remix-link.tsx
|
|
18
18
|
import { forwardRef as forwardRef2, useContext } from "react";
|
|
19
19
|
import { NavLink as RemixLink } from "@remix-run/react";
|
|
20
|
-
import { ReactSdkContext } from "@webstudio-is/react-sdk";
|
|
20
|
+
import { ReactSdkContext } from "@webstudio-is/react-sdk/runtime";
|
|
21
21
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
22
22
|
var wrapLinkComponent = (BaseLink3) => {
|
|
23
23
|
const Component = forwardRef2((props, ref) => {
|
|
@@ -52,14 +52,7 @@ import {
|
|
|
52
52
|
useEffect
|
|
53
53
|
} from "react";
|
|
54
54
|
import { useFetcher } from "@remix-run/react";
|
|
55
|
-
import { formIdFieldName
|
|
56
|
-
|
|
57
|
-
// ../form-handlers/src/shared.ts
|
|
58
|
-
var formHiddenFieldPrefix = "ws--form";
|
|
59
|
-
var formIdFieldName = `${formHiddenFieldPrefix}-id`;
|
|
60
|
-
var formBotFieldName = `${formHiddenFieldPrefix}-bot`;
|
|
61
|
-
|
|
62
|
-
// src/webhook-form.tsx
|
|
55
|
+
import { formIdFieldName, formBotFieldName } from "@webstudio-is/sdk";
|
|
63
56
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
64
57
|
var useOnFetchEnd = (fetcher, handler) => {
|
|
65
58
|
const latestHandler = useRef(handler);
|
|
@@ -121,7 +114,14 @@ var WebhookForm = forwardRef3(
|
|
|
121
114
|
ref,
|
|
122
115
|
onSubmit: handleSubmitAndAddHiddenJsField,
|
|
123
116
|
children: [
|
|
124
|
-
/* @__PURE__ */ jsx3(
|
|
117
|
+
/* @__PURE__ */ jsx3(
|
|
118
|
+
"input",
|
|
119
|
+
{
|
|
120
|
+
type: "hidden",
|
|
121
|
+
name: formIdFieldName,
|
|
122
|
+
value: action?.toString()
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
125
|
children
|
|
126
126
|
]
|
|
127
127
|
}
|
|
@@ -136,13 +136,13 @@ import {
|
|
|
136
136
|
useContext as useContext2
|
|
137
137
|
} from "react";
|
|
138
138
|
import { Form } from "@remix-run/react";
|
|
139
|
-
import { ReactSdkContext as ReactSdkContext2 } from "@webstudio-is/react-sdk";
|
|
139
|
+
import { ReactSdkContext as ReactSdkContext2 } from "@webstudio-is/react-sdk/runtime";
|
|
140
140
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
141
|
-
var RemixForm = forwardRef4((props, ref) => {
|
|
141
|
+
var RemixForm = forwardRef4(({ action, ...props }, ref) => {
|
|
142
142
|
const { renderer } = useContext2(ReactSdkContext2);
|
|
143
|
-
if (
|
|
143
|
+
if (action === void 0 || action === "" || typeof action === "string" && action?.startsWith("/")) {
|
|
144
144
|
if (renderer !== "canvas" && renderer !== "preview") {
|
|
145
|
-
return /* @__PURE__ */ jsx4(Form, { ...props, ref });
|
|
145
|
+
return /* @__PURE__ */ jsx4(Form, { action, ...props, ref });
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
return /* @__PURE__ */ jsx4("form", { ...props, ref });
|
package/lib/metas.js
CHANGED
|
@@ -376,12 +376,19 @@ var props = {
|
|
|
376
376
|
},
|
|
377
377
|
datatype: { required: false, control: "text", type: "string" },
|
|
378
378
|
defaultChecked: { required: false, control: "boolean", type: "boolean" },
|
|
379
|
+
defaultValue: { required: false, control: "text", type: "string" },
|
|
379
380
|
dir: {
|
|
380
381
|
required: false,
|
|
381
382
|
control: "text",
|
|
382
383
|
type: "string",
|
|
383
384
|
description: "Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)"
|
|
384
385
|
},
|
|
386
|
+
download: {
|
|
387
|
+
required: false,
|
|
388
|
+
control: "boolean",
|
|
389
|
+
type: "boolean",
|
|
390
|
+
description: "Indicates that the hyperlink is to be used for downloading a resource."
|
|
391
|
+
},
|
|
385
392
|
draggable: {
|
|
386
393
|
required: false,
|
|
387
394
|
control: "boolean",
|
|
@@ -579,7 +586,7 @@ var propsMeta = {
|
|
|
579
586
|
required: false
|
|
580
587
|
}
|
|
581
588
|
},
|
|
582
|
-
initialProps: ["id", "className", "href", "target", "prefetch"]
|
|
589
|
+
initialProps: ["id", "className", "href", "target", "prefetch", "download"]
|
|
583
590
|
};
|
|
584
591
|
|
|
585
592
|
// src/rich-text-link.ws.ts
|
package/lib/props.js
CHANGED
|
@@ -376,12 +376,19 @@ var props = {
|
|
|
376
376
|
},
|
|
377
377
|
datatype: { required: false, control: "text", type: "string" },
|
|
378
378
|
defaultChecked: { required: false, control: "boolean", type: "boolean" },
|
|
379
|
+
defaultValue: { required: false, control: "text", type: "string" },
|
|
379
380
|
dir: {
|
|
380
381
|
required: false,
|
|
381
382
|
control: "text",
|
|
382
383
|
type: "string",
|
|
383
384
|
description: "Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)"
|
|
384
385
|
},
|
|
386
|
+
download: {
|
|
387
|
+
required: false,
|
|
388
|
+
control: "boolean",
|
|
389
|
+
type: "boolean",
|
|
390
|
+
description: "Indicates that the hyperlink is to be used for downloading a resource."
|
|
391
|
+
},
|
|
385
392
|
draggable: {
|
|
386
393
|
required: false,
|
|
387
394
|
control: "boolean",
|
|
@@ -579,7 +586,7 @@ var propsMeta = {
|
|
|
579
586
|
required: false
|
|
580
587
|
}
|
|
581
588
|
},
|
|
582
|
-
initialProps: ["id", "className", "href", "target", "prefetch"]
|
|
589
|
+
initialProps: ["id", "className", "href", "target", "prefetch", "download"]
|
|
583
590
|
};
|
|
584
591
|
|
|
585
592
|
// src/rich-text-link.ws.ts
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export declare const Link: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "target"> & {
|
|
1
|
+
export declare const Link: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "target" | "download"> & {
|
|
2
2
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
3
|
+
download?: boolean;
|
|
4
|
+
} & {
|
|
5
|
+
$webstudio$canvasOnly$assetId?: string | undefined;
|
|
3
6
|
}, "ref"> & import("react").RefAttributes<HTMLAnchorElement>, "ref">, "target"> & {
|
|
4
7
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
5
8
|
prefetch?: "none" | "intent" | "render" | "viewport";
|
package/lib/types/{sdk-components-react-remix/src/rich-text-link.d.ts → rich-text-link.d.ts}
RENAMED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export declare const RichTextLink: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "target"> & {
|
|
1
|
+
export declare const RichTextLink: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "target" | "download"> & {
|
|
2
2
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
3
|
+
download?: boolean;
|
|
4
|
+
} & {
|
|
5
|
+
$webstudio$canvasOnly$assetId?: string | undefined;
|
|
3
6
|
}, "ref"> & import("react").RefAttributes<HTMLAnchorElement>, "ref">, "target"> & {
|
|
4
7
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
5
8
|
prefetch?: "none" | "intent" | "render" | "viewport";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Link } from "@webstudio-is/sdk-components-react";
|
|
2
|
-
export declare const wrapLinkComponent: (BaseLink: typeof Link) => import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "target"> & {
|
|
2
|
+
export declare const wrapLinkComponent: (BaseLink: typeof Link) => import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "target" | "download"> & {
|
|
3
3
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
4
|
+
download?: boolean;
|
|
5
|
+
} & {
|
|
6
|
+
$webstudio$canvasOnly$assetId?: string | undefined;
|
|
4
7
|
}, "ref"> & import("react").RefAttributes<HTMLAnchorElement>, "ref">, "target"> & {
|
|
5
8
|
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
6
9
|
prefetch?: "none" | "intent" | "render" | "viewport";
|
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.175.0",
|
|
4
4
|
"description": "Webstudio components for Remix",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"react-dom": "18.3.0-canary-14898b6a9-20240318"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@webstudio-is/
|
|
39
|
-
"@webstudio-is/
|
|
40
|
-
"@webstudio-is/
|
|
41
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
38
|
+
"@webstudio-is/icons": "0.175.0",
|
|
39
|
+
"@webstudio-is/react-sdk": "0.175.0",
|
|
40
|
+
"@webstudio-is/sdk": "0.175.0",
|
|
41
|
+
"@webstudio-is/sdk-components-react": "0.175.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@remix-run/react": "^2.
|
|
44
|
+
"@remix-run/react": "^2.11.0",
|
|
45
45
|
"@types/node": "^20.12.7",
|
|
46
46
|
"@types/react": "^18.2.70",
|
|
47
47
|
"@types/react-dom": "^18.2.25",
|
|
48
48
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
49
49
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
50
50
|
"typescript": "5.5.2",
|
|
51
|
-
"@webstudio-is/
|
|
52
|
-
"@webstudio-is/
|
|
51
|
+
"@webstudio-is/tsconfig": "1.0.7",
|
|
52
|
+
"@webstudio-is/generate-arg-types": "0.0.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "rm -rf lib && esbuild src/components.ts src/metas.ts src/props.ts --outdir=lib --bundle --format=esm --packages=external",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const formIdFieldName = "ws--form-id";
|
|
2
|
-
export declare const formBotFieldName = "ws--form-bot";
|
|
3
|
-
export type FormInfo = {
|
|
4
|
-
formId: string;
|
|
5
|
-
pageUrl: string;
|
|
6
|
-
formData: FormData;
|
|
7
|
-
toEmail: string;
|
|
8
|
-
fromEmail: string;
|
|
9
|
-
};
|
|
10
|
-
export type EmailInfo = {
|
|
11
|
-
from: string;
|
|
12
|
-
to: string;
|
|
13
|
-
txt: string;
|
|
14
|
-
/** Only the body content, requers wrapping into `<!DOCTYPE html><html><body>...</body></html>` */
|
|
15
|
-
html: string;
|
|
16
|
-
subject: string;
|
|
17
|
-
};
|
|
18
|
-
export type Result = {
|
|
19
|
-
success: true;
|
|
20
|
-
} | {
|
|
21
|
-
success: false;
|
|
22
|
-
errors: string[];
|
|
23
|
-
};
|
|
24
|
-
export declare const formToEmail: ({ formData, pageUrl, toEmail, fromEmail, }: FormInfo) => EmailInfo;
|
|
25
|
-
export declare const getResponseBody: (response: Response) => Promise<{
|
|
26
|
-
text: string;
|
|
27
|
-
json?: Record<string, unknown>;
|
|
28
|
-
}>;
|
|
29
|
-
export declare const getErrors: (json: Record<string, unknown> | undefined) => string[] | undefined;
|
/package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/body.props.d.ts
RENAMED
|
File without changes
|
/package/lib/types/{sdk-components-react-remix/src/__generated__ → __generated__}/link.props.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/types/{sdk-components-react-remix/src/rich-text-link.ws.d.ts → rich-text-link.ws.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/lib/types/{sdk-components-react-remix/src/webhook-form.ws.d.ts → webhook-form.ws.d.ts}
RENAMED
|
File without changes
|