Skip to content

Commit

Permalink
[Autocomplete][base-ui] Added ref to getInputProps return value (#38919)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarhkVoyd authored Sep 14, 2023
1 parent b59570b commit 1f7f2b2
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
>
<StyledInput
id={id}
ref={setAnchorEl}
disabled={disabled}
readOnly={readOnly}
{...getInputProps()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(
>
<StyledInput
id={id}
ref={setAnchorEl}
disabled={disabled}
readOnly={readOnly}
{...getInputProps()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
>
<input
id={id}
ref={setAnchorEl}
disabled={disabled}
readOnly={readOnly}
{...getInputProps()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const Autocomplete = React.forwardRef(function Autocomplete(
>
<input
id={id}
ref={setAnchorEl}
disabled={disabled}
readOnly={readOnly}
{...getInputProps()}
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/base-ui/api/use-autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@
},
"getInputProps": {
"type": {
"name": "() =&gt; React.InputHTMLAttributes&lt;HTMLInputElement&gt;",
"description": "() =&gt; React.InputHTMLAttributes&lt;HTMLInputElement&gt;"
"name": "() =&gt; React.InputHTMLAttributes&lt;HTMLInputElement&gt; &amp; {\n ref: React.Ref&lt;HTMLInputElement&gt;\n}",
"description": "() =&gt; React.InputHTMLAttributes&lt;HTMLInputElement&gt; &amp; {\n ref: React.Ref&lt;HTMLInputElement&gt;\n}"
},
"required": true
},
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ export interface UseAutocompleteReturnValue<
* Resolver for the input element's props.
* @returns props that should be spread on the input element
*/
getInputProps: () => React.InputHTMLAttributes<HTMLInputElement>;
getInputProps: () => React.InputHTMLAttributes<HTMLInputElement> & {
ref: React.Ref<HTMLInputElement>;
};
/**
* Resolver for the input label element's props.
* @returns props that should be spread on the input label element
Expand Down

0 comments on commit 1f7f2b2

Please sign in to comment.