react-better-html 1.1.46 → 1.1.47

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.
@@ -68,6 +68,7 @@ export declare function useForm<FormFields extends Record<string, string | numbe
68
68
  onSubmit: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
69
69
  reset: () => void;
70
70
  requiredFields: (keyof FormFields)[] | undefined;
71
+ isDirty: boolean;
71
72
  };
72
73
  export declare function useUrlQuery(): {
73
74
  setQuery: (query: Record<string, string>, keepHistory?: boolean) => void;
@@ -303,6 +303,7 @@ function useForm(options) {
303
303
  setValues(defaultValues);
304
304
  setErrors({});
305
305
  }, [defaultValues]);
306
+ const isDirty = (0, react_1.useMemo)(() => Object.keys(defaultValues).some((key) => defaultValues[key] !== values[key]), [defaultValues, values]);
306
307
  return {
307
308
  values,
308
309
  errors,
@@ -319,6 +320,7 @@ function useForm(options) {
319
320
  onSubmit: onSubmitFunction,
320
321
  reset,
321
322
  requiredFields,
323
+ isDirty,
322
324
  };
323
325
  }
324
326
  function useUrlQuery() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-better-html",
3
- "version": "1.1.46",
3
+ "version": "1.1.47",
4
4
  "description": "A component library for react that is as close to plane html as possible",
5
5
  "main": "dist/index.js",
6
6
  "files": [