Skip to content

Commit

Permalink
[Autocomplete] Update onChange API
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Mar 3, 2020
1 parent 7846617 commit b4bb5ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/pages/api/autocomplete.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| <span class="prop-name">loadingText</span> | <span class="prop-type">node</span> | <span class="prop-default">'Loading…'</span> | Text to display when in a loading state.<br>For localization purposes, you can use the provided [translations](/guides/localization/). |
| <span class="prop-name">multiple</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, `value` must be an array and the menu will support multiple selections. |
| <span class="prop-name">noOptionsText</span> | <span class="prop-type">node</span> | <span class="prop-default">'No options'</span> | Text to display when there are no options.<br>For localization purposes, you can use the provided [translations](/guides/localization/). |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value changes.<br><br>**Signature:**<br>`function(event: object, value: T) => void`<br>*event:* The event source of the callback.<br>*value:* null |
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value changes.<br><br>**Signature:**<br>`function(event: object, value: T, reason: string) => void`<br>*event:* The event source of the callback.<br>*value:* null<br>*reason:* One of "create-option", "select-option", "remove-option", "blur" or "clear". |
| <span class="prop-name">onClose</span> | <span class="prop-type">func</span> | | Callback fired when the popup requests to be closed. Use in controlled mode (see open).<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. |
| <span class="prop-name">onInputChange</span> | <span class="prop-type">func</span> | | Callback fired when the input value changes.<br><br>**Signature:**<br>`function(event: object, value: string, reason: string) => void`<br>*event:* The event source of the callback.<br>*value:* The new value of the text input.<br>*reason:* Can be: `"input"` (user input), `"reset"` (programmatic change), `"clear"`. |
| <span class="prop-name">onOpen</span> | <span class="prop-type">func</span> | | Callback fired when the popup requests to be opened. Use in controlled mode (see open).<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. |
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui-lab/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ Autocomplete.propTypes = {
*
* @param {object} event The event source of the callback.
* @param {T} value
* @param {string} reason One of "create-option", "select-option", "remove-option", "blur" or "clear".
*/
onChange: PropTypes.func,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export interface UseAutocompleteMultipleProps<T> extends UseAutocompleteCommonPr
*
* @param {object} event The event source of the callback.
* @param {T[]} value
* @param {string} reason One of "create-option", "select-option", "remove-option", "blur" or "clear".
*/
onChange?: (
event: React.ChangeEvent<{}>,
Expand Down Expand Up @@ -220,6 +221,7 @@ export interface UseAutocompleteSingleProps<T> extends UseAutocompleteCommonProp
*
* @param {object} event The event source of the callback.
* @param {T} value
* @param {string} reason One of "create-option", "select-option", "remove-option", "blur" or "clear".
*/
onChange?: (
event: React.ChangeEvent<{}>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ useAutocomplete.propTypes = {
*
* @param {object} event The event source of the callback
* @param {any} value
* @param {string} reason One of "create-option", "select-option", "remove-option", "blur" or "clear"
* @param {string} reason One of "create-option", "select-option", "remove-option", "blur" or "clear".
*/
onChange: PropTypes.func,
/**
Expand Down

0 comments on commit b4bb5ad

Please sign in to comment.