Skip to content

Commit

Permalink
node scripts/migrateComponentClasses.mjs --grep "Autocomplete"
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 11, 2021
1 parent a44dbd7 commit b0d0580
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 96 deletions.
56 changes: 2 additions & 54 deletions packages/material-ui/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ChipProps, ChipTypeMap } from '@material-ui/core/Chip';
import { PopperProps } from '@material-ui/core/Popper';
import { SxProps } from '@material-ui/system';
import { OverridableStringUnion } from '@material-ui/types';
import { AutocompleteClasses } from './autocompleteClasses';
import useAutocomplete, {
AutocompleteChangeDetails,
AutocompleteChangeReason,
Expand Down Expand Up @@ -77,56 +78,7 @@ export interface AutocompleteProps<
/**
* Override or extend the styles applied to the component.
*/
classes?: {
/** Styles applied to the root element. */
root?: string;
/** Styles applied to the root element if `fullWidth={true}`. */
fullWidth?: string;
/** Pseudo-class applied to the root element if focused. */
focused?: string;
/** Styles applied to the tag elements, e.g. the chips. */
tag?: string;
/** Styles applied to the tag elements, e.g. the chips if `size="small"`. */
tagSizeSmall?: string;
/** Styles applied to the tag elements, e.g. the chips if `size="medium"`. */
tagSizeMedium?: string;
/** Styles applied when the popup icon is rendered. */
hasPopupIcon?: string;
/** Styles applied when the clear icon is rendered. */
hasClearIcon?: string;
/** Styles applied to the Input element. */
inputRoot?: string;
/** Styles applied to the input element. */
input?: string;
/** Styles applied to the input element if tag focused. */
inputFocused?: string;
/** Styles applied to the endAdornment element. */
endAdornment?: string;
/** Styles applied to the clear indicator. */
clearIndicator?: string;
/** Styles applied to the popup indicator. */
popupIndicator?: string;
/** Styles applied to the popup indicator if the popup is open. */
popupIndicatorOpen?: string;
/** Styles applied to the popper element. */
popper?: string;
/** Styles applied to the popper element if `disablePortal={true}`. */
popperDisablePortal?: string;
/** Styles applied to the Paper component. */
paper?: string;
/** Styles applied to the listbox component. */
listbox?: string;
/** Styles applied to the loading wrapper. */
loading?: string;
/** Styles applied to the no option wrapper. */
noOptions?: string;
/** Styles applied to the option elements. */
option?: string;
/** Styles applied to the group's label elements. */
groupLabel?: string;
/** Styles applied to the group's ul elements. */
groupUl?: string;
};
classes?: Partial<AutocompleteClasses>;
/**
* The icon to display in place of the default clear icon.
* @default <ClearIcon fontSize="small" />
Expand Down Expand Up @@ -276,10 +228,6 @@ export interface AutocompleteProps<
sx?: SxProps<Theme>;
}

export type AutocompleteClassKey = keyof NonNullable<
AutocompleteProps<any, any, any, any>['classes']
>;

/**
*
* Demos:
Expand Down

This file was deleted.

35 changes: 0 additions & 35 deletions packages/material-ui/src/Autocomplete/autocompleteClasses.js

This file was deleted.

88 changes: 88 additions & 0 deletions packages/material-ui/src/Autocomplete/autocompleteClasses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { generateUtilityClass, generateUtilityClasses } from '@material-ui/unstyled';

export interface AutocompleteClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the root element if `fullWidth={true}`. */
fullWidth: string;
/** Pseudo-class applied to the root element if focused. */
focused: string;
/** Styles applied to the tag elements, e.g. the chips. */
tag: string;
/** Styles applied to the tag elements, e.g. the chips if `size="small"`. */
tagSizeSmall: string;
/** Styles applied to the tag elements, e.g. the chips if `size="medium"`. */
tagSizeMedium: string;
/** Styles applied when the popup icon is rendered. */
hasPopupIcon: string;
/** Styles applied when the clear icon is rendered. */
hasClearIcon: string;
/** Styles applied to the Input element. */
inputRoot: string;
/** Styles applied to the input element. */
input: string;
/** Styles applied to the input element if tag focused. */
inputFocused: string;
/** Styles applied to the endAdornment element. */
endAdornment: string;
/** Styles applied to the clear indicator. */
clearIndicator: string;
/** Styles applied to the popup indicator. */
popupIndicator: string;
/** Styles applied to the popup indicator if the popup is open. */
popupIndicatorOpen: string;
/** Styles applied to the popper element. */
popper: string;
/** Styles applied to the popper element if `disablePortal={true}`. */
popperDisablePortal: string;
/** Styles applied to the Paper component. */
paper: string;
/** Styles applied to the listbox component. */
listbox: string;
/** Styles applied to the loading wrapper. */
loading: string;
/** Styles applied to the no option wrapper. */
noOptions: string;
/** Styles applied to the option elements. */
option: string;
/** Styles applied to the group's label elements. */
groupLabel: string;
/** Styles applied to the group's ul elements. */
groupUl: string;
}

export type AutocompleteClassKey = keyof AutocompleteClasses;

export function getAutocompleteUtilityClass(slot: string): string {
return generateUtilityClass('MuiAutocomplete', slot);
}

const autocompleteClasses: AutocompleteClasses = generateUtilityClasses('MuiAutocomplete', [
'root',
'fullWidth',
'focused',
'focusVisible',
'tag',
'tagSizeSmall',
'tagSizeMedium',
'hasPopupIcon',
'hasClearIcon',
'inputRoot',
'input',
'inputFocused',
'endAdornment',
'clearIndicator',
'popupIndicator',
'popupIndicatorOpen',
'popper',
'popperDisablePortal',
'paper',
'listbox',
'loading',
'noOptions',
'option',
'groupLabel',
'groupUl',
]);

export default autocompleteClasses;

0 comments on commit b0d0580

Please sign in to comment.