react-better-html 1.1.63 → 1.1.64

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.
@@ -76,6 +76,7 @@ export declare function useForm<FormFields extends Record<string | number, strin
76
76
  reset: () => void;
77
77
  requiredFields: (keyof FormFields)[] | undefined;
78
78
  isDirty: boolean;
79
+ isValid: boolean;
79
80
  };
80
81
  export declare function useUrlQuery(): {
81
82
  setQuery: (query: Record<string, string | number>, keepHistory?: boolean) => void;
@@ -379,6 +379,10 @@ function useForm(options) {
379
379
  setErrors({});
380
380
  }, [defaultValues]);
381
381
  const isDirty = (0, react_1.useMemo)(() => Object.keys(defaultValues).some((key) => defaultValues[key] !== values[key]), [defaultValues, values]);
382
+ const isValid = (0, react_1.useMemo)(() => {
383
+ const validationErrors = validate?.(values) || {};
384
+ return Object.keys(validationErrors).length === 0;
385
+ }, [validate, values]);
382
386
  return {
383
387
  values,
384
388
  errors,
@@ -396,6 +400,7 @@ function useForm(options) {
396
400
  reset,
397
401
  requiredFields,
398
402
  isDirty,
403
+ isValid,
399
404
  };
400
405
  }
401
406
  function useUrlQuery() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-better-html",
3
- "version": "1.1.63",
3
+ "version": "1.1.64",
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": [