pcm-shared-components 0.0.210 → 0.0.212

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.
@@ -24,9 +24,9 @@ let searchDebounce;
24
24
  export const SearchBar = props => {
25
25
  // Extract the passed down props
26
26
  const {
27
- onCancelSearch,
28
27
  onChange,
29
28
  onChangeDebounce,
29
+ onCancelSearch,
30
30
  placeholder,
31
31
  value,
32
32
  disabled,
@@ -40,15 +40,23 @@ export const SearchBar = props => {
40
40
 
41
41
  const componentTheme = createTheme(theme ? theme : useTheme());
42
42
  useEffect(() => {
43
- if (value !== localValue) {
44
- setLocalValue(value);
43
+ try {
44
+ if (value !== localValue) {
45
+ setLocalValue(value);
46
+ }
47
+ } catch (error) {
48
+ console.error(error);
45
49
  }
46
50
  }, [value]);
47
51
  useEffect(() => {
48
- clearTimeout(searchDebounce);
49
- searchDebounce = setTimeout(() => {
50
- onChangeDebounce(localValue);
51
- }, 700);
52
+ try {
53
+ clearTimeout(searchDebounce);
54
+ searchDebounce = setTimeout(() => {
55
+ onChangeDebounce(localValue);
56
+ }, 700);
57
+ } catch (error) {
58
+ console.error(error);
59
+ }
52
60
  }, [localValue]);
53
61
  return (
54
62
  /*#__PURE__*/
@@ -70,12 +78,20 @@ export const SearchBar = props => {
70
78
  disabled: disabled,
71
79
  value: localValue,
72
80
  onChange: event => {
73
- setLocalValue(event.target.value);
74
- onChange(event.target.value);
81
+ try {
82
+ setLocalValue(event.target.value);
83
+ onChange(event.target.value);
84
+ } catch (error) {
85
+ console.error(error);
86
+ }
75
87
  },
76
88
  onKeyDown: event => {
77
- //Needed when used in a menu to prevent the menu items from being filtered by the key down strokes or else we loose focus when use in this type of component
78
- event.stopPropagation();
89
+ try {
90
+ //Needed when used in a menu to prevent the menu items from being filtered by the key down strokes or else we loose focus when use in this type of component
91
+ event.stopPropagation();
92
+ } catch (error) {
93
+ console.error(error);
94
+ }
79
95
  }
80
96
  }), localValue.length === 0 ? /*#__PURE__*/React.createElement(IconButton, {
81
97
  sx: {
@@ -90,8 +106,12 @@ export const SearchBar = props => {
90
106
  "aria-label": "search",
91
107
  disabled: disabled,
92
108
  onClick: () => {
93
- setLocalValue("");
94
- onCancelSearch();
109
+ try {
110
+ setLocalValue("");
111
+ onCancelSearch();
112
+ } catch (error) {
113
+ console.error(error);
114
+ }
95
115
  }
96
116
  }, /*#__PURE__*/React.createElement(CloseIcon, null))))
97
117
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcm-shared-components",
3
- "version": "0.0.210",
3
+ "version": "0.0.212",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "babel": {