Skip to content

Commit

Permalink
Merge pull request #163 from unicef/feature/searchbox-add-onchange
Browse files Browse the repository at this point in the history
USearchBox onChange prop added
  • Loading branch information
vinuganesan authored Jul 3, 2024
2 parents e27a60a + d6e95ad commit 3c63521
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
7 changes: 6 additions & 1 deletion src/components/USearchBox/USearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function USearchBox({
className,
showSeparator,
iconLabel,
onChange,
...rest
}) {
const [searchValue, setSearch] = useState(value)
Expand All @@ -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 => {
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 3c63521

Please sign in to comment.