-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[material-ui][SpeedDialAction] Add slots and slotProps (#45065)
- Loading branch information
Showing
14 changed files
with
862 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/mui-codemod/src/deprecations/speed-dial-action-props/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './speed-dial-action-props'; |
52 changes: 52 additions & 0 deletions
52
packages/mui-codemod/src/deprecations/speed-dial-action-props/speed-dial-action-props.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import movePropIntoSlotProps from '../utils/movePropIntoSlotProps'; | ||
|
||
/** | ||
* @param {import('jscodeshift').FileInfo} file | ||
* @param {import('jscodeshift').API} api | ||
*/ | ||
export default function transformer(file, api, options) { | ||
const j = api.jscodeshift; | ||
const root = j(file.source); | ||
const printOptions = options.printOptions; | ||
|
||
movePropIntoSlotProps(j, { | ||
root, | ||
componentName: 'SpeedDialAction', | ||
propName: 'tooltipTitle', | ||
slotName: 'tooltip', | ||
slotPropName: 'title', | ||
}); | ||
|
||
movePropIntoSlotProps(j, { | ||
root, | ||
componentName: 'SpeedDialAction', | ||
propName: 'tooltipPlacement', | ||
slotName: 'tooltip', | ||
slotPropName: 'placement', | ||
}); | ||
|
||
movePropIntoSlotProps(j, { | ||
root, | ||
componentName: 'SpeedDialAction', | ||
propName: 'tooltipOpen', | ||
slotName: 'tooltip', | ||
slotPropName: 'open', | ||
}); | ||
|
||
movePropIntoSlotProps(j, { | ||
root, | ||
componentName: 'SpeedDialAction', | ||
propName: 'TooltipClasses', | ||
slotName: 'tooltip', | ||
slotPropName: 'classes', | ||
}); | ||
|
||
movePropIntoSlotProps(j, { | ||
root, | ||
componentName: 'SpeedDialAction', | ||
propName: 'FabProps', | ||
slotName: 'fab', | ||
}); | ||
|
||
return root.toSource(printOptions); | ||
} |
16 changes: 16 additions & 0 deletions
16
...ages/mui-codemod/src/deprecations/speed-dial-action-props/speed-dial-action-props.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { describeJscodeshiftTransform } from '../../../testUtils'; | ||
import transform from './speed-dial-action-props'; | ||
|
||
describe('@mui/codemod', () => { | ||
describe('deprecations', () => { | ||
describeJscodeshiftTransform({ | ||
transform, | ||
transformName: 'speed-dial-action-props', | ||
dirname: __dirname, | ||
testCases: [ | ||
{ actual: '/test-cases/actual.js', expected: '/test-cases/expected.js' }, | ||
{ actual: '/test-cases/theme.actual.js', expected: '/test-cases/theme.expected.js' }, | ||
], | ||
}); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
packages/mui-codemod/src/deprecations/speed-dial-action-props/test-cases/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import SpeedDialAction from '@mui/material/SpeedDialAction'; | ||
import { SpeedDialAction as MySpeedDialAction } from '@mui/material'; | ||
|
||
<SpeedDialAction tooltipTitle="test" />; | ||
<SpeedDialAction tooltipOpen={true} />; | ||
<SpeedDialAction tooltipPlacement="test" />; | ||
<SpeedDialAction TooltipClasses={TooltipClasses} />; | ||
<SpeedDialAction FabProps={FabProps} />; | ||
<SpeedDialAction | ||
TooltipClasses={TooltipClasses} | ||
tooltipOpen={true} | ||
tooltipPlacement="top" | ||
tooltipTitle="test" | ||
/>; | ||
<SpeedDialAction | ||
TooltipClasses={TooltipClasses} | ||
tooltipOpen={true} | ||
tooltipPlacement="top" | ||
tooltipTitle="test" | ||
FabProps={FabProps} | ||
/>; | ||
<MySpeedDialAction tooltipTitle="test" />; | ||
<MySpeedDialAction tooltipOpen={true} />; | ||
<MySpeedDialAction tooltipPlacement="test" />; | ||
<MySpeedDialAction TooltipClasses={TooltipClasses} />; | ||
<MySpeedDialAction FabProps={FabProps} />; | ||
<MySpeedDialAction | ||
TooltipClasses={TooltipClasses} | ||
tooltipOpen={true} | ||
tooltipPlacement="top" | ||
tooltipTitle="test" | ||
FabProps={FabProps} | ||
/>; |
Oops, something went wrong.