Skip to content
Merged
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
[system][zero] Consolidate the variants props callback arguments
  • Loading branch information
mnajdova committed Feb 21, 2024
commit 08d1a2ca651fd64f0b366bc06d1aeefdfa8c5b59
4 changes: 2 additions & 2 deletions packages/mui-system/src/createStyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function processStyleArg(callableStyle, { ownerState, ...props }) {
variants.forEach((variant) => {
let isMatch = true;
if (typeof variant.props === 'function') {
isMatch = variant.props({ ownerState, ...props });
isMatch = variant.props({ ownerState, ...props, ...ownerState });
} else {
Object.keys(variant.props).forEach((key) => {
if (ownerState?.[key] !== variant.props[key] && props[key] !== variant.props[key]) {
Expand All @@ -80,7 +80,7 @@ function processStyleArg(callableStyle, { ownerState, ...props }) {
}
result.push(
typeof variant.style === 'function'
? variant.style({ ownerState, ...props })
? variant.style({ ownerState, ...props, ...ownerState })
: variant.style,
);
}
Expand Down