diff --git a/docs/pages/base-ui/api/use-autocomplete.json b/docs/pages/base-ui/api/use-autocomplete.json index bde54693aa8ba3..2e844c577d7da4 100644 --- a/docs/pages/base-ui/api/use-autocomplete.json +++ b/docs/pages/base-ui/api/use-autocomplete.json @@ -1,7 +1,7 @@ { "parameters": { "options": { - "type": { "name": "ReadonlyArray<T>", "description": "ReadonlyArray<T>" }, + "type": { "name": "ReadonlyArray<Value>", "description": "ReadonlyArray<Value>" }, "required": true }, "autoComplete": { "type": { "name": "boolean", "description": "boolean" }, "default": "false" }, @@ -28,8 +28,8 @@ "componentName": { "type": { "name": "string", "description": "string" } }, "defaultValue": { "type": { - "name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>", - "description": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>" + "name": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>", + "description": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>" }, "default": "props.multiple ? [] : null" }, @@ -52,8 +52,8 @@ }, "filterOptions": { "type": { - "name": "(options: T[], state: FilterOptionsState<T>) => T[]", - "description": "(options: T[], state: FilterOptionsState<T>) => T[]" + "name": "(options: Value[], state: FilterOptionsState<Value>) => Value[]", + "description": "(options: Value[], state: FilterOptionsState<Value>) => Value[]" }, "default": "createFilterOptions()" }, @@ -63,17 +63,23 @@ }, "freeSolo": { "type": { "name": "FreeSolo", "description": "FreeSolo" }, "default": "false" }, "getOptionDisabled": { - "type": { "name": "(option: T) => boolean", "description": "(option: T) => boolean" } + "type": { + "name": "(option: Value) => boolean", + "description": "(option: Value) => boolean" + } }, "getOptionLabel": { "type": { - "name": "(option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string", - "description": "(option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string" + "name": "(option: Value | AutocompleteFreeSoloValueMapping<FreeSolo>) => string", + "description": "(option: Value | AutocompleteFreeSoloValueMapping<FreeSolo>) => string" }, "default": "(option) => option.label ?? option" }, "groupBy": { - "type": { "name": "(option: T) => string", "description": "(option: T) => string" } + "type": { + "name": "(option: Value) => string", + "description": "(option: Value) => string" + } }, "handleHomeEndKeys": { "type": { "name": "boolean", "description": "boolean" }, @@ -87,15 +93,15 @@ "inputValue": { "type": { "name": "string", "description": "string" } }, "isOptionEqualToValue": { "type": { - "name": "(option: T, value: T) => boolean", - "description": "(option: T, value: T) => boolean" + "name": "(option: Value, value: Value) => boolean", + "description": "(option: Value, value: Value) => boolean" } }, "multiple": { "type": { "name": "Multiple", "description": "Multiple" }, "default": "false" }, "onChange": { "type": { - "name": "(event: React.SyntheticEvent, value: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void", - "description": "(event: React.SyntheticEvent, value: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void" + "name": "(event: React.SyntheticEvent, value: AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<Value>) => void", + "description": "(event: React.SyntheticEvent, value: AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<Value>) => void" } }, "onClose": { @@ -106,8 +112,8 @@ }, "onHighlightChange": { "type": { - "name": "(event: React.SyntheticEvent, option: T | null, reason: AutocompleteHighlightChangeReason) => void", - "description": "(event: React.SyntheticEvent, option: T | null, reason: AutocompleteHighlightChangeReason) => void" + "name": "(event: React.SyntheticEvent, option: Value | null, reason: AutocompleteHighlightChangeReason) => void", + "description": "(event: React.SyntheticEvent, option: Value | null, reason: AutocompleteHighlightChangeReason) => void" } }, "onInputChange": { @@ -141,8 +147,8 @@ }, "value": { "type": { - "name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>", - "description": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>" + "name": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>", + "description": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>" } } }, @@ -185,8 +191,8 @@ }, "getOptionProps": { "type": { - "name": "(renderedOption: UseAutocompleteRenderedOption<T>) => React.HTMLAttributes<HTMLLIElement>", - "description": "(renderedOption: UseAutocompleteRenderedOption<T>) => React.HTMLAttributes<HTMLLIElement>" + "name": "(renderedOption: UseAutocompleteRenderedOption<Value>) => React.HTMLAttributes<HTMLLIElement>", + "description": "(renderedOption: UseAutocompleteRenderedOption<Value>) => React.HTMLAttributes<HTMLLIElement>" }, "required": true }, @@ -210,8 +216,8 @@ }, "groupedOptions": { "type": { - "name": "T[] | Array<AutocompleteGroupedOption<T>>", - "description": "T[] | Array<AutocompleteGroupedOption<T>>" + "name": "Value[] | Array<AutocompleteGroupedOption<Value>>", + "description": "Value[] | Array<AutocompleteGroupedOption<Value>>" }, "required": true }, @@ -224,8 +230,8 @@ }, "value": { "type": { - "name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>", - "description": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>" + "name": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>", + "description": "AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo>" }, "required": true } diff --git a/docs/pages/joy-ui/api/autocomplete.json b/docs/pages/joy-ui/api/autocomplete.json index 83ff79191c11ab..b04e59237babbc 100644 --- a/docs/pages/joy-ui/api/autocomplete.json +++ b/docs/pages/joy-ui/api/autocomplete.json @@ -28,7 +28,7 @@ "type": { "name": "func" }, "default": "createFilterOptions()", "signature": { - "type": "function(options: Array, state: object) => Array", + "type": "function(options: Array, state: object) => Array", "describedArgs": ["options", "state"] } }, @@ -47,23 +47,23 @@ }, "getOptionDisabled": { "type": { "name": "func" }, - "signature": { "type": "function(option: T) => boolean", "describedArgs": ["option"] } + "signature": { "type": "function(option: Value) => boolean", "describedArgs": ["option"] } }, "getOptionLabel": { "type": { "name": "func" }, "default": "(option) => option.label ?? option", - "signature": { "type": "function(option: T) => string", "describedArgs": [] } + "signature": { "type": "function(option: Value) => string", "describedArgs": [] } }, "groupBy": { "type": { "name": "func" }, - "signature": { "type": "function(options: T) => string", "describedArgs": ["options"] } + "signature": { "type": "function(options: Value) => string", "describedArgs": ["options"] } }, "id": { "type": { "name": "string" } }, "inputValue": { "type": { "name": "string" } }, "isOptionEqualToValue": { "type": { "name": "func" }, "signature": { - "type": "function(option: T, value: T) => boolean", + "type": "function(option: Value, value: Value) => boolean", "describedArgs": ["option", "value"] } }, @@ -76,7 +76,7 @@ "onChange": { "type": { "name": "func" }, "signature": { - "type": "function(event: React.SyntheticEvent, value: T | Array, reason: string, details?: string) => void", + "type": "function(event: React.SyntheticEvent, value: Value | Array, reason: string, details?: string) => void", "describedArgs": ["event", "value", "reason"] } }, @@ -90,7 +90,7 @@ "onHighlightChange": { "type": { "name": "func" }, "signature": { - "type": "function(event: React.SyntheticEvent, option: T, reason: string) => void", + "type": "function(event: React.SyntheticEvent, option: Value, reason: string) => void", "describedArgs": ["event", "option", "reason"] } }, diff --git a/docs/pages/material-ui/api/autocomplete.json b/docs/pages/material-ui/api/autocomplete.json index cef89f6f9a9518..b9747b5eb39412 100644 --- a/docs/pages/material-ui/api/autocomplete.json +++ b/docs/pages/material-ui/api/autocomplete.json @@ -44,7 +44,7 @@ "type": { "name": "func" }, "default": "createFilterOptions()", "signature": { - "type": "function(options: Array, state: object) => Array", + "type": "function(options: Array, state: object) => Array", "describedArgs": ["options", "state"] } }, @@ -62,16 +62,16 @@ }, "getOptionDisabled": { "type": { "name": "func" }, - "signature": { "type": "function(option: T) => boolean", "describedArgs": ["option"] } + "signature": { "type": "function(option: Value) => boolean", "describedArgs": ["option"] } }, "getOptionLabel": { "type": { "name": "func" }, "default": "(option) => option.label ?? option", - "signature": { "type": "function(option: T) => string", "describedArgs": [] } + "signature": { "type": "function(option: Value) => string", "describedArgs": [] } }, "groupBy": { "type": { "name": "func" }, - "signature": { "type": "function(options: T) => string", "describedArgs": ["options"] } + "signature": { "type": "function(options: Value) => string", "describedArgs": ["options"] } }, "handleHomeEndKeys": { "type": { "name": "bool" }, "default": "!props.freeSolo" }, "id": { "type": { "name": "string" } }, @@ -80,7 +80,7 @@ "isOptionEqualToValue": { "type": { "name": "func" }, "signature": { - "type": "function(option: T, value: T) => boolean", + "type": "function(option: Value, value: Value) => boolean", "describedArgs": ["option", "value"] } }, @@ -94,7 +94,7 @@ "onChange": { "type": { "name": "func" }, "signature": { - "type": "function(event: React.SyntheticEvent, value: T | Array, reason: string, details?: string) => void", + "type": "function(event: React.SyntheticEvent, value: Value | Array, reason: string, details?: string) => void", "describedArgs": ["event", "value", "reason"] } }, @@ -108,7 +108,7 @@ "onHighlightChange": { "type": { "name": "func" }, "signature": { - "type": "function(event: React.SyntheticEvent, option: T, reason: string) => void", + "type": "function(event: React.SyntheticEvent, option: Value, reason: string) => void", "describedArgs": ["event", "option", "reason"] } }, diff --git a/docs/translations/api-docs/use-autocomplete/use-autocomplete.json b/docs/translations/api-docs/use-autocomplete/use-autocomplete.json index b07aae431e8b72..09862263d70940 100644 --- a/docs/translations/api-docs/use-autocomplete/use-autocomplete.json +++ b/docs/translations/api-docs/use-autocomplete/use-autocomplete.json @@ -111,7 +111,7 @@ "getRootProps": { "description": "Resolver for the root slot's props." }, "getTagProps": { "description": "A tag props getter." }, "groupedOptions": { - "description": "The options to render. It's either T[] or AutocompleteGroupedOption<T>[] if the groupBy prop is provided." + "description": "The options to render. It's either Value[] or AutocompleteGroupedOption<Value>[] if the groupBy prop is provided." }, "id": { "description": "Id for the Autocomplete." }, "inputValue": { "description": "The input value." }, diff --git a/packages/mui-joy/src/Autocomplete/Autocomplete.tsx b/packages/mui-joy/src/Autocomplete/Autocomplete.tsx index a8e6dd98a6d688..dd9b565d66deec 100644 --- a/packages/mui-joy/src/Autocomplete/Autocomplete.tsx +++ b/packages/mui-joy/src/Autocomplete/Autocomplete.tsx @@ -849,9 +849,9 @@ Autocomplete.propTypes /* remove-proptypes */ = { * A function that determines the filtered options to be rendered on search. * * @default createFilterOptions() - * @param {T[]} options The options to render. + * @param {Value[]} options The options to render. * @param {object} state The state of the component. - * @returns {T[]} + * @returns {Value[]} */ filterOptions: PropTypes.func, /** @@ -875,7 +875,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { /** * Used to determine the disabled state for a given option. * - * @param {T} option The option to test. + * @param {Value} option The option to test. * @returns {boolean} */ getOptionDisabled: PropTypes.func, @@ -885,7 +885,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * * If used in free solo mode, it must accept both the type of the options and a string. * - * @param {T} option + * @param {Value} option * @returns {string} * @default (option) => option.label ?? option */ @@ -894,7 +894,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 {T} options The options to group. + * @param {Value} options The options to group. * @returns {string} */ groupBy: PropTypes.func, @@ -912,8 +912,8 @@ Autocomplete.propTypes /* remove-proptypes */ = { * Uses strict equality by default. * ⚠️ Both arguments need to be handled, an option can only match with one value. * - * @param {T} option The option to test. - * @param {T} value The value to test against. + * @param {Value} option The option to test. + * @param {Value} value The value to test against. * @returns {boolean} */ isOptionEqualToValue: PropTypes.func, @@ -956,7 +956,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * Callback fired when the value changes. * * @param {React.SyntheticEvent} event The event source of the callback. - * @param {T|T[]} value The new value of the component. + * @param {Value|Value[]} value The new value of the component. * @param {string} reason One of "createOption", "selectOption", "removeOption", "blur" or "clear". * @param {string} [details] */ @@ -973,7 +973,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * Callback fired when the highlight option changes. * * @param {React.SyntheticEvent} event The event source of the callback. - * @param {T} option The highlighted option. + * @param {Value} option The highlighted option. * @param {string} reason Can be: `"keyboard"`, `"auto"`, `"mouse"`, `"touch"`. */ onHighlightChange: PropTypes.func, diff --git a/packages/mui-material/src/Autocomplete/Autocomplete.js b/packages/mui-material/src/Autocomplete/Autocomplete.js index 49a8bc6fc5f823..1503154d31a33b 100644 --- a/packages/mui-material/src/Autocomplete/Autocomplete.js +++ b/packages/mui-material/src/Autocomplete/Autocomplete.js @@ -842,9 +842,9 @@ Autocomplete.propTypes /* remove-proptypes */ = { * A function that determines the filtered options to be rendered on search. * * @default createFilterOptions() - * @param {T[]} options The options to render. + * @param {Value[]} options The options to render. * @param {object} state The state of the component. - * @returns {T[]} + * @returns {Value[]} */ filterOptions: PropTypes.func, /** @@ -878,7 +878,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { /** * Used to determine the disabled state for a given option. * - * @param {T} option The option to test. + * @param {Value} option The option to test. * @returns {boolean} */ getOptionDisabled: PropTypes.func, @@ -888,7 +888,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * * If used in free solo mode, it must accept both the type of the options and a string. * - * @param {T} option + * @param {Value} option * @returns {string} * @default (option) => option.label ?? option */ @@ -897,7 +897,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 {T} options The options to group. + * @param {Value} options The options to group. * @returns {string} */ groupBy: PropTypes.func, @@ -926,8 +926,8 @@ Autocomplete.propTypes /* remove-proptypes */ = { * Uses strict equality by default. * ⚠️ Both arguments need to be handled, an option can only match with one value. * - * @param {T} option The option to test. - * @param {T} value The value to test against. + * @param {Value} option The option to test. + * @param {Value} value The value to test against. * @returns {boolean} */ isOptionEqualToValue: PropTypes.func, @@ -975,7 +975,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * Callback fired when the value changes. * * @param {React.SyntheticEvent} event The event source of the callback. - * @param {T|T[]} value The new value of the component. + * @param {Value|Value[]} value The new value of the component. * @param {string} reason One of "createOption", "selectOption", "removeOption", "blur" or "clear". * @param {string} [details] */ @@ -992,7 +992,7 @@ Autocomplete.propTypes /* remove-proptypes */ = { * Callback fired when the highlight option changes. * * @param {React.SyntheticEvent} event The event source of the callback. - * @param {T} option The highlighted option. + * @param {Value} option The highlighted option. * @param {string} reason Can be: `"keyboard"`, `"auto"`, `"mouse"`, `"touch"`. */ onHighlightChange: PropTypes.func,