@@ -39,8 +39,8 @@ export default function useSlot<
39
39
ExternalSlotProps extends { component ?: React . ElementType } ,
40
40
ExternalForwardedProps extends {
41
41
component ?: React . ElementType ;
42
- components ?: { [ k in T ] ?: React . ElementType } ;
43
- componentsProps ?: {
42
+ slots ?: { [ k in T ] ?: React . ElementType } ;
43
+ slotProps ?: {
44
44
[ k in T ] ?:
45
45
| WithCommonProps < ExternalSlotProps >
46
46
| ( ( ownerState : OwnerState ) => WithCommonProps < ExternalSlotProps > ) ;
@@ -70,7 +70,7 @@ export default function useSlot<
70
70
*/
71
71
ownerState : OwnerState ;
72
72
/**
73
- * The `other` props from the consumer. It has to contain `component`, `components `, and `componentsProps `.
73
+ * The `other` props from the consumer. It has to contain `component`, `slots `, and `slotProps `.
74
74
* The function will use those props to calculate the final leaf component and the returned props.
75
75
*
76
76
* If the slot is not `root`, the rest of the `externalForwardedProps` are neglect.
@@ -84,13 +84,13 @@ export default function useSlot<
84
84
* For overriding the component's ownerState for the slot.
85
85
* This is required for some components that need styling via `ownerState`.
86
86
*
87
- * It is a function because `componentsProps .{slot}` can be a function which has to be resolved first.
87
+ * It is a function because `slotProps .{slot}` can be a function which has to be resolved first.
88
88
*/
89
89
getSlotOwnerState ?: (
90
90
mergedProps : SlotProps &
91
91
ExternalSlotProps &
92
92
ExtractComponentProps <
93
- Exclude < Exclude < ExternalForwardedProps [ 'componentsProps ' ] , undefined > [ T ] , undefined >
93
+ Exclude < Exclude < ExternalForwardedProps [ 'slotProps ' ] , undefined > [ T ] , undefined >
94
94
> ,
95
95
) => SlotOwnerState ;
96
96
/**
@@ -111,14 +111,14 @@ export default function useSlot<
111
111
} = parameters ;
112
112
const {
113
113
component : rootComponent ,
114
- components = { [ name ] : undefined } ,
115
- componentsProps = { [ name ] : undefined } ,
114
+ slots = { [ name ] : undefined } ,
115
+ slotProps = { [ name ] : undefined } ,
116
116
...other
117
117
} = externalForwardedProps ;
118
118
119
- // `componentsProps [name]` can be a callback that receives the component's ownerState.
119
+ // `slotProps [name]` can be a callback that receives the component's ownerState.
120
120
// `resolvedComponentsProps` is always a plain object.
121
- const resolvedComponentsProps = resolveComponentProps ( componentsProps [ name ] , ownerState ) ;
121
+ const resolvedComponentsProps = resolveComponentProps ( slotProps [ name ] , ownerState ) ;
122
122
123
123
const {
124
124
props : { component : slotComponent , ...mergedProps } ,
@@ -147,8 +147,8 @@ export default function useSlot<
147
147
const props = appendOwnerState (
148
148
elementType ,
149
149
{
150
- ...( name === 'root' && ! rootComponent && ! components [ name ] && internalForwardedProps ) ,
151
- ...( name !== 'root' && ! components [ name ] && internalForwardedProps ) ,
150
+ ...( name === 'root' && ! rootComponent && ! slots [ name ] && internalForwardedProps ) ,
151
+ ...( name !== 'root' && ! slots [ name ] && internalForwardedProps ) ,
152
152
...( mergedProps as { className : string } & SlotProps &
153
153
ExternalSlotProps &
154
154
AdditionalProps &
@@ -161,5 +161,5 @@ export default function useSlot<
161
161
finalOwnerState as OwnerState & SlotOwnerState ,
162
162
) ;
163
163
164
- return [ components [ name ] || elementType , props ] as [ ElementType , typeof props ] ;
164
+ return [ slots [ name ] || elementType , props ] as [ ElementType , typeof props ] ;
165
165
}
0 commit comments