pcm-shared-components 0.0.209 → 0.0.211
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.
|
@@ -40,15 +40,23 @@ export const SearchBar = props => {
|
|
|
40
40
|
|
|
41
41
|
const componentTheme = createTheme(theme ? theme : useTheme());
|
|
42
42
|
useEffect(() => {
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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__*/
|
|
@@ -112,13 +120,13 @@ SearchBar.defaultProps = {
|
|
|
112
120
|
|
|
113
121
|
SearchBar.propTypes = {
|
|
114
122
|
/** Fired when the search is cancelled. */
|
|
115
|
-
onCancelSearch: PropTypes.
|
|
123
|
+
onCancelSearch: PropTypes.func,
|
|
116
124
|
|
|
117
125
|
/** Fired when the text value changes. Returns the new value */
|
|
118
|
-
onChange: PropTypes.
|
|
126
|
+
onChange: PropTypes.func,
|
|
119
127
|
|
|
120
128
|
/** Same as onChange except only fires 700ms after the users has completed typing to prevent performance issues. Returns the new value */
|
|
121
|
-
onChangeDebounce: PropTypes.
|
|
129
|
+
onChangeDebounce: PropTypes.func,
|
|
122
130
|
|
|
123
131
|
/** Sets placeholder text for the embedded text field. */
|
|
124
132
|
placeholder: PropTypes.string,
|