Skip to content

Commit

Permalink
fix slotProps types
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Jan 9, 2025
1 parent f27138b commit 43ef1a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/pages/material-ui/api/alert.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"slotProps": {
"type": {
"name": "shape",
"description": "{ action?: func<br>&#124;&nbsp;{ component?: elementType, sx?: Array&lt;func<br>&#124;&nbsp;object<br>&#124;&nbsp;bool&gt;<br>&#124;&nbsp;func<br>&#124;&nbsp;object }, closeButton?: func<br>&#124;&nbsp;object, closeIcon?: func<br>&#124;&nbsp;object, icon?: func<br>&#124;&nbsp;object, message?: func<br>&#124;&nbsp;{ component?: elementType, sx?: Array&lt;func<br>&#124;&nbsp;object<br>&#124;&nbsp;bool&gt;<br>&#124;&nbsp;func<br>&#124;&nbsp;object }, root?: func<br>&#124;&nbsp;object }"
"description": "{ action?: func<br>&#124;&nbsp;object, closeButton?: func<br>&#124;&nbsp;object, closeIcon?: func<br>&#124;&nbsp;object, icon?: func<br>&#124;&nbsp;object, message?: func<br>&#124;&nbsp;object, root?: func<br>&#124;&nbsp;object }"
},
"default": "{}"
},
Expand Down
12 changes: 10 additions & 2 deletions packages/mui-material/src/Alert/Alert.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,20 @@ export type AlertSlotsAndSlotProps = CreateSlotsAndSlotProps<
* Props forwarded to the message slot.
* By default, the avaible props are based on a div element.
*/
message: SlotProps<React.ElementType, AlertMessageSlotPropsOverrides, AlertOwnerState>;
message: SlotProps<
React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
AlertMessageSlotPropsOverrides,
AlertOwnerState
>;
/**
* Props forwarded to the action slot.
* By default, the avaible props are based on a div element.
*/
action: SlotProps<React.ElementType, AlertActionSlotPropsOverrides, AlertOwnerState>;
action: SlotProps<
React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
AlertActionSlotPropsOverrides,
AlertOwnerState
>;
/**
* Props forwarded to the closeButton slot.
* By default, the avaible props are based on the [IconButton](https://mui.com/material-ui/api/icon-button/#props) component.
Expand Down
28 changes: 2 additions & 26 deletions packages/mui-material/src/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,35 +373,11 @@ Alert.propTypes /* remove-proptypes */ = {
* @default {}
*/
slotProps: PropTypes.shape({
action: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
component: PropTypes.elementType,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool]),
),
PropTypes.func,
PropTypes.object,
]),
}),
]),
action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
closeButton: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
closeIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
message: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
component: PropTypes.elementType,
sx: PropTypes.oneOfType([
PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool]),
),
PropTypes.func,
PropTypes.object,
]),
}),
]),
message: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
}),
/**
Expand Down

0 comments on commit 43ef1a1

Please sign in to comment.