Skip to content

Commit 31c8812

Browse files
migrate from deprecated API
1 parent 1665f3c commit 31c8812

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/data/material/components/autocomplete/CustomizedHook.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const InputWrapper = styled('div')(({ theme }) => ({
6464
},
6565
}));
6666

67-
function Tag(props) {
67+
function Item(props) {
6868
const { label, onDelete, ...other } = props;
6969
return (
7070
<div {...other}>
@@ -74,12 +74,12 @@ function Tag(props) {
7474
);
7575
}
7676

77-
Tag.propTypes = {
77+
Item.propTypes = {
7878
label: PropTypes.string.isRequired,
7979
onDelete: PropTypes.func.isRequired,
8080
};
8181

82-
const StyledTag = styled(Tag)(({ theme }) => ({
82+
const StyledItem = styled(Item)(({ theme }) => ({
8383
display: 'flex',
8484
alignItems: 'center',
8585
height: '24px',
@@ -168,7 +168,7 @@ function CustomAutocomplete(props) {
168168
getRootProps,
169169
getInputLabelProps,
170170
getInputProps,
171-
getTagProps,
171+
getItemProps,
172172
getListboxProps,
173173
getOptionProps,
174174
groupedOptions,
@@ -186,9 +186,9 @@ function CustomAutocomplete(props) {
186186
<Label {...getInputLabelProps()}>Customized hook</Label>
187187
<InputWrapper ref={setAnchorEl} className={focused ? 'focused' : ''}>
188188
{value.map((option, index) => {
189-
const { key, ...tagProps } = getTagProps({ index });
189+
const { key, ...tagProps } = getItemProps({ index });
190190
return (
191-
<StyledTag
191+
<StyledItem
192192
key={key}
193193
{...tagProps}
194194
label={props.getOptionLabel(option)}

docs/data/material/components/autocomplete/CustomizedHook.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import useAutocomplete, {
3-
AutocompleteGetTagProps,
3+
AutocompleteGetItemProps,
44
UseAutocompleteProps,
55
} from '@mui/material/useAutocomplete';
66
import CheckIcon from '@mui/icons-material/Check';
@@ -66,11 +66,11 @@ const InputWrapper = styled('div')(({ theme }) => ({
6666
},
6767
}));
6868

69-
interface TagProps extends ReturnType<AutocompleteGetTagProps> {
69+
interface ItemProps extends ReturnType<AutocompleteGetItemProps<false>> {
7070
label: string;
7171
}
7272

73-
function Tag(props: TagProps) {
73+
function Item(props: ItemProps) {
7474
const { label, onDelete, ...other } = props;
7575
return (
7676
<div {...other}>
@@ -80,7 +80,7 @@ function Tag(props: TagProps) {
8080
);
8181
}
8282

83-
const StyledTag = styled(Tag)<TagProps>(({ theme }) => ({
83+
const StyledItem = styled(Item)<ItemProps>(({ theme }) => ({
8484
display: 'flex',
8585
alignItems: 'center',
8686
height: '24px',
@@ -171,7 +171,7 @@ function CustomAutocomplete<Value = FilmOptionType>(
171171
getRootProps,
172172
getInputLabelProps,
173173
getInputProps,
174-
getTagProps,
174+
getItemProps,
175175
getListboxProps,
176176
getOptionProps,
177177
groupedOptions,
@@ -189,9 +189,9 @@ function CustomAutocomplete<Value = FilmOptionType>(
189189
<Label {...getInputLabelProps()}>Customized hook</Label>
190190
<InputWrapper ref={setAnchorEl} className={focused ? 'focused' : ''}>
191191
{value.map((option, index) => {
192-
const { key, ...tagProps } = getTagProps({ index });
192+
const { key, ...tagProps } = getItemProps({ index });
193193
return (
194-
<StyledTag
194+
<StyledItem
195195
key={key}
196196
{...tagProps}
197197
label={props.getOptionLabel!(option)}

0 commit comments

Comments
 (0)