Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][types] Make slots partial in CreateSlotsAndSlotProptype #42077

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/mui-material/src/Accordion/Accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export interface AccordionSlots {
* The component that renders the heading.
* @default 'h3'
*/
heading?: React.ElementType;
heading: React.ElementType;
/**
* The component that renders the transition.
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Collapse
*/
transition?: React.JSXElementConstructor<
transition: React.JSXElementConstructor<
TransitionProps & { children?: React.ReactElement<unknown, any> }
>;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Alert/Alert.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export interface AlertSlots {
* The component that renders the close button.
* @default IconButton
*/
closeButton?: React.ElementType;
closeButton: React.ElementType;
/**
* The component that renders the close icon.
* @default svg
*/
closeIcon?: React.ElementType;
closeIcon: React.ElementType;
}

export type AlertSlotsAndSlotProps = CreateSlotsAndSlotProps<
Expand Down
6 changes: 3 additions & 3 deletions packages/mui-material/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ export interface AutocompleteSlots {
* The component used to render the listbox.
* @default 'ul'
*/
listbox?: React.JSXElementConstructor<React.HTMLAttributes<HTMLElement>>;
listbox: React.JSXElementConstructor<React.HTMLAttributes<HTMLElement>>;
/**
* The component used to render the body of the popup.
* @default Paper
*/
paper?: React.JSXElementConstructor<PaperProps>;
paper: React.JSXElementConstructor<PaperProps>;
/**
* The component used to position the popup.
* @default Popper
*/
popper?: React.JSXElementConstructor<PopperProps>;
popper: React.JSXElementConstructor<PopperProps>;
}

export type AutocompleteSlotsAndSlotProps<
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/Avatar/Avatar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface AvatarSlots {
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Collapse
*/
img?: React.JSXElementConstructor<React.ImgHTMLAttributes<HTMLImageElement>>;
img: React.JSXElementConstructor<React.ImgHTMLAttributes<HTMLImageElement>>;
}

export interface AvatarPropsVariantOverrides {}
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/AvatarGroup/AvatarGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface AvatarGroupPropsVariantOverrides {}
export interface AvatarGroupComponentsPropsOverrides {}

export interface AvatarGroupSlots {
surplus?: React.ElementType;
surplus: React.ElementType;
}

export type AvatarGroupSlotsAndSlotProps = CreateSlotsAndSlotProps<
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Backdrop/Backdrop.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export interface BackdropSlots {
* The component that renders the root.
* @default 'div'
*/
root?: React.ElementType;
root: React.ElementType;
/**
* The component that renders the transition.
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Fade
*/
transition?: React.JSXElementConstructor<
transition: React.JSXElementConstructor<
TransitionProps & { children: React.ReactElement<unknown, any> }
>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface FormControlLabelSlots {
* This is unused if `disableTypography` is true.
* @default Typography
*/
typography?: React.ElementType;
typography: React.ElementType;
}

export type FormControlLabelSlotsAndSlotProps = CreateSlotsAndSlotProps<
Expand Down
8 changes: 4 additions & 4 deletions packages/mui-material/src/PaginationItem/PaginationItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export interface PaginationItemPropsSizeOverrides {}
export interface PaginationItemPropsColorOverrides {}

export interface PaginationItemSlots {
first?: React.ElementType;
last?: React.ElementType;
next?: React.ElementType;
previous?: React.ElementType;
first: React.ElementType;
last: React.ElementType;
next: React.ElementType;
previous: React.ElementType;
}

export type PaginationItemSlotsAndSlotProps = CreateSlotsAndSlotProps<
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Popover/Popover.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { PopoverClasses } from './popoverClasses';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';

export interface PopoverSlots {
root?: React.ElementType;
paper?: React.ElementType;
root: React.ElementType;
paper: React.ElementType;
}

export type PopoverSlotsAndSlotProps = CreateSlotsAndSlotProps<
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/SpeedDial/SpeedDial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface SpeedDialSlots {
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default {}
*/
transition?: React.JSXElementConstructor<
transition: React.JSXElementConstructor<
TransitionProps & { children: React.ReactElement<unknown, any> }
>;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/StepLabel/StepLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export interface StepLabelSlots {
* The component that renders the label.
* @default span
*/
label?: React.ElementType;
label: React.ElementType;
/**
* The component to render in place of the [`StepIcon`](https://mui.com/material-ui/api/step-icon/).
*/
stepIcon?: React.ElementType<StepIconProps>;
stepIcon: React.ElementType<StepIconProps>;
}

export type StepLabelSlotsAndSlotProps = CreateSlotsAndSlotProps<
Expand Down
10 changes: 5 additions & 5 deletions packages/mui-material/src/TextField/TextField.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ export interface TextFieldSlots {
* The component that renders the input.
* @default OutlinedInput
*/
input?: React.ElementType;
input: React.ElementType;
/**
* The component that renders the input's label.
* @default InputLabel
*/
inputLabel?: React.ElementType;
inputLabel: React.ElementType;
/**
* The html input element.
* @default 'input'
*/
htmlInput?: React.ElementType;
htmlInput: React.ElementType;
/**
* The component that renders the helper text.
* @default FormHelperText
*/
formHelperText?: React.ElementType;
formHelperText: React.ElementType;
/**
* The component that renders the select.
* @default Select
*/
select?: React.ElementType;
select: React.ElementType;
}

export type TextFieldSlotsAndSlotProps<InputPropsType> = CreateSlotsAndSlotProps<
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type CreateSlotsAndSlotProps<Slots, K extends Record<keyof Slots, any>> =
* The components used for each slot inside.
* @default {}
*/
slots?: Slots;
slots?: Partial<Slots>;
/**
* The props used for each slot inside.
* @default {}
Expand Down