@nethru/ui 2.1.24 → 2.1.26

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.
@@ -2,7 +2,7 @@ import { forwardRef, useMemo } from "react";
2
2
  import { IconButton, InputAdornment } from "@mui/material";
3
3
  import SearchIcon from "@mui/icons-material/Search";
4
4
  import ClearIcon from '@mui/icons-material/Clear';
5
- import { TextField } from "../lib";
5
+ import { TextField } from "./index";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const SearchTextField = /*#__PURE__*/forwardRef(({
8
8
  value,
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, useCallback, useMemo } from "react";
2
2
  import { Autocomplete, FormControl, FormHelperText, InputLabel } from "@mui/material";
3
- import { TextField } from "../lib";
3
+ import { TextField } from "./index";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const SearchableSelect = /*#__PURE__*/forwardRef(({
package/base/TextField.js CHANGED
@@ -17,9 +17,18 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
17
17
  setError(false);
18
18
  setHelperText('');
19
19
  }
20
+ if (props.formik) {
21
+ const {
22
+ setFieldError,
23
+ validateForm
24
+ } = props.formik;
25
+ validateForm().then(errors => {
26
+ if (isEmptyObject(errors)) setFieldError(props.name, helperText);
27
+ });
28
+ }
20
29
  }
21
30
  if (props.onChange) props.onChange(event);
22
- }, [props]);
31
+ }, [props, helperText]);
23
32
  return /*#__PURE__*/_jsx(MuiTextField, {
24
33
  ref: ref,
25
34
  ...props,
@@ -28,4 +37,7 @@ const TextField = /*#__PURE__*/forwardRef((props, ref) => {
28
37
  onChange: handleChange
29
38
  });
30
39
  });
31
- export default TextField;
40
+ export default TextField;
41
+ function isEmptyObject(obj) {
42
+ return obj && Object.keys(obj).length === 0;
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.1.24",
3
+ "version": "2.1.26",
4
4
  "main": "base/index.js",
5
5
  "files": [
6
6
  "/base"