From 4d6210e0a9bbfdedc88f3c6a9de40f69daada7c5 Mon Sep 17 00:00:00 2001 From: "J. Lewis" <6710419+lewxdev@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:54:19 -0500 Subject: [PATCH 1/9] feat: working poc with overloads --- .../src/useAutocomplete/useAutocomplete.d.ts | 30 +++++++++++++++++-- .../useAutocomplete/useAutocomplete.spec.ts | 19 +++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts index 8c0e920568c892..7aabb3dbf64317 100644 --- a/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts @@ -353,6 +353,27 @@ export type AutocompleteGetTagProps = ({ index }: { index: number }) => { * * - [useAutocomplete API](https://mui.com/base-ui/react-autocomplete/hooks-api/#use-autocomplete) */ + +export function useAutocomplete< + Value, + Multiple extends boolean | undefined = false, + DisableClearable extends boolean | undefined = false, + FreeSolo extends boolean | undefined = false, +>( + props: UseAutocompleteProps & { + groupBy: (option: Value) => string; + }, +): UseAutocompleteReturnValue +export function useAutocomplete< + Value, + Multiple extends boolean | undefined = false, + DisableClearable extends boolean | undefined = false, + FreeSolo extends boolean | undefined = false, +>( + props: UseAutocompleteProps & { + groupBy?: undefined; + }, +): UseAutocompleteReturnValue export function useAutocomplete< Value, Multiple extends boolean | undefined = false, @@ -360,7 +381,7 @@ export function useAutocomplete< FreeSolo extends boolean | undefined = false, >( props: UseAutocompleteProps, -): UseAutocompleteReturnValue; +): UseAutocompleteReturnValue; export interface UseAutocompleteRenderedOption { option: Value; @@ -372,6 +393,7 @@ export interface UseAutocompleteReturnValue< Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, + HasGroupBy extends boolean | unknown = false, > { /** * Resolver for the root slot's props. @@ -462,5 +484,9 @@ export interface UseAutocompleteReturnValue< /** * The options to render. It's either `Value[]` or `AutocompleteGroupedOption[]` if the groupBy prop is provided. */ - groupedOptions: Value[] | Array>; + groupedOptions: HasGroupBy extends true + ? AutocompleteGroupedOption[] + : HasGroupBy extends false + ? Value[] + : Value[] | AutocompleteGroupedOption[]; } diff --git a/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts b/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts index e7712ffdb1e4fe..4d2ec6cf787bd8 100644 --- a/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts +++ b/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts @@ -1,5 +1,9 @@ import { expectType } from '@mui/types'; -import { useAutocomplete, FilterOptionsState } from '@mui/base/useAutocomplete'; +import { + useAutocomplete, + FilterOptionsState, + AutocompleteGroupedOption, +} from '@mui/base/useAutocomplete'; interface Person { id: string; @@ -181,4 +185,17 @@ function Component() { }, freeSolo: true, }); + + const ungroupedAutocomplete = useAutocomplete({ options: persons }); + expectType( + ungroupedAutocomplete.groupedOptions, + ); + + const groupedAutocomplete = useAutocomplete({ + options: persons, + groupBy: ({ id }) => id, + }); + expectType[], typeof groupedAutocomplete.groupedOptions>( + groupedAutocomplete.groupedOptions, + ); } From 9efac0e355213e898bbb0a212cbfeb75a8bd944c Mon Sep 17 00:00:00 2001 From: "J. Lewis" <6710419+lewxdev@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:34:28 -0500 Subject: [PATCH 2/9] fix: move changes to maintained directory (per comment) --- .../src/useAutocomplete/useAutocomplete.d.ts | 30 ++----------------- .../useAutocomplete/useAutocomplete.spec.ts | 19 +----------- .../src/useAutocomplete/useAutocomplete.d.ts | 29 ++++++++++++++++-- .../useAutocomplete/useAutocomplete.spec.ts | 19 +++++++++++- 4 files changed, 48 insertions(+), 49 deletions(-) diff --git a/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts index 7aabb3dbf64317..8c0e920568c892 100644 --- a/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts @@ -353,27 +353,6 @@ export type AutocompleteGetTagProps = ({ index }: { index: number }) => { * * - [useAutocomplete API](https://mui.com/base-ui/react-autocomplete/hooks-api/#use-autocomplete) */ - -export function useAutocomplete< - Value, - Multiple extends boolean | undefined = false, - DisableClearable extends boolean | undefined = false, - FreeSolo extends boolean | undefined = false, ->( - props: UseAutocompleteProps & { - groupBy: (option: Value) => string; - }, -): UseAutocompleteReturnValue -export function useAutocomplete< - Value, - Multiple extends boolean | undefined = false, - DisableClearable extends boolean | undefined = false, - FreeSolo extends boolean | undefined = false, ->( - props: UseAutocompleteProps & { - groupBy?: undefined; - }, -): UseAutocompleteReturnValue export function useAutocomplete< Value, Multiple extends boolean | undefined = false, @@ -381,7 +360,7 @@ export function useAutocomplete< FreeSolo extends boolean | undefined = false, >( props: UseAutocompleteProps, -): UseAutocompleteReturnValue; +): UseAutocompleteReturnValue; export interface UseAutocompleteRenderedOption { option: Value; @@ -393,7 +372,6 @@ export interface UseAutocompleteReturnValue< Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, - HasGroupBy extends boolean | unknown = false, > { /** * Resolver for the root slot's props. @@ -484,9 +462,5 @@ export interface UseAutocompleteReturnValue< /** * The options to render. It's either `Value[]` or `AutocompleteGroupedOption[]` if the groupBy prop is provided. */ - groupedOptions: HasGroupBy extends true - ? AutocompleteGroupedOption[] - : HasGroupBy extends false - ? Value[] - : Value[] | AutocompleteGroupedOption[]; + groupedOptions: Value[] | Array>; } diff --git a/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts b/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts index 4d2ec6cf787bd8..e7712ffdb1e4fe 100644 --- a/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts +++ b/packages/mui-base/src/useAutocomplete/useAutocomplete.spec.ts @@ -1,9 +1,5 @@ import { expectType } from '@mui/types'; -import { - useAutocomplete, - FilterOptionsState, - AutocompleteGroupedOption, -} from '@mui/base/useAutocomplete'; +import { useAutocomplete, FilterOptionsState } from '@mui/base/useAutocomplete'; interface Person { id: string; @@ -185,17 +181,4 @@ function Component() { }, freeSolo: true, }); - - const ungroupedAutocomplete = useAutocomplete({ options: persons }); - expectType( - ungroupedAutocomplete.groupedOptions, - ); - - const groupedAutocomplete = useAutocomplete({ - options: persons, - groupBy: ({ id }) => id, - }); - expectType[], typeof groupedAutocomplete.groupedOptions>( - groupedAutocomplete.groupedOptions, - ); } diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts index b74e6646430106..b0f5b46c718ec4 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts @@ -353,6 +353,26 @@ export type AutocompleteGetTagProps = ({ index }: { index: number }) => { * * - [useAutocomplete API](https://mui.com/base-ui/react-autocomplete/hooks-api/#use-autocomplete) */ +export function useAutocomplete< + Value, + Multiple extends boolean | undefined = false, + DisableClearable extends boolean | undefined = false, + FreeSolo extends boolean | undefined = false, +>( + props: UseAutocompleteProps & { + groupBy: (option: Value) => string; + }, +): UseAutocompleteReturnValue +export function useAutocomplete< + Value, + Multiple extends boolean | undefined = false, + DisableClearable extends boolean | undefined = false, + FreeSolo extends boolean | undefined = false, +>( + props: UseAutocompleteProps & { + groupBy?: undefined; + }, +): UseAutocompleteReturnValue export function useAutocomplete< Value, Multiple extends boolean | undefined = false, @@ -360,7 +380,7 @@ export function useAutocomplete< FreeSolo extends boolean | undefined = false, >( props: UseAutocompleteProps, -): UseAutocompleteReturnValue; +): UseAutocompleteReturnValue; export interface UseAutocompleteRenderedOption { option: Value; @@ -372,6 +392,7 @@ export interface UseAutocompleteReturnValue< Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, + HasGroupBy extends boolean | unknown = false, > { /** * Resolver for the root slot's props. @@ -462,7 +483,11 @@ export interface UseAutocompleteReturnValue< /** * The options to render. It's either `Value[]` or `AutocompleteGroupedOption[]` if the groupBy prop is provided. */ - groupedOptions: Value[] | Array>; + groupedOptions: HasGroupBy extends true + ? AutocompleteGroupedOption[] + : HasGroupBy extends false + ? Value[] + : Value[] | AutocompleteGroupedOption[]; } export default useAutocomplete; diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.spec.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.spec.ts index 2d65f0f4d5a9e6..096fd4328bcabc 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.spec.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.spec.ts @@ -1,5 +1,9 @@ import { expectType } from '@mui/types'; -import { useAutocomplete, FilterOptionsState } from '@mui/material/useAutocomplete'; +import { + useAutocomplete, + FilterOptionsState, + AutocompleteGroupedOption, +} from '@mui/material/useAutocomplete'; interface Person { id: string; @@ -181,4 +185,17 @@ function Component() { }, freeSolo: true, }); + + const ungroupedAutocomplete = useAutocomplete({ options: persons }); + expectType( + ungroupedAutocomplete.groupedOptions, + ); + + const groupedAutocomplete = useAutocomplete({ + options: persons, + groupBy: ({ id }) => id, + }); + expectType[], typeof groupedAutocomplete.groupedOptions>( + groupedAutocomplete.groupedOptions, + ); } From f6267b8aa3c8c0fa429b782755b82e158cca71c5 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Wed, 11 Dec 2024 17:33:00 +0530 Subject: [PATCH 3/9] prettier --- .../mui-material/src/useAutocomplete/useAutocomplete.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts index b0f5b46c718ec4..daf8bfe906b366 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts @@ -362,7 +362,7 @@ export function useAutocomplete< props: UseAutocompleteProps & { groupBy: (option: Value) => string; }, -): UseAutocompleteReturnValue +): UseAutocompleteReturnValue; export function useAutocomplete< Value, Multiple extends boolean | undefined = false, @@ -372,7 +372,7 @@ export function useAutocomplete< props: UseAutocompleteProps & { groupBy?: undefined; }, -): UseAutocompleteReturnValue +): UseAutocompleteReturnValue; export function useAutocomplete< Value, Multiple extends boolean | undefined = false, From 225ccc4904aa3775390e6b736cdaf9ecc8555976 Mon Sep 17 00:00:00 2001 From: "J. Lewis" <6710419+lewxdev@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:29:40 -0500 Subject: [PATCH 4/9] fix: make proposed changes (cc: @ZeeshanTamboli) --- .../src/useAutocomplete/useAutocomplete.d.ts | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts index daf8bfe906b366..4b15094b45be21 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts @@ -178,7 +178,7 @@ export interface UseAutocompleteProps< * If provided, the options will be grouped under the returned string. * The groupBy value is also used as the text for group headings when `renderGroup` is not provided. * - * @param {Value} options The options to group. + * @param {Value} option The option to group. * @returns {string} */ groupBy?: (option: Value) => string; @@ -373,14 +373,6 @@ export function useAutocomplete< groupBy?: undefined; }, ): UseAutocompleteReturnValue; -export function useAutocomplete< - Value, - Multiple extends boolean | undefined = false, - DisableClearable extends boolean | undefined = false, - FreeSolo extends boolean | undefined = false, ->( - props: UseAutocompleteProps, -): UseAutocompleteReturnValue; export interface UseAutocompleteRenderedOption { option: Value; @@ -392,7 +384,7 @@ export interface UseAutocompleteReturnValue< Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, - HasGroupBy extends boolean | unknown = false, + HasGroupBy extends boolean = false, > { /** * Resolver for the root slot's props. @@ -481,13 +473,13 @@ export interface UseAutocompleteReturnValue< */ focusedTag: number; /** - * The options to render. It's either `Value[]` or `AutocompleteGroupedOption[]` if the groupBy prop is provided. + * The options to render. + * - If `groupBy` is provided, the options are grouped and represented as `AutocompleteGroupedOption[]`. + * - Otherwise, the options are represented as a flat array of `Value[]`. */ groupedOptions: HasGroupBy extends true ? AutocompleteGroupedOption[] - : HasGroupBy extends false - ? Value[] - : Value[] | AutocompleteGroupedOption[]; + : Value[]; } export default useAutocomplete; From f4bc9a0a3a78dd624300ac799b66c05814706f65 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Mon, 16 Dec 2024 11:43:27 +0530 Subject: [PATCH 5/9] pnpm prettier --- .../mui-material/src/useAutocomplete/useAutocomplete.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts index 4b15094b45be21..c478afbafad81e 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts @@ -477,9 +477,7 @@ export interface UseAutocompleteReturnValue< * - If `groupBy` is provided, the options are grouped and represented as `AutocompleteGroupedOption[]`. * - Otherwise, the options are represented as a flat array of `Value[]`. */ - groupedOptions: HasGroupBy extends true - ? AutocompleteGroupedOption[] - : Value[]; + groupedOptions: HasGroupBy extends true ? AutocompleteGroupedOption[] : Value[]; } export default useAutocomplete; From ee9a1e62baafac6161f18ae4043e726f2fba70c0 Mon Sep 17 00:00:00 2001 From: "J. Lewis" <6710419+lewxdev@users.noreply.github.com> Date: Tue, 17 Dec 2024 06:48:58 -0500 Subject: [PATCH 6/9] fix: make proposed changes (cc: @ZeeshanTamboli) --- .../src/useAutocomplete/useAutocomplete.d.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts index 4b15094b45be21..2b19fd8c31f2d0 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts @@ -1,4 +1,5 @@ import * as React from 'react'; +import { PartiallyRequired } from '@mui/types'; export interface CreateFilterOptionsConfig { ignoreAccents?: boolean; @@ -359,9 +360,10 @@ export function useAutocomplete< DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, >( - props: UseAutocompleteProps & { - groupBy: (option: Value) => string; - }, + props: PartiallyRequired< + UseAutocompleteProps, + 'groupBy' + >, ): UseAutocompleteReturnValue; export function useAutocomplete< Value, @@ -369,9 +371,7 @@ export function useAutocomplete< DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, >( - props: UseAutocompleteProps & { - groupBy?: undefined; - }, + props: Omit, 'groupBy'>, ): UseAutocompleteReturnValue; export interface UseAutocompleteRenderedOption { @@ -477,9 +477,7 @@ export interface UseAutocompleteReturnValue< * - If `groupBy` is provided, the options are grouped and represented as `AutocompleteGroupedOption[]`. * - Otherwise, the options are represented as a flat array of `Value[]`. */ - groupedOptions: HasGroupBy extends true - ? AutocompleteGroupedOption[] - : Value[]; + groupedOptions: HasGroupBy extends true ? AutocompleteGroupedOption[] : Value[]; } export default useAutocomplete; From 69b1508aa616f1d7150e52ae2c0cddf986709dd0 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Wed, 18 Dec 2024 13:05:57 +0530 Subject: [PATCH 7/9] update proptypes and API docs --- docs/pages/material-ui/api/autocomplete.json | 2 +- docs/translations/api-docs/autocomplete/autocomplete.json | 2 +- packages/mui-material/src/Autocomplete/Autocomplete.js | 2 +- packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/pages/material-ui/api/autocomplete.json b/docs/pages/material-ui/api/autocomplete.json index b61f4c3c93fdaa..42eade3f023ede 100644 --- a/docs/pages/material-ui/api/autocomplete.json +++ b/docs/pages/material-ui/api/autocomplete.json @@ -83,7 +83,7 @@ }, "groupBy": { "type": { "name": "func" }, - "signature": { "type": "function(options: Value) => string", "describedArgs": ["options"] } + "signature": { "type": "function(option: Value) => string", "describedArgs": ["option"] } }, "handleHomeEndKeys": { "type": { "name": "bool" }, "default": "!props.freeSolo" }, "id": { "type": { "name": "string" } }, diff --git a/docs/translations/api-docs/autocomplete/autocomplete.json b/docs/translations/api-docs/autocomplete/autocomplete.json index c0c042dd0da31b..2655bbc7d39a99 100644 --- a/docs/translations/api-docs/autocomplete/autocomplete.json +++ b/docs/translations/api-docs/autocomplete/autocomplete.json @@ -82,7 +82,7 @@ }, "groupBy": { "description": "If provided, the options will be grouped under the returned string. The groupBy value is also used as the text for group headings when renderGroup is not provided.", - "typeDescriptions": { "options": "The options to group." } + "typeDescriptions": { "option": "The Autocomplete option." } }, "handleHomeEndKeys": { "description": "If true, the component handles the "Home" and "End" keys when the popup is open. It should move focus to the first option and last option, respectively." diff --git a/packages/mui-material/src/Autocomplete/Autocomplete.js b/packages/mui-material/src/Autocomplete/Autocomplete.js index 4cbff62de4ac46..d144af535c10c2 100644 --- a/packages/mui-material/src/Autocomplete/Autocomplete.js +++ b/packages/mui-material/src/Autocomplete/Autocomplete.js @@ -994,7 +994,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * If provided, the options will be grouped under the returned string. * The groupBy value is also used as the text for group headings when `renderGroup` is not provided. * - * @param {Value} options The options to group. + * @param {Value} option The Autocomplete option. * @returns {string} */ groupBy: PropTypes.func, diff --git a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts index 2b19fd8c31f2d0..850bb0f82078a8 100644 --- a/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts +++ b/packages/mui-material/src/useAutocomplete/useAutocomplete.d.ts @@ -179,7 +179,7 @@ export interface UseAutocompleteProps< * If provided, the options will be grouped under the returned string. * The groupBy value is also used as the text for group headings when `renderGroup` is not provided. * - * @param {Value} option The option to group. + * @param {Value} option The Autocomplete option. * @returns {string} */ groupBy?: (option: Value) => string; From 312c2deb9bf0136a42d29b7c91b7494272f38a67 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Wed, 18 Dec 2024 14:29:35 +0530 Subject: [PATCH 8/9] improve demos by removing assertions and import hook from Material UI --- .../material/components/autocomplete/CustomizedHook.js | 2 +- .../material/components/autocomplete/CustomizedHook.tsx | 7 +++++-- .../material/components/autocomplete/UseAutocomplete.js | 2 +- .../material/components/autocomplete/UseAutocomplete.tsx | 4 ++-- .../components/autocomplete/UseAutocomplete.tsx.preview | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/data/material/components/autocomplete/CustomizedHook.js b/docs/data/material/components/autocomplete/CustomizedHook.js index 0a2b7281e5f2c6..1dedc30e6bf2f6 100644 --- a/docs/data/material/components/autocomplete/CustomizedHook.js +++ b/docs/data/material/components/autocomplete/CustomizedHook.js @@ -1,6 +1,6 @@ import * as React from 'react'; import PropTypes from 'prop-types'; -import { useAutocomplete } from '@mui/base/useAutocomplete'; +import { useAutocomplete } from '@mui/material/useAutocomplete'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import { styled } from '@mui/material/styles'; diff --git a/docs/data/material/components/autocomplete/CustomizedHook.tsx b/docs/data/material/components/autocomplete/CustomizedHook.tsx index 8def3c10cff7e3..d6eecca8d35712 100644 --- a/docs/data/material/components/autocomplete/CustomizedHook.tsx +++ b/docs/data/material/components/autocomplete/CustomizedHook.tsx @@ -1,5 +1,8 @@ import * as React from 'react'; -import { useAutocomplete, AutocompleteGetTagProps } from '@mui/base/useAutocomplete'; +import { + useAutocomplete, + AutocompleteGetTagProps, +} from '@mui/material/useAutocomplete'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import { styled } from '@mui/material/styles'; @@ -188,7 +191,7 @@ export default function CustomizedHook() { {groupedOptions.length > 0 ? ( - {(groupedOptions as typeof top100Films).map((option, index) => { + {groupedOptions.map((option, index) => { const { key, ...optionProps } = getOptionProps({ option, index }); return (
  • diff --git a/docs/data/material/components/autocomplete/UseAutocomplete.js b/docs/data/material/components/autocomplete/UseAutocomplete.js index 8ea6bf3811d61e..f715826d23386a 100644 --- a/docs/data/material/components/autocomplete/UseAutocomplete.js +++ b/docs/data/material/components/autocomplete/UseAutocomplete.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useAutocomplete } from '@mui/base/useAutocomplete'; +import { useAutocomplete } from '@mui/material/useAutocomplete'; import { styled } from '@mui/system'; const Label = styled('label')({ diff --git a/docs/data/material/components/autocomplete/UseAutocomplete.tsx b/docs/data/material/components/autocomplete/UseAutocomplete.tsx index 2e30c245fcf5a4..f715826d23386a 100644 --- a/docs/data/material/components/autocomplete/UseAutocomplete.tsx +++ b/docs/data/material/components/autocomplete/UseAutocomplete.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useAutocomplete } from '@mui/base/useAutocomplete'; +import { useAutocomplete } from '@mui/material/useAutocomplete'; import { styled } from '@mui/system'; const Label = styled('label')({ @@ -63,7 +63,7 @@ export default function UseAutocomplete() { {groupedOptions.length > 0 ? ( - {(groupedOptions as typeof top100Films).map((option, index) => { + {groupedOptions.map((option, index) => { const { key, ...optionProps } = getOptionProps({ option, index }); return (
  • diff --git a/docs/data/material/components/autocomplete/UseAutocomplete.tsx.preview b/docs/data/material/components/autocomplete/UseAutocomplete.tsx.preview index 10f7a19d40e215..6bd1f59e445bfe 100644 --- a/docs/data/material/components/autocomplete/UseAutocomplete.tsx.preview +++ b/docs/data/material/components/autocomplete/UseAutocomplete.tsx.preview @@ -4,7 +4,7 @@ {groupedOptions.length > 0 ? ( - {(groupedOptions as typeof top100Films).map((option, index) => { + {groupedOptions.map((option, index) => { const { key, ...optionProps } = getOptionProps({ option, index }); return (
  • From a3adeeaebdb933729249a70b629d6bdc57fe9ab1 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Wed, 18 Dec 2024 14:56:30 +0530 Subject: [PATCH 9/9] fix import --- docs/data/material/components/autocomplete/CustomizedHook.js | 2 +- docs/data/material/components/autocomplete/CustomizedHook.tsx | 3 +-- docs/data/material/components/autocomplete/UseAutocomplete.js | 2 +- docs/data/material/components/autocomplete/UseAutocomplete.tsx | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/data/material/components/autocomplete/CustomizedHook.js b/docs/data/material/components/autocomplete/CustomizedHook.js index 1dedc30e6bf2f6..9098d456b6a53f 100644 --- a/docs/data/material/components/autocomplete/CustomizedHook.js +++ b/docs/data/material/components/autocomplete/CustomizedHook.js @@ -1,6 +1,6 @@ import * as React from 'react'; import PropTypes from 'prop-types'; -import { useAutocomplete } from '@mui/material/useAutocomplete'; +import useAutocomplete from '@mui/material/useAutocomplete'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import { styled } from '@mui/material/styles'; diff --git a/docs/data/material/components/autocomplete/CustomizedHook.tsx b/docs/data/material/components/autocomplete/CustomizedHook.tsx index d6eecca8d35712..68d68ce2e194d0 100644 --- a/docs/data/material/components/autocomplete/CustomizedHook.tsx +++ b/docs/data/material/components/autocomplete/CustomizedHook.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; -import { - useAutocomplete, +import useAutocomplete, { AutocompleteGetTagProps, } from '@mui/material/useAutocomplete'; import CheckIcon from '@mui/icons-material/Check'; diff --git a/docs/data/material/components/autocomplete/UseAutocomplete.js b/docs/data/material/components/autocomplete/UseAutocomplete.js index f715826d23386a..5fb7b6741eb5c6 100644 --- a/docs/data/material/components/autocomplete/UseAutocomplete.js +++ b/docs/data/material/components/autocomplete/UseAutocomplete.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useAutocomplete } from '@mui/material/useAutocomplete'; +import useAutocomplete from '@mui/material/useAutocomplete'; import { styled } from '@mui/system'; const Label = styled('label')({ diff --git a/docs/data/material/components/autocomplete/UseAutocomplete.tsx b/docs/data/material/components/autocomplete/UseAutocomplete.tsx index f715826d23386a..5fb7b6741eb5c6 100644 --- a/docs/data/material/components/autocomplete/UseAutocomplete.tsx +++ b/docs/data/material/components/autocomplete/UseAutocomplete.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useAutocomplete } from '@mui/material/useAutocomplete'; +import useAutocomplete from '@mui/material/useAutocomplete'; import { styled } from '@mui/system'; const Label = styled('label')({