@mittwald/flow-remote-react-renderer 1.1.0-next.1 → 1.1.0-next.2

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.
@@ -6,8 +6,10 @@ import { jsx } from "react/jsx-runtime";
6
6
  var Form = (props) => {
7
7
  const { action: onActionFromProps, onSubmit: onSubmitFromProps, ref, ...rest } = props;
8
8
  const onSubmit = async (event) => {
9
+ event.stopPropagation();
10
+ if (!onSubmitFromProps) return;
9
11
  event.preventDefault();
10
- await onSubmitFromProps?.(new FormData(event.currentTarget));
12
+ await onSubmitFromProps(new FormData(event.currentTarget));
11
13
  };
12
14
  const onAction = async (formData) => {
13
15
  await onActionFromProps?.(formData);
@@ -16,7 +18,7 @@ var Form = (props) => {
16
18
  ...rest,
17
19
  ref,
18
20
  action: onActionFromProps ? onAction : void 0,
19
- onSubmit: onSubmitFromProps ? onSubmit : void 0
21
+ onSubmit
20
22
  });
21
23
  };
22
24
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"Form.mjs","names":[],"sources":["../../../src/components/Form.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\n\ntype FormProps = {\n action?: (data: FormData) => void | Promise<void>;\n onSubmit?: (data: FormData) => void | Promise<void>;\n ref?: Ref<HTMLFormElement>;\n} & PropsWithChildren;\n\nexport const Form: FC<FormProps> = (props) => {\n const {\n action: onActionFromProps,\n onSubmit: onSubmitFromProps,\n ref,\n ...rest\n } = props;\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n await onSubmitFromProps?.(new FormData(event.currentTarget));\n };\n\n const onAction = async (formData: FormData) => {\n await onActionFromProps?.(formData);\n };\n\n return (\n <form\n {...rest}\n ref={ref}\n action={onActionFromProps ? onAction : undefined}\n onSubmit={onSubmitFromProps ? onSubmit : undefined}\n />\n );\n};\n"],"mappings":";;;;;AAaA,IAAa,QAAuB,UAAU;CAC5C,MAAM,EACJ,QAAQ,mBACR,UAAU,mBACV,KACA,GAAG,SACD;CAEJ,MAAM,WAAW,OAAO,UAAsC;EAC5D,MAAM,eAAe;EACrB,MAAM,oBAAoB,IAAI,SAAS,MAAM,aAAa,CAAC;CAC7D;CAEA,MAAM,WAAW,OAAO,aAAuB;EAC7C,MAAM,oBAAoB,QAAQ;CACpC;CAEA,OACE,oBAAC,QAAD;EACE,GAAI;EACC;EACL,QAAQ,oBAAoB,WAAW,KAAA;EACvC,UAAU,oBAAoB,WAAW,KAAA;CAC1C,CAAA;AAEL"}
1
+ {"version":3,"file":"Form.mjs","names":[],"sources":["../../../src/components/Form.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\n\ntype FormProps = {\n action?: (data: FormData) => void | Promise<void>;\n onSubmit?: (data: FormData) => void | Promise<void>;\n ref?: Ref<HTMLFormElement>;\n} & PropsWithChildren;\n\nexport const Form: FC<FormProps> = (props) => {\n const {\n action: onActionFromProps,\n onSubmit: onSubmitFromProps,\n ref,\n ...rest\n } = props;\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n /*\n * React events bubble through portals, so a submit inside a Modal would\n * reach the Form the Modal sits in and submit it too. An action-only form\n * needs that guard as well, so the handler always runs.\n */\n event.stopPropagation();\n\n if (!onSubmitFromProps) {\n return;\n }\n event.preventDefault();\n await onSubmitFromProps(new FormData(event.currentTarget));\n };\n\n const onAction = async (formData: FormData) => {\n await onActionFromProps?.(formData);\n };\n\n return (\n <form\n {...rest}\n ref={ref}\n action={onActionFromProps ? onAction : undefined}\n onSubmit={onSubmit}\n />\n );\n};\n"],"mappings":";;;;;AAaA,IAAa,QAAuB,UAAU;CAC5C,MAAM,EACJ,QAAQ,mBACR,UAAU,mBACV,KACA,GAAG,SACD;CAEJ,MAAM,WAAW,OAAO,UAAsC;EAM5D,MAAM,gBAAgB;EAEtB,IAAI,CAAC,mBACH;EAEF,MAAM,eAAe;EACrB,MAAM,kBAAkB,IAAI,SAAS,MAAM,aAAa,CAAC;CAC3D;CAEA,MAAM,WAAW,OAAO,aAAuB;EAC7C,MAAM,oBAAoB,QAAQ;CACpC;CAEA,OACE,oBAAC,QAAD;EACE,GAAI;EACC;EACL,QAAQ,oBAAoB,WAAW,KAAA;EAC7B;CACX,CAAA;AAEL"}
@@ -12,6 +12,7 @@ var Form = (props) => {
12
12
  const { onSubmit: onSubmitFromProps, ref, ...rest } = props;
13
13
  const onSubmit = async (event) => {
14
14
  event.preventDefault();
15
+ event.stopPropagation();
15
16
  await onSubmitFromProps?.();
16
17
  };
17
18
  return /* @__PURE__ */ jsx("form", {
@@ -1 +1 @@
1
- {"version":3,"file":"Form.mjs","names":[],"sources":["../../../../src/integrations/react-hook-form/Form.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\n\ntype FormProps = {\n onSubmit?: () => void | Promise<void>;\n ref?: Ref<HTMLFormElement>;\n} & PropsWithChildren;\n\n/**\n * ReactHookForm won't send the data over onSubmit, the form state is\n * transferred over onChange. To avoid sending unnecessary data, this RemoteForm\n * sends only the onSubmit without any formData.\n */\nexport const Form: FC<FormProps> = (props) => {\n const { onSubmit: onSubmitFromProps, ref, ...rest } = props;\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n await onSubmitFromProps?.();\n };\n\n return <form {...rest} ref={ref} onSubmit={onSubmit} />;\n};\n"],"mappings":";;;;;;;;;;AAiBA,IAAa,QAAuB,UAAU;CAC5C,MAAM,EAAE,UAAU,mBAAmB,KAAK,GAAG,SAAS;CAEtD,MAAM,WAAW,OAAO,UAAsC;EAC5D,MAAM,eAAe;EACrB,MAAM,oBAAoB;CAC5B;CAEA,OAAO,oBAAC,QAAD;EAAM,GAAI;EAAW;EAAe;CAAW,CAAA;AACxD"}
1
+ {"version":3,"file":"Form.mjs","names":[],"sources":["../../../../src/integrations/react-hook-form/Form.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type Ref,\n} from \"react\";\n\ntype FormProps = {\n onSubmit?: () => void | Promise<void>;\n ref?: Ref<HTMLFormElement>;\n} & PropsWithChildren;\n\n/**\n * ReactHookForm won't send the data over onSubmit, the form state is\n * transferred over onChange. To avoid sending unnecessary data, this RemoteForm\n * sends only the onSubmit without any formData.\n */\nexport const Form: FC<FormProps> = (props) => {\n const { onSubmit: onSubmitFromProps, ref, ...rest } = props;\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n /*\n * React events bubble through portals, so a submit inside a Modal would\n * reach the Form the Modal sits in and submit it too. The remote Form\n * cannot stop that itself — its submit has no nativeEvent.\n */\n event.stopPropagation();\n await onSubmitFromProps?.();\n };\n\n return <form {...rest} ref={ref} onSubmit={onSubmit} />;\n};\n"],"mappings":";;;;;;;;;;AAiBA,IAAa,QAAuB,UAAU;CAC5C,MAAM,EAAE,UAAU,mBAAmB,KAAK,GAAG,SAAS;CAEtD,MAAM,WAAW,OAAO,UAAsC;EAC5D,MAAM,eAAe;EAMrB,MAAM,gBAAgB;EACtB,MAAM,oBAAoB;CAC5B;CAEA,OAAO,oBAAC,QAAD;EAAM,GAAI;EAAW;EAAe;CAAW,CAAA;AACxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAEf,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,GAAG,iBAAiB,CAAC;AAEtB,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAyB9B,CAAC"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAEf,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,GAAG,iBAAiB,CAAC;AAEtB,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAmC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../src/integrations/react-hook-form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAEf,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,GAAG,iBAAiB,CAAC;AAEtB;;;;GAIG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAS9B,CAAC"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../src/integrations/react-hook-form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACtB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAEf,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,GAAG,iBAAiB,CAAC;AAEtB;;;;GAIG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAe9B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-remote-react-renderer",
3
- "version": "1.1.0-next.1",
3
+ "version": "1.1.0-next.2",
4
4
  "type": "module",
5
5
  "description": "React rendering for Flow Remote Elements",
6
6
  "homepage": "https://flow.mittwald.de",
@@ -28,9 +28,9 @@
28
28
  "test:unit": "vitest run --passWithNoTests"
29
29
  },
30
30
  "dependencies": {
31
- "@mittwald/ext-bridge": "1.1.0-next.1",
32
- "@mittwald/flow-remote-core": "1.1.0-next.1",
33
- "@mittwald/flow-remote-elements": "1.1.0-next.1",
31
+ "@mittwald/ext-bridge": "1.1.0-next.2",
32
+ "@mittwald/flow-remote-core": "1.1.0-next.2",
33
+ "@mittwald/flow-remote-elements": "1.1.0-next.2",
34
34
  "@mittwald/react-use-promise": "^4.2.2",
35
35
  "@mittwald/remote-dom-react": "1.2.2-mittwald.10",
36
36
  "@types/react": "^19.2",
@@ -39,9 +39,9 @@
39
39
  "remeda": "^2.43.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@mittwald/flow-core": "1.1.0-next.1",
43
- "@mittwald/flow-react-components": "1.1.0-next.1",
44
- "@mittwald/typescript-config": "1.1.0-next.1",
42
+ "@mittwald/flow-core": "1.1.0-next.2",
43
+ "@mittwald/flow-react-components": "1.1.0-next.2",
44
+ "@mittwald/typescript-config": "1.1.0-next.2",
45
45
  "@types/node": "^25.9.3",
46
46
  "nx": "^22.7.5",
47
47
  "react": "^19.2.8",
@@ -56,7 +56,7 @@
56
56
  "vitest": "^4.1.11"
57
57
  },
58
58
  "peerDependencies": {
59
- "@mittwald/flow-react-components": "1.1.0-next.1",
59
+ "@mittwald/flow-react-components": "1.1.0-next.2",
60
60
  "react": "^19.2.0",
61
61
  "react-dom": "^19.2.0",
62
62
  "react-hook-form": "^7.65.0"
@@ -66,5 +66,5 @@
66
66
  "optional": true
67
67
  }
68
68
  },
69
- "gitHead": "3d1fcf6eb22e5098804ffadf7537a8005be1c3fc"
69
+ "gitHead": "3db3c67c1b022dd0d53dea4a202086b821e72acf"
70
70
  }