@webstudio-is/sdk-components-react-remix 0.79.0 → 0.81.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.
@@ -322,7 +322,16 @@ const props = {
322
322
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
323
323
  dir: { required: false, control: "text", type: "string" },
324
324
  draggable: { required: false, control: "boolean", type: "boolean" },
325
- encType: { required: false, control: "text", type: "string" },
325
+ encType: {
326
+ required: false,
327
+ control: "radio",
328
+ type: "string",
329
+ options: [
330
+ "application/x-www-form-urlencoded",
331
+ "multipart/form-data",
332
+ "text/plain"
333
+ ]
334
+ },
326
335
  hidden: { required: false, control: "boolean", type: "boolean" },
327
336
  id: { required: false, control: "text", type: "string" },
328
337
  inputMode: {
@@ -345,7 +345,16 @@ const props = {
345
345
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
346
346
  dir: { required: false, control: "text", type: "string" },
347
347
  draggable: { required: false, control: "boolean", type: "boolean" },
348
- encType: { required: false, control: "text", type: "string" },
348
+ encType: {
349
+ required: false,
350
+ control: "radio",
351
+ type: "string",
352
+ options: [
353
+ "application/x-www-form-urlencoded",
354
+ "multipart/form-data",
355
+ "text/plain"
356
+ ]
357
+ },
349
358
  hidden: { required: false, control: "boolean", type: "boolean" },
350
359
  id: { required: false, control: "text", type: "string" },
351
360
  inputMode: {
package/lib/cjs/form.js CHANGED
@@ -40,12 +40,12 @@ const useOnFetchEnd = (fetcher, handler) => {
40
40
  }, [fetcher]);
41
41
  };
42
42
  const Form = (0, import_react.forwardRef)(({ children, action, method, state = "initial", ...rest }, ref) => {
43
- const { setDataSourceValue } = (0, import_react.useContext)(import_react_sdk.ReactSdkContext);
43
+ const { setBoundDataSourceValue } = (0, import_react.useContext)(import_react_sdk.ReactSdkContext);
44
44
  const fetcher = (0, import_react2.useFetcher)();
45
45
  const instanceId = (0, import_react_sdk.getInstanceIdFromComponentProps)(rest);
46
46
  useOnFetchEnd(fetcher, (data) => {
47
47
  const state2 = data?.success === true ? "success" : "error";
48
- setDataSourceValue(instanceId, "state", state2);
48
+ setBoundDataSourceValue(instanceId, "state", state2);
49
49
  });
50
50
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(fetcher.Form, { ...rest, method: "post", "data-state": state, ref, children: [
51
51
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "hidden", name: import_form_handlers.formIdFieldName, value: instanceId }),
@@ -150,5 +150,5 @@ const meta = {
150
150
  };
151
151
  const propsMeta = {
152
152
  props: import_form.props,
153
- initialProps: ["state"]
153
+ initialProps: ["id", "state"]
154
154
  };
@@ -33,5 +33,5 @@ const propsMeta = {
33
33
  required: false
34
34
  }
35
35
  },
36
- initialProps: ["href", "target", "prefetch"]
36
+ initialProps: ["id", "href", "target", "prefetch"]
37
37
  };
package/lib/form.js CHANGED
@@ -24,12 +24,12 @@ const useOnFetchEnd = (fetcher, handler) => {
24
24
  }, [fetcher]);
25
25
  };
26
26
  const Form = forwardRef(({ children, action, method, state = "initial", ...rest }, ref) => {
27
- const { setDataSourceValue } = useContext(ReactSdkContext);
27
+ const { setBoundDataSourceValue } = useContext(ReactSdkContext);
28
28
  const fetcher = useFetcher();
29
29
  const instanceId = getInstanceIdFromComponentProps(rest);
30
30
  useOnFetchEnd(fetcher, (data) => {
31
31
  const state2 = data?.success === true ? "success" : "error";
32
- setDataSourceValue(instanceId, "state", state2);
32
+ setBoundDataSourceValue(instanceId, "state", state2);
33
33
  });
34
34
  return /* @__PURE__ */ jsxs(fetcher.Form, { ...rest, method: "post", "data-state": state, ref, children: [
35
35
  /* @__PURE__ */ jsx("input", { type: "hidden", name: formIdFieldName, value: instanceId }),
package/lib/form.ws.js CHANGED
@@ -128,7 +128,7 @@ const meta = {
128
128
  };
129
129
  const propsMeta = {
130
130
  props,
131
- initialProps: ["state"]
131
+ initialProps: ["id", "state"]
132
132
  };
133
133
  export {
134
134
  meta,
package/lib/link.ws.js CHANGED
@@ -9,7 +9,7 @@ const propsMeta = {
9
9
  required: false
10
10
  }
11
11
  },
12
- initialProps: ["href", "target", "prefetch"]
12
+ initialProps: ["id", "href", "target", "prefetch"]
13
13
  };
14
14
  export {
15
15
  Link as meta,
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { type FormProps } from "@remix-run/react";
2
3
  export declare const defaultTag = "form";
3
4
  type State = "initial" | "success" | "error";
4
5
  export declare const Form: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLFormElement> & import("react").FormHTMLAttributes<HTMLFormElement> & {
5
6
  state?: State | undefined;
7
+ encType?: FormProps["encType"];
6
8
  }, "ref"> & import("react").RefAttributes<HTMLFormElement>>;
7
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk-components-react-remix",
3
- "version": "0.79.0",
3
+ "version": "0.81.0",
4
4
  "description": "Webstudio components for Remix",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -33,19 +33,19 @@
33
33
  }
34
34
  },
35
35
  "peerDependencies": {
36
- "@remix-run/react": "^1.15.0",
36
+ "@remix-run/react": "^1.18.0",
37
37
  "react": "^18.2.0",
38
38
  "react-dom": "^18.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@webstudio-is/form-handlers": "^0.79.0",
42
- "@webstudio-is/generate-arg-types": "^0.79.0",
43
- "@webstudio-is/icons": "^0.79.0",
44
- "@webstudio-is/react-sdk": "^0.79.0",
45
- "@webstudio-is/sdk-components-react": "^0.79.0"
41
+ "@webstudio-is/form-handlers": "^0.81.0",
42
+ "@webstudio-is/generate-arg-types": "^0.81.0",
43
+ "@webstudio-is/icons": "^0.81.0",
44
+ "@webstudio-is/react-sdk": "^0.81.0",
45
+ "@webstudio-is/sdk-components-react": "^0.81.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@remix-run/react": "^1.15.0",
48
+ "@remix-run/react": "^1.18.1",
49
49
  "@types/react": "^18.0.35",
50
50
  "@types/react-dom": "^18.0.11",
51
51
  "react": "^18.2.0",
@@ -368,7 +368,16 @@ export const props: Record<string, PropMeta> = {
368
368
  defaultChecked: { required: false, control: "boolean", type: "boolean" },
369
369
  dir: { required: false, control: "text", type: "string" },
370
370
  draggable: { required: false, control: "boolean", type: "boolean" },
371
- encType: { required: false, control: "text", type: "string" },
371
+ encType: {
372
+ required: false,
373
+ control: "radio",
374
+ type: "string",
375
+ options: [
376
+ "application/x-www-form-urlencoded",
377
+ "multipart/form-data",
378
+ "text/plain",
379
+ ],
380
+ },
372
381
  hidden: { required: false, control: "boolean", type: "boolean" },
373
382
  id: { required: false, control: "text", type: "string" },
374
383
  inputMode: {
package/src/form.tsx CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  useEffect,
7
7
  useContext,
8
8
  } from "react";
9
- import { useFetcher, type Fetcher } from "@remix-run/react";
9
+ import { useFetcher, type Fetcher, type FormProps } from "@remix-run/react";
10
10
  import { formIdFieldName } from "@webstudio-is/form-handlers";
11
11
  import {
12
12
  ReactSdkContext,
@@ -39,9 +39,12 @@ type State = "initial" | "success" | "error";
39
39
 
40
40
  export const Form = forwardRef<
41
41
  ElementRef<typeof defaultTag>,
42
- ComponentProps<typeof defaultTag> & { state?: State }
42
+ ComponentProps<typeof defaultTag> & {
43
+ state?: State;
44
+ encType?: FormProps["encType"];
45
+ }
43
46
  >(({ children, action, method, state = "initial", ...rest }, ref) => {
44
- const { setDataSourceValue } = useContext(ReactSdkContext);
47
+ const { setBoundDataSourceValue } = useContext(ReactSdkContext);
45
48
 
46
49
  const fetcher = useFetcher();
47
50
 
@@ -49,7 +52,7 @@ export const Form = forwardRef<
49
52
 
50
53
  useOnFetchEnd(fetcher, (data) => {
51
54
  const state: State = data?.success === true ? "success" : "error";
52
- setDataSourceValue(instanceId, "state", state);
55
+ setBoundDataSourceValue(instanceId, "state", state);
53
56
  });
54
57
 
55
58
  return (
package/src/form.ws.tsx CHANGED
@@ -137,5 +137,5 @@ export const meta: WsComponentMeta = {
137
137
 
138
138
  export const propsMeta: WsComponentPropsMeta = {
139
139
  props,
140
- initialProps: ["state"],
140
+ initialProps: ["id", "state"],
141
141
  };
package/src/link.ws.ts CHANGED
@@ -12,5 +12,5 @@ export const propsMeta: WsComponentPropsMeta = {
12
12
  required: false,
13
13
  },
14
14
  },
15
- initialProps: ["href", "target", "prefetch"],
15
+ initialProps: ["id", "href", "target", "prefetch"],
16
16
  };