Skip to content

Commit

Permalink
Merge branch 'next' into autocomplete-move-to-core
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrookes committed Oct 1, 2020
2 parents bc8332d + 6b81af4 commit 64b8840
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function CustomInputAutocomplete() {
<input
type="text"
{...params.inputProps}
// @ts-expect-error TODO
className={clsx(classes.input, params.inputProps.className)}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default function CustomInputAutocomplete() {
<input
type="text"
{...params.inputProps}
// @ts-expect-error TODO
className={clsx(classes.input, params.inputProps.className)}
/>
</div>
Expand Down
14 changes: 8 additions & 6 deletions packages/material-ui/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { InternalStandardProps as StandardProps } from '@material-ui/core';
import { ChipProps, ChipTypeMap } from '@material-ui/core/Chip';
import { PopperProps } from '@material-ui/core/Popper';
import {
import useAutocomplete, {
AutocompleteChangeDetails,
AutocompleteChangeReason,
AutocompleteCloseReason,
Expand Down Expand Up @@ -36,27 +37,28 @@ export interface AutocompleteRenderInputParams {
disabled: boolean;
fullWidth: boolean;
size: 'small' | undefined;
InputLabelProps: object;
InputLabelProps: ReturnType<ReturnType<typeof useAutocomplete>['getInputLabelProps']>;
InputProps: {
ref: React.Ref<any>;
className: string;
startAdornment: React.ReactNode;
endAdornment: React.ReactNode;
};
inputProps: object;
inputProps: ReturnType<ReturnType<typeof useAutocomplete>['getInputProps']>;
}

export interface AutocompleteProps<
T,
Multiple extends boolean | undefined,
DisableClearable extends boolean | undefined,
FreeSolo extends boolean | undefined
FreeSolo extends boolean | undefined,
ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']
> extends UseAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>,
StandardProps<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'children'> {
/**
* Props applied to the [`Chip`](/api/chip/) element.
*/
ChipProps?: object;
ChipProps?: ChipProps<ChipComponent>;
/**
* Override or extend the styles applied to the component.
*/
Expand Down Expand Up @@ -165,7 +167,7 @@ export interface AutocompleteProps<
/**
* Props applied to the Listbox element.
*/
ListboxProps?: object;
ListboxProps?: ReturnType<ReturnType<typeof useAutocomplete>['getListboxProps']>;
/**
* If `true`, the component is in a loading state.
* @default false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { InputLabelProps } from '@material-ui/core';
import { Autocomplete, AutocompleteProps } from '@material-ui/lab';
import { expectType } from '@material-ui/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ export default function useAutocomplete<
): {
getRootProps: () => React.HTMLAttributes<HTMLDivElement>;
getInputProps: () => React.HTMLAttributes<HTMLInputElement>;
getInputLabelProps: () => React.HTMLAttributes<HTMLLabelElement>;
// We pass `getInputLabelProps()` to `@material-ui/core/InputLabel` which does not implement HTMLLabelElement#color.
getInputLabelProps: () => Omit<React.HTMLAttributes<HTMLLabelElement>, 'color'>;
getClearProps: () => React.HTMLAttributes<HTMLDivElement>;
getPopupIndicatorProps: () => React.HTMLAttributes<HTMLDivElement>;
getTagProps: ({ index }: { index: number }) => React.HTMLAttributes<HTMLDivElement>;
Expand Down

0 comments on commit 64b8840

Please sign in to comment.