diff --git a/package.json b/package.json index 1eafaf171..3e51e5e50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@unicef/material-ui", - "version": "0.12.5", + "version": "0.12.6", "description": "UNICEF theme and components of material-ui for react", "main": "index.js", "files": [ diff --git a/src/components/USearchBox/USearchBox.js b/src/components/USearchBox/USearchBox.js index fbfbd4e66..07690e83c 100644 --- a/src/components/USearchBox/USearchBox.js +++ b/src/components/USearchBox/USearchBox.js @@ -42,6 +42,7 @@ export default function USearchBox({ className, showSeparator, iconLabel, + onChange, ...rest }) { const [searchValue, setSearch] = useState(value) @@ -52,7 +53,9 @@ export default function USearchBox({ }, [value]) const handleChange = event => { - setSearch(event.target.value) + const value = event.target.value + setSearch(value) + onChange && onChange(value) } const applySearch = val => { @@ -136,6 +139,8 @@ USearchBox.propTypes = { showSeparator: PropTypes.bool, /** Label next to the search icon */ iconLabel: PropTypes.string, + /** Callback function when change the search text */ + onchange: PropTypes.func, } USearchBox.defaultProps = {