Skip to content

Commit

Permalink
Support spread attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Apr 21, 2023
1 parent 3d92241 commit 1861be3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ export default function transformer(file, api, options) {
let slotPropNodeInserted = false;
let slotsPropNode;
elementPath.node.openingElement.attributes.forEach((attributeNode) => {
if (attributeNode.type !== 'JSXAttribute') {
if (
attributeNode.type !== 'JSXAttribute' &&
attributeNode.type !== 'JSXSpreadAttribute'
) {
return;
}
if (attributeNode.type === 'JSXSpreadAttribute') {
attributeNodes.push(attributeNode);
return;
}
const attributeName = attributeNode.name.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Badge from '@mui/base/Badge';

<Input component={CustomRoot} />;

<Input component={CustomRoot}></Input>;
<Input component={CustomRoot} {...others}></Input>;

<Switch
component={CustomRoot}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Badge from '@mui/base/Badge';

<Input component={CustomRoot} />;

<Input component={CustomRoot}></Input>;
<Input component={CustomRoot} {...others}></Input>;

<Switch
component={CustomRoot}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Badge from '@mui/base/Badge';

<Input slots={{
root: CustomRoot
}}></Input>;
}} {...others}></Input>;

<Switch
slots={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Badge from '@mui/base/Badge';

<Input<typeof CustomRoot> slots={{
root: CustomRoot
}}></Input>;
}} {...others}></Input>;

<Switch<typeof CustomRoot>
slots={{
Expand Down

0 comments on commit 1861be3

Please sign in to comment.