@@ -35,8 +35,8 @@ export default function useSlot<
35
35
ExternalSlotProps extends { component ?: React . ElementType } ,
36
36
ExternalForwardedProps extends {
37
37
component ?: React . ElementType ;
38
- components ?: { [ k in T ] ?: React . ElementType } ;
39
- componentsProps ?: {
38
+ slots ?: { [ k in T ] ?: React . ElementType } ;
39
+ slotProps ?: {
40
40
[ k in T ] ?:
41
41
| WithCommonProps < ExternalSlotProps >
42
42
| ( ( ownerState : OwnerState ) => WithCommonProps < ExternalSlotProps > ) ;
@@ -66,7 +66,7 @@ export default function useSlot<
66
66
*/
67
67
ownerState : OwnerState ;
68
68
/**
69
- * The `other` props from the consumer. It has to contain `component`, `components `, and `componentsProps `.
69
+ * The `other` props from the consumer. It has to contain `component`, `slots `, and `slotProps `.
70
70
* The function will use those props to calculate the final leaf component and the returned props.
71
71
*
72
72
* If the slot is not `root`, the rest of the `externalForwardedProps` are neglected.
@@ -80,13 +80,13 @@ export default function useSlot<
80
80
* For overriding the component's ownerState for the slot.
81
81
* This is required for some components that need styling via `ownerState`.
82
82
*
83
- * It is a function because `componentsProps .{slot}` can be a function which has to be resolved first.
83
+ * It is a function because `slotProps .{slot}` can be a function which has to be resolved first.
84
84
*/
85
85
getSlotOwnerState ?: (
86
86
mergedProps : SlotProps &
87
87
ExternalSlotProps &
88
88
ExtractComponentProps <
89
- Exclude < Exclude < ExternalForwardedProps [ 'componentsProps ' ] , undefined > [ T ] , undefined >
89
+ Exclude < Exclude < ExternalForwardedProps [ 'slotProps ' ] , undefined > [ T ] , undefined >
90
90
> ,
91
91
) => SlotOwnerState ;
92
92
/**
@@ -107,14 +107,14 @@ export default function useSlot<
107
107
} = parameters ;
108
108
const {
109
109
component : rootComponent ,
110
- components = { [ name ] : undefined } ,
111
- componentsProps = { [ name ] : undefined } ,
110
+ slots = { [ name ] : undefined } ,
111
+ slotProps = { [ name ] : undefined } ,
112
112
...other
113
113
} = externalForwardedProps ;
114
114
115
- // `componentsProps [name]` can be a callback that receives the component's ` ownerState` .
115
+ // `slotProps [name]` can be a callback that receives the component's ownerState.
116
116
// `resolvedComponentsProps` is always a plain object.
117
- const resolvedComponentsProps = resolveComponentProps ( componentsProps [ name ] , ownerState ) ;
117
+ const resolvedComponentsProps = resolveComponentProps ( slotProps [ name ] , ownerState ) ;
118
118
119
119
const {
120
120
props : { component : slotComponent , ...mergedProps } ,
@@ -143,8 +143,8 @@ export default function useSlot<
143
143
const props = appendOwnerState (
144
144
elementType ,
145
145
{
146
- ...( name === 'root' && ! rootComponent && ! components [ name ] && internalForwardedProps ) ,
147
- ...( name !== 'root' && ! components [ name ] && internalForwardedProps ) ,
146
+ ...( name === 'root' && ! rootComponent && ! slots [ name ] && internalForwardedProps ) ,
147
+ ...( name !== 'root' && ! slots [ name ] && internalForwardedProps ) ,
148
148
...( mergedProps as { className : string } & SlotProps &
149
149
ExternalSlotProps &
150
150
AdditionalProps &
@@ -157,5 +157,5 @@ export default function useSlot<
157
157
finalOwnerState as OwnerState & SlotOwnerState ,
158
158
) ;
159
159
160
- return [ components [ name ] || elementType , props ] as [ ElementType , typeof props ] ;
160
+ return [ slots [ name ] || elementType , props ] as [ ElementType , typeof props ] ;
161
161
}
0 commit comments