hrm_ui_lib 2.0.0-alpha.22 → 2.0.0-alpha.24

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.
@@ -1,5 +1,5 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
3
  import { useForm } from 'react-hook-form';
4
4
  import { yupResolver } from '@hookform/resolvers/yup';
5
5
  import classNames from 'classnames';
@@ -68,6 +68,7 @@ var FormContainer = function FormContainer(props) {
68
68
  validationScheme = props.validationScheme,
69
69
  buttonConfigs = props.buttonConfigs,
70
70
  formId = props.formId,
71
+ language = props.language,
71
72
  onSubmit = props.onSubmit;
72
73
  var _useForm = useForm({
73
74
  mode: mode,
@@ -99,6 +100,14 @@ var FormContainer = function FormContainer(props) {
99
100
  onSubmit(data, formState, dirtyFields);
100
101
  }
101
102
  };
103
+ useEffect(function () {
104
+ if (formState.isSubmitted) {
105
+ var fieldsWithErrors = Object.keys(formState.errors);
106
+ if (fieldsWithErrors.length > 0) {
107
+ trigger(fieldsWithErrors); // only revalidate fields that have errors
108
+ }
109
+ }
110
+ }, [language]);
102
111
  return /*#__PURE__*/React.createElement("form", {
103
112
  onSubmit: handleSubmit(customSubmit),
104
113
  id: formId,
@@ -18,4 +18,5 @@ export interface FormPropTypes {
18
18
  mode?: keyof ValidationMode;
19
19
  reValidateMode?: 'onChange' | 'onSubmit' | 'onBlur' | undefined;
20
20
  formId?: string;
21
+ language?: string;
21
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "2.0.0-alpha.22",
3
+ "version": "2.0.0-alpha.24",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",