Skip to content

Commit

Permalink
USearchBox onChange prop added
Browse files Browse the repository at this point in the history
  • Loading branch information
vinu.ganesan committed Jul 3, 2024
1 parent e27a60a commit d6e95ad
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 d6e95ad

Please sign in to comment.