diff --git a/packages/rescript-mui-material/src/components/Accordion.res b/packages/rescript-mui-material/src/components/Accordion.res index 0e04bb4f..8924bbbe 100644 --- a/packages/rescript-mui-material/src/components/Accordion.res +++ b/packages/rescript-mui-material/src/components/Accordion.res @@ -13,6 +13,43 @@ type classes = { region?: string, } +type slots = { + /** + * The component that renders the root. + * @default Paper + */ + root?: OverridableComponent.t, + /** + * The component that renders the heading. + * @default 'h3' + */ + heading?: OverridableComponent.t, + /** + * The component that renders the transition. + * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @default Collapse + */ + transition?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the Paper element. + */ + root?: Paper.props, + /** + * Props forwarded to the heading slot. + * By default, the avaible props are based on the h3 element. + */ + heading?: JsxDOM.domProps, + /** + * Props forwarded to the transition slot. + * By default, the avaible props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component. + */ + transition?: Transition.props, +} + type props = { ...Paper.publicProps, /** @@ -50,9 +87,20 @@ type props = { * @param {boolean} expanded The `expanded` state of the accordion. */ onChange?: (ReactEvent.Form.t, bool) => unit, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, /** * The component used for the transition. * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @deprecated Use `slots.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. * @default Collapse */ @as("TransitionComponent") @@ -60,6 +108,7 @@ type props = { /** * Props applied to the transition element. * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component. + * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("TransitionProps") transitionProps?: Transition.props, diff --git a/packages/rescript-mui-material/src/components/AccordionSummary.res b/packages/rescript-mui-material/src/components/AccordionSummary.res index b0d6874d..96a3e3da 100644 --- a/packages/rescript-mui-material/src/components/AccordionSummary.res +++ b/packages/rescript-mui-material/src/components/AccordionSummary.res @@ -17,6 +17,42 @@ type classes = { expandIconWrapper?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default ButtonBase + */ + root?: OverridableComponent.t, + /** + * The component that renders the content slot. + * @default div + */ + content?: OverridableComponent.t, + /** + * The component that renders the expand icon wrapper slot. + * @default div + */ + expandIconWrapper?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component. + */ + root?: ButtonBase.props, + /** + * Props forwarded to the content slot. + * By default, the avaible props are based on a div element. + */ + content?: JsxDOM.domProps, + /** + * Props forwarded to the expand icon wrapper slot. + * By default, the avaible props are based on a div element. + */ + expandIconWrapper?: JsxDOM.domProps, +} + type props = { ...ButtonBase.publicPropsWithOnClick, /** @@ -32,6 +68,16 @@ type props = { * The icon to display as the expand indicator. */ expandIcon?: React.element, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Alert.res b/packages/rescript-mui-material/src/components/Alert.res index 8237f3bc..085b7d5a 100644 --- a/packages/rescript-mui-material/src/components/Alert.res +++ b/packages/rescript-mui-material/src/components/Alert.res @@ -54,11 +54,19 @@ type color = | String(string) type slots = { - closeButton?: React.element, - closeIcon?: React.element, + root?: OverridableComponent.t, + icon?: OverridableComponent.t, + message?: OverridableComponent.t, + action?: OverridableComponent.t, + closeButton?: OverridableComponent.t, + closeIcon?: OverridableComponent.t, } type slotProps = { + root?: Paper.props, + icon?: JsxDOM.domProps, + message?: JsxDOM.domProps, + action?: JsxDOM.domProps, closeButton?: IconButton.props, closeIcon?: SvgIcon.props, } diff --git a/packages/rescript-mui-material/src/components/Autocomplete.res b/packages/rescript-mui-material/src/components/Autocomplete.res index 9faca726..e2b5f806 100644 --- a/packages/rescript-mui-material/src/components/Autocomplete.res +++ b/packages/rescript-mui-material/src/components/Autocomplete.res @@ -165,8 +165,16 @@ external renderInputParamsToTextFieldProps: renderInputParams<'a, 'inputRef> => 'inputRef, > = "%identity" +type slots = { + listbox?: OverridableComponent.t, + paper?: OverridableComponent.t, + popper?: OverridableComponent.t, +} + type slotProps = { + chip?: React.element, clearIndicator?: IconButton.props, + listbox?: JsxDOM.domProps, paper?: Paper.props, popper?: Popper.props, popupIndicator?: IconButton.props, @@ -520,6 +528,11 @@ type autocompleteProps<'value, 'inputRef> = { * @default 'medium' */ size?: size, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, /** * The props used for each slot inside. * @default {} diff --git a/packages/rescript-mui-material/src/components/Avatar.res b/packages/rescript-mui-material/src/components/Avatar.res index c91a1636..811478a7 100644 --- a/packages/rescript-mui-material/src/components/Avatar.res +++ b/packages/rescript-mui-material/src/components/Avatar.res @@ -27,6 +27,21 @@ type imgProps = { // React.ImgHTMLAttributes } +type slots = { + /** + * The component that renders the img slot. + * @default 'img' + */ + img?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the img slot. + */ + img?: JsxDOM.domProps, +} + type props = { ...CommonProps.t, /** @@ -51,8 +66,20 @@ type props = { /** * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image. * It can be used to listen for the loading error event. + * @deprecated Use `slotProps.img` instead. This prop will be removed in v7. */ imgProps?: imgProps, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The `sizes` attribute for the `img` element. */ diff --git a/packages/rescript-mui-material/src/components/AvatarGroup.res b/packages/rescript-mui-material/src/components/AvatarGroup.res index 21d21eb6..a788f36e 100644 --- a/packages/rescript-mui-material/src/components/AvatarGroup.res +++ b/packages/rescript-mui-material/src/components/AvatarGroup.res @@ -18,7 +18,13 @@ type variant = | @as("square") Square | String(string) -type slotProps = {additionalAvatar: Avatar.props} +type slots = { + surplus?: OverridableComponent.t, +} + +type slotProps = { + surplus?: Avatar.props, +} type props = { ...CommonProps.t, @@ -49,6 +55,12 @@ type props = { * @default {} */ slotProps?: slotProps, + /** + * Custom renderer of extraAvatars + * @param {number} surplus number of extra avatars + * @returns {React.element} custom element to display + */ + renderSurplus?: int => React.element, /** * Spacing between avatars. * @default 'medium' diff --git a/packages/rescript-mui-material/src/components/Backdrop.res b/packages/rescript-mui-material/src/components/Backdrop.res index 31b694a0..b110e6b2 100644 --- a/packages/rescript-mui-material/src/components/Backdrop.res +++ b/packages/rescript-mui-material/src/components/Backdrop.res @@ -5,9 +5,15 @@ type classes = { invisible?: string, } -type slots = {@as("Root") root?: React.element} +type slots = { + root?: OverridableComponent.t, + transition?: OverridableComponent.t, +} -type slotProps = {root?: unknown} +type slotProps = { + root?: JsxDOM.domProps, + transition?: Transition.props, +} type props = { ...Fade.publicProps, diff --git a/packages/rescript-mui-material/src/components/Badge.res b/packages/rescript-mui-material/src/components/Badge.res index a0060f3d..a6c653df 100644 --- a/packages/rescript-mui-material/src/components/Badge.res +++ b/packages/rescript-mui-material/src/components/Badge.res @@ -82,8 +82,8 @@ type color = | String(string) type slotProps = { - root?: unknown, - badge?: unknown, + root?: JsxDOM.domProps, + badge?: JsxDOM.domProps, } type badgeSlots = { @@ -91,14 +91,12 @@ type badgeSlots = { * The component that renders the root. * @default 'span' */ - @as("Root") - root?: React.element, + root?: OverridableComponent.t, /** * The component that renders the badge. * @default 'span' */ - @as("Badge") - badge?: React.element, + badge?: OverridableComponent.t, } type overlap = diff --git a/packages/rescript-mui-material/src/components/BottomNavigationAction.res b/packages/rescript-mui-material/src/components/BottomNavigationAction.res index 9363fc0a..18608463 100644 --- a/packages/rescript-mui-material/src/components/BottomNavigationAction.res +++ b/packages/rescript-mui-material/src/components/BottomNavigationAction.res @@ -9,6 +9,30 @@ type classes = { label?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default ButtonBase + */ + root?: OverridableComponent.t, + /** + * The component that renders the label slot. + * @default 'span' + */ + label?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: ButtonBase.props, + /** + * Props forwarded to the label slot. + */ + label?: JsxDOM.domProps, +} + type props<'value> = { ...ButtonBase.publicPropsWithOnClick, /** @@ -37,6 +61,17 @@ type props<'value> = { * The prop defaults to the value (`false`) inherited from the parent BottomNavigation component. */ showLabel?: bool, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Breadcrumbs.res b/packages/rescript-mui-material/src/components/Breadcrumbs.res index 2d180049..dc9a5669 100644 --- a/packages/rescript-mui-material/src/components/Breadcrumbs.res +++ b/packages/rescript-mui-material/src/components/Breadcrumbs.res @@ -9,7 +9,10 @@ type classes = { separator?: string, } -type slots = {@as("CollapsedIcon") collapsedIcon?: React.element} +type slots = { + @as("CollapsedIcon") + collapsedIcon?: OverridableComponent.t, +} type slotProps = { /** diff --git a/packages/rescript-mui-material/src/components/CardActionArea.res b/packages/rescript-mui-material/src/components/CardActionArea.res index 075dedc1..8da62285 100644 --- a/packages/rescript-mui-material/src/components/CardActionArea.res +++ b/packages/rescript-mui-material/src/components/CardActionArea.res @@ -7,6 +7,30 @@ type classes = { focusHighlight?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default ButtonBase + */ + root?: OverridableComponent.t, + /** + * The component that renders the focusHighlight slot. + * @default 'span' + */ + focusHighlight?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: ButtonBase.props, + /** + * Props forwarded to the focusHighlight slot. + */ + focusHighlight?: JsxDOM.domProps, +} + type props = { ...ButtonBase.publicPropsWithOnClick, /** @@ -18,6 +42,17 @@ type props = { * @default false */ disabled?: bool, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/CardHeader.res b/packages/rescript-mui-material/src/components/CardHeader.res index 4752b111..765a4904 100644 --- a/packages/rescript-mui-material/src/components/CardHeader.res +++ b/packages/rescript-mui-material/src/components/CardHeader.res @@ -13,6 +13,66 @@ type classes = { subheader?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default 'div' + */ + root?: OverridableComponent.t, + /** + * The component that renders the avatar slot. + * @default 'div' + */ + avatar?: OverridableComponent.t, + /** + * The component that renders the action slot. + * @default 'div' + */ + action?: OverridableComponent.t, + /** + * The component that renders the content slot. + * @default 'div' + */ + content?: OverridableComponent.t, + /** + * The component that renders the title slot. + * @default Typography + */ + title?: OverridableComponent.t, + /** + * The component that renders the subheader slot. + * @default Typography + */ + subheader?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the avatar slot. + */ + avatar?: JsxDOM.domProps, + /** + * Props forwarded to the action slot. + */ + action?: JsxDOM.domProps, + /** + * Props forwarded to the content slot. + */ + content?: JsxDOM.domProps, + /** + * Props forwarded to the title slot. + */ + title?: Typography.props, + /** + * Props forwarded to the subheader slot. + */ + subheader?: Typography.props, +} + type props = { ...CommonProps.t_NoTitle, /** @@ -46,8 +106,20 @@ type props = { /** * These props will be forwarded to the subheader * (as long as disableTypography is not `true`). + * @deprecated Use `slotProps.subheader` instead. This prop will be removed in v7. */ subheaderTypographyProps?: Typography.props, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ @@ -59,6 +131,7 @@ type props = { /** * These props will be forwarded to the title * (as long as disableTypography is not `true`). + * @deprecated Use `slotProps.title` instead. This prop will be removed in v7. */ titleTypographyProps?: Typography.props, } diff --git a/packages/rescript-mui-material/src/components/Checkbox.res b/packages/rescript-mui-material/src/components/Checkbox.res index 0e1dee5a..2df0fa78 100644 --- a/packages/rescript-mui-material/src/components/Checkbox.res +++ b/packages/rescript-mui-material/src/components/Checkbox.res @@ -13,6 +13,32 @@ type classes = { colorSecondary?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default SwitchBase + */ + root?: OverridableComponent.t, + /** + * The component that renders the input slot. + * @default SwitchBase's input + */ + input?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the div element. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the input slot. + * By default, the avaible props are based on the input element. + */ + input?: JsxDOM.domProps, +} + @unboxed type color = | @as("primary") Primary @@ -128,6 +154,16 @@ type props<'value, 'inputRef> = { * @default 'medium' */ size?: size, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Drawer.res b/packages/rescript-mui-material/src/components/Drawer.res index c2f509bf..da5b01f4 100644 --- a/packages/rescript-mui-material/src/components/Drawer.res +++ b/packages/rescript-mui-material/src/components/Drawer.res @@ -25,6 +25,63 @@ type classes = { modal?: string, } +type slots = { + /** + * The component used for the root when the variant is `temporary`. + * @default Modal + */ + root?: OverridableComponent.t, + /** + * The component used for the Modal backdrop. + * @default Backdrop + */ + backdrop?: OverridableComponent.t, + /** + * The component used for the root element when the variant is `permanent` or `persistent`. + * @default div + */ + docked?: OverridableComponent.t, + /** + * The component used for the paper. + * @default Paper + */ + paper?: OverridableComponent.t, + /** + * The component used for the transition. + * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @default Slide + */ + transition?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the [Modal](https://mui.com/material-ui/api/modal/#props) component. + */ + root?: Modal.props, + /** + * Props forwarded to the backdrop slot. + * By default, the avaible props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component. + */ + backdrop?: Backdrop.props, + /** + * Props forwarded to the docked slot. + * By default, the avaible props are based on a div element. + */ + docked?: JsxDOM.domProps, + /** + * Props forwarded to the paper slot. + * By default, the avaible props are based on the [Paper](https://mui.com/material-ui/api/paper/#props) component. + */ + paper?: Paper.props, + /** + * Props forwarded to the transition slot. + * By default, the avaible props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component. + */ + transition?: Transition.props, +} + type anchor = | @as("left") Left | @as("top") Top @@ -36,7 +93,7 @@ type variant = | @as("persistent") Persistent | @as("temporary") Temporary -type props = { +type publicProps = { ...Modal.publicProps, /** * Side from which the drawer will appear. @@ -76,12 +133,14 @@ type props = { open_?: bool, /** * Props applied to the [`Paper`](/material-ui/api/paper/) element. + * @deprecated use the `slotProps.paper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. * @default {} */ @as("PaperProps") paperProps?: Paper.props, /** * Props applied to the [`Slide`](/material-ui/api/slide/) element. + * @deprecated use the `slotProps.transition` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("SlideProps") slideProps?: Slide.props, @@ -105,5 +164,19 @@ type props = { variant?: variant, } +type props = { + ...publicProps, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, +} + @module("@mui/material/Drawer") external make: React.component = "default" diff --git a/packages/rescript-mui-material/src/components/FormControlLabel.res b/packages/rescript-mui-material/src/components/FormControlLabel.res index e9382952..e43a0e29 100644 --- a/packages/rescript-mui-material/src/components/FormControlLabel.res +++ b/packages/rescript-mui-material/src/components/FormControlLabel.res @@ -19,6 +19,10 @@ type classes = { asterisk?: string, } +type slots = { + typography?: OverridableComponent.t, +} + type slotProps = { /** * Props applied to the Typography wrapper of the passed label. @@ -80,6 +84,11 @@ type props<'value, 'inputRef> = { * If `true`, the label will indicate that the `input` is required. */ required?: bool, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, /** * The props used for each slot inside. * @default {} diff --git a/packages/rescript-mui-material/src/components/InputBase.res b/packages/rescript-mui-material/src/components/InputBase.res index b1f22a0e..5f33ae51 100644 --- a/packages/rescript-mui-material/src/components/InputBase.res +++ b/packages/rescript-mui-material/src/components/InputBase.res @@ -81,13 +81,13 @@ type size = | @as("medium") Medium type slotProps = { - root?: unknown, - input?: unknown, + root?: JsxDOM.domProps, + input?: JsxDOM.domProps, } type slots = { - root?: React.element, - input?: React.element, + root?: OverridableComponent.t, + input?: OverridableComponent.t, } type publicProps<'value, 'inputRef> = { @@ -225,17 +225,6 @@ type publicProps<'value, 'inputRef> = { * The size of the component. */ size?: size, - /** - * The extra props for the slot components. - * You can override the existing props or add new ones. - * @default {} - */ - slotProps?: slotProps, - /** - * The components used for each slot inside. - * @default {} - */ - slots?: slots, /** * Start `InputAdornment` for this component. */ @@ -269,6 +258,17 @@ type props<'value, 'inputRef> = { * You can pull out the new value by accessing `event.target.value` (string). */ onChange?: ReactEvent.Synthetic.t => unit, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/ListItem.res b/packages/rescript-mui-material/src/components/ListItem.res index 58c0a6dd..7317eb41 100644 --- a/packages/rescript-mui-material/src/components/ListItem.res +++ b/packages/rescript-mui-material/src/components/ListItem.res @@ -29,9 +29,9 @@ type alignItems = | @as("flex-start") FlexStart | @as("center") Center -type slotProps = {root?: unknown} +type slotProps = {root?: JsxDOM.domProps} -type slots = {root?: React.element} +type slots = {root?: OverridableComponent.t} type props = { ...CommonProps.t, diff --git a/packages/rescript-mui-material/src/components/ListItemText.res b/packages/rescript-mui-material/src/components/ListItemText.res index f60dac11..3ff7e6a9 100644 --- a/packages/rescript-mui-material/src/components/ListItemText.res +++ b/packages/rescript-mui-material/src/components/ListItemText.res @@ -13,6 +13,39 @@ type classes = { secondary?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default 'div' + */ + root?: OverridableComponent.t, + /** + * The component that renders the primary slot. + * @default Typography + */ + primary?: OverridableComponent.t, + /** + * The component that renders the secondary slot. + * @default Typography + */ + secondary?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the primary slot. + */ + primary?: Typography.props, + /** + * Props forwarded to the secondary slot. + */ + secondary?: Typography.props, +} + type props = { ...CommonProps.t, /** @@ -44,6 +77,7 @@ type props = { /** * These props will be forwarded to the primary typography component * (as long as disableTypography is not `true`). + * @deprecated Use `slotProps.primary` instead. This prop will be removed in v7. */ primaryTypographyProps?: Typography.props, /** @@ -53,8 +87,20 @@ type props = { /** * These props will be forwarded to the secondary typography component * (as long as disableTypography is not `true`). + * @deprecated Use `slotProps.secondary` instead. This prop will be removed in v7. */ secondaryTypographyProps?: Typography.props, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Menu.res b/packages/rescript-mui-material/src/components/Menu.res index 69f7a608..30abce8e 100644 --- a/packages/rescript-mui-material/src/components/Menu.res +++ b/packages/rescript-mui-material/src/components/Menu.res @@ -7,6 +7,24 @@ type classes = { list?: string, } +type slots = { + ...Popover.slots, + /** + * The component used for the list. + * @default MenuList + */ + list?: OverridableComponent.t, +} + +type slotProps = { + ...Popover.slotProps, + /** + * Props forwarded to the list slot. + * By default, the avaible props are based on the [MenuList](https://mui.com/material-ui/api/menu-list/#props) component. + */ + list?: MenuList.props, +} + type props = { ...Popover.publicProps, /** @@ -23,6 +41,7 @@ type props = { disableAutoFocusItem?: bool, /** * Props applied to the [`MenuList`](/material-ui/api/menu-list/) element. + * @deprecated use the `slotProps.list` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. * @default {} */ @as("MenuListProps") @@ -32,6 +51,16 @@ type props = { */ @as("PopoverClasses") popoverClasses?: Popover.classes, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/MobileStepper.res b/packages/rescript-mui-material/src/components/MobileStepper.res index 8909d421..7b7374ef 100644 --- a/packages/rescript-mui-material/src/components/MobileStepper.res +++ b/packages/rescript-mui-material/src/components/MobileStepper.res @@ -27,6 +27,48 @@ type variant = | @as("dots") Dots | @as("progress") Progress +type slots = { + /** + * The component that renders the root slot. + * @default Paper + */ + root?: OverridableComponent.t, + /** + * The component that renders the progress slot. + * @default LinearProgress + */ + progress?: OverridableComponent.t, + /** + * The component that renders the dots slot. + * @default 'div' + */ + dots?: OverridableComponent.t, + /** + * The component that renders the dot slot. + * @default 'div' + */ + dot?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: Paper.props, + /** + * Props forwarded to the progress slot. + */ + progress?: LinearProgress.props, + /** + * Props forwarded to the dots slot. + */ + dots?: JsxDOM.domProps, + /** + * Props forwarded to the dot slot. + */ + dot?: JsxDOM.domProps, +} + type props = { ...Paper.publicProps, /** @@ -53,9 +95,21 @@ type props = { children?: React.element, /** * Props applied to the `LinearProgress` element. + * @deprecated Use `slotProps.progress` instead. This prop will be removed in v7. */ @as("LinearProgressProps") linearProgressProps?: LinearProgress.props, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * A next button element. For instance, it can be a `Button` or an `IconButton`. */ diff --git a/packages/rescript-mui-material/src/components/Modal.res b/packages/rescript-mui-material/src/components/Modal.res index 69e77d6f..eec221e6 100644 --- a/packages/rescript-mui-material/src/components/Modal.res +++ b/packages/rescript-mui-material/src/components/Modal.res @@ -14,12 +14,12 @@ type reason = type onClose = (ReactEvent.Synthetic.t, reason) => unit type slots = { - @as("Root") root?: React.element, - @as("Backdrop") backdrop?: React.element, + root?: OverridableComponent.t, + backdrop?: OverridableComponent.t, } type slotProps = { - root?: unknown, + root?: JsxDOM.domProps, backdrop?: Backdrop.props, } diff --git a/packages/rescript-mui-material/src/components/OutlinedInput.res b/packages/rescript-mui-material/src/components/OutlinedInput.res index a4a89533..00eebac7 100644 --- a/packages/rescript-mui-material/src/components/OutlinedInput.res +++ b/packages/rescript-mui-material/src/components/OutlinedInput.res @@ -33,6 +33,23 @@ type classes = { inputTypeSearch?: string, } +type slots = { + ...InputBase.slots, + /** + * The component that renders the notchedOutline slot. + * @default NotchedOutline + */ + notchedOutline?: OverridableComponent.t, +} + +type slotProps = { + ...InputBase.slotProps, + /** + * Props forwarded to the notchedOutline slot. + */ + notchedOutline?: JsxDOM.domProps, +} + type publicProps<'value, 'inputRef> = { ...InputBase.publicProps<'value, 'inputRef>, /** @@ -58,6 +75,17 @@ type props<'value, 'inputRef> = { * You can pull out the new value by accessing `event.target.value` (string). */ onChange?: ReactEvent.Synthetic.t => unit, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Popover.res b/packages/rescript-mui-material/src/components/Popover.res index 5eb33217..b97a6522 100644 --- a/packages/rescript-mui-material/src/components/Popover.res +++ b/packages/rescript-mui-material/src/components/Popover.res @@ -43,13 +43,25 @@ type reference = | @as("none") None type slots = { - root?: React.element, - paper?: React.element, + root?: OverridableComponent.t, + paper?: OverridableComponent.t, + transition?: OverridableComponent.t, + backdrop?: OverridableComponent.t, } type slotProps = { - root?: unknown, - paper?: unknown, + root?: Modal.props, + paper?: Paper.props, + /** + * Props forwarded to the transition slot. + * By default, the avaible props are based on the [Grow](https://mui.com/material-ui/api/grow/#props) component. + */ + transition?: Transition.props, + /** + * Props forwarded to the backdrop slot. + * By default, the avaible props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component. + */ + backdrop?: Backdrop.props, } type publicProps = { @@ -118,19 +130,6 @@ type publicProps = { */ marginThreshold?: int, onClose?: Modal.onClose, - /** - * The components used for each slot inside. - * - * @default {} - */ - slots?: slots, - /** - * The extra props for the slot components. - * You can override the existing props or add new ones. - * - * @default {} - */ - slotProps?: slotProps, /** * This is the point on the popover which * will attach to the anchor's origin. @@ -171,6 +170,19 @@ type props = { * Override or extend the styles applied to the component. */ classes?: classes, + /** + * The components used for each slot inside. + * + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Popper.res b/packages/rescript-mui-material/src/components/Popper.res index 40a42e39..99d8a944 100644 --- a/packages/rescript-mui-material/src/components/Popper.res +++ b/packages/rescript-mui-material/src/components/Popper.res @@ -67,9 +67,9 @@ type options = { strategy?: strategy, } -type slotProps = {root?: unknown} +type slotProps = {root?: JsxDOM.domProps} -type slots = {root?: React.element} +type slots = {root?: OverridableComponent.t} type props = { ...CommonProps.t, diff --git a/packages/rescript-mui-material/src/components/Radio.res b/packages/rescript-mui-material/src/components/Radio.res index 09465b5b..e9f7eaaf 100644 --- a/packages/rescript-mui-material/src/components/Radio.res +++ b/packages/rescript-mui-material/src/components/Radio.res @@ -11,6 +11,32 @@ type classes = { colorSecondary?: string, } +type slots<'value, 'inputRef> = { + /** + * The component that renders the root slot. + * @default SwitchBase + */ + root?: OverridableComponent.t>, + /** + * The component that renders the input slot. + * @default SwitchBase's input + */ + input?: OverridableComponent.t, +} + +type slotProps<'value, 'inputRef> = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the span element. + */ + root?: Switch.props<'value, 'inputRef>, + /** + * Props forwarded to the input slot. + * By default, the avaible props are based on the input element. + */ + input?: JsxDOM.domProps, +} + @unboxed type color = | @as("primary") Primary @@ -113,6 +139,16 @@ type props<'value, 'inputRef> = { * @default 'medium' */ size?: size, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots<'value, 'inputRef>, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps<'value, 'inputRef>, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Rating.res b/packages/rescript-mui-material/src/components/Rating.res index b2f3fbd6..075ca30a 100644 --- a/packages/rescript-mui-material/src/components/Rating.res +++ b/packages/rescript-mui-material/src/components/Rating.res @@ -47,6 +47,48 @@ type size = | @as("large") Large | String(string) +type slots = { + /** + * The component used for the root slot. + * @default 'span' + */ + root?: OverridableComponent.t, + /** + * The component used for the label slot. + * @default 'label' + */ + label?: OverridableComponent.t, + /** + * The component used for the icon slot. + * @default 'span' + */ + icon?: OverridableComponent.t, + /** + * The component used for the decimal slot. + * @default 'span' + */ + decimal?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the label slot. + */ + label?: JsxDOM.domProps, + /** + * Props forwarded to the icon slot. + */ + icon?: JsxDOM.domProps, + /** + * Props forwarded to the decimal slot. + */ + decimal?: JsxDOM.domProps, +} + type props = { ...CommonProps.t, /** @@ -97,6 +139,7 @@ type props = { icon?: React.element, /** * The component containing the icon. + * @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. * @default function IconContainer(props) { * const { value, ...other } = props, * return , @@ -142,6 +185,17 @@ type props = { * @default 'medium' */ size?: size, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Slider.res b/packages/rescript-mui-material/src/components/Slider.res index 6fa42904..e9754895 100644 --- a/packages/rescript-mui-material/src/components/Slider.res +++ b/packages/rescript-mui-material/src/components/Slider.res @@ -81,25 +81,25 @@ type size = | String(string) type slotProps = { - root?: unknown, - track?: unknown, - rail?: unknown, - thumb?: unknown, - mark?: unknown, - markLabel?: unknown, - valueLabel?: unknown, - input?: unknown, + root?: JsxDOM.domProps, + track?: JsxDOM.domProps, + rail?: JsxDOM.domProps, + thumb?: JsxDOM.domProps, + mark?: JsxDOM.domProps, + markLabel?: JsxDOM.domProps, + valueLabel?: JsxDOM.domProps, + input?: JsxDOM.domProps, } type slots = { - root?: React.element, - track?: React.element, - rail?: React.element, - thumb?: React.element, - mark?: React.element, - markLabel?: React.element, - valueLabel?: React.element, - input?: React.element, + root?: OverridableComponent.t, + track?: OverridableComponent.t, + rail?: OverridableComponent.t, + thumb?: OverridableComponent.t, + mark?: OverridableComponent.t, + markLabel?: OverridableComponent.t, + valueLabel?: OverridableComponent.t, + input?: OverridableComponent.t, } @unboxed diff --git a/packages/rescript-mui-material/src/components/Snackbar.res b/packages/rescript-mui-material/src/components/Snackbar.res index ddcf7885..abd356fa 100644 --- a/packages/rescript-mui-material/src/components/Snackbar.res +++ b/packages/rescript-mui-material/src/components/Snackbar.res @@ -15,6 +15,53 @@ type classes = { anchorOriginBottomLeft?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default 'div' + */ + root?: OverridableComponent.t, + /** + * The component that renders the content slot. + * @default SnackbarContent + */ + content?: OverridableComponent.t, + /** + * The component that renders the clickAwayListener slot. + * @default ClickAwayListener + */ + clickAwayListener?: OverridableComponent.t, + /** + * The component that renders the transition. + * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @default Grow + */ + transition?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the div element. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the content slot. + * By default, the avaible props are based on the [SnackbarContent](https://mui.com/material-ui/api/snackbar-content/#props) component. + */ + content?: SnackbarContent.props, + /** + * Props forwarded to the clickAwayListener slot. + * By default, the avaible props are based on the [ClickAwayListener](https://mui.com/material-ui/api/click-away-listener/#props) component. + */ + clickAwayListener?: JsxDOM.domProps, + /** + * Props applied to the transition element. + * By default, the element is based on the [Grow](https://mui.com/material-ui/api/grow/#props) component. + */ + transition?: Transition.props, +} + type vertical = | @as("top") Top | @as("bottom") Bottom @@ -70,11 +117,13 @@ type props = { classes?: classes, /** * Props applied to the `ClickAwayListener` element. + * @deprecated Use `slotProps.clickAwayListener` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("ClickAwayListenerProps") clickAwayListenerProps?: unknown, /** * Props applied to the [`SnackbarContent`](/material-ui/api/snackbar-content/) element. + * @deprecated Use `slotProps.content` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("ContentProps") contentProps?: SnackbarContent.props, @@ -121,6 +170,16 @@ type props = { * we default to `autoHideDuration / 2` ms. */ resumeHideDuration?: int, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ @@ -128,6 +187,7 @@ type props = { /** * The component used for the transition. * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @deprecated Use `slots.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. * @default Grow */ @as("TransitionComponent") @@ -144,6 +204,7 @@ type props = { /** * Props applied to the transition element. * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component. + * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. * @default {} */ @as("TransitionProps") diff --git a/packages/rescript-mui-material/src/components/SpeedDial.res b/packages/rescript-mui-material/src/components/SpeedDial.res index 35c08e77..9a556ca9 100644 --- a/packages/rescript-mui-material/src/components/SpeedDial.res +++ b/packages/rescript-mui-material/src/components/SpeedDial.res @@ -34,6 +34,31 @@ type openReason = | @as("focus") Focus | @as("mouseEnter") MouseEnter +type slots = { + /** + * The component that renders the root slot. + * @default 'div' + */ + root?: OverridableComponent.t, + /** + * The component that renders the transition. + * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @default Zoom + */ + transition?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the transition slot. + */ + transition?: Transition.props, +} + type props = { ...CommonProps.t, /** @@ -87,6 +112,17 @@ type props = { * The icon to display in the SpeedDial Fab when the SpeedDial is open. */ openIcon?: React.element, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ @@ -94,6 +130,7 @@ type props = { /** * The component used for the transition. * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @deprecated Use `slots.transition` instead. This prop will be removed in v7. * @default Zoom */ @as("TransitionComponent") @@ -110,6 +147,7 @@ type props = { /** * Props applied to the transition element. * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component. + * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. */ @as("TransitionProps") transitionProps?: Transition.props, diff --git a/packages/rescript-mui-material/src/components/SpeedDialAction.res b/packages/rescript-mui-material/src/components/SpeedDialAction.res index 839932c2..d9059122 100644 --- a/packages/rescript-mui-material/src/components/SpeedDialAction.res +++ b/packages/rescript-mui-material/src/components/SpeedDialAction.res @@ -15,6 +15,48 @@ type classes = { tooltipPlacementRight?: string, } +type slots = { + /** + * The component that renders the fab. + * @default Fab + */ + fab?: OverridableComponent.t, + /** + * The component that renders the tooltip. + * @default Tooltip + */ + tooltip?: OverridableComponent.t, + /** + * The component that renders the static tooltip. + * @default 'span' + */ + staticTooltip?: OverridableComponent.t, + /** + * The component that renders the static tooltip label. + * @default 'span' + */ + staticTooltipLabel?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the fab slot. + */ + fab?: Fab.props, + /** + * Props forwarded to the tooltip slot. + */ + tooltip?: Tooltip.props, + /** + * Props forwarded to the static tooltip slot. + */ + staticTooltip?: JsxDOM.domProps, + /** + * Props forwarded to the static tooltip label slot. + */ + staticTooltipLabel?: JsxDOM.domProps, +} + type props = { ...Tooltip.publicProps, /** @@ -23,6 +65,7 @@ type props = { classes?: classes, /** * Props applied to the [`Fab`](/material-ui/api/fab/) component. + * @deprecated Use `slotProps.fab` instead. This prop will be removed in v7. * @default {} */ @as("FabProps") @@ -36,26 +79,41 @@ type props = { * The icon to display in the SpeedDial Fab. */ icon?: React.element, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: Sx.props, /** * `classes` prop applied to the [`Tooltip`](/material-ui/api/tooltip/) element. + * @deprecated Use `slotProps.tooltip.classes` instead. This prop will be removed in v7. */ @as("TooltipClasses") tooltipClasses?: Tooltip.classes, /** * Placement of the tooltip. + * @deprecated Use `slotProps.tooltip.placement` instead. This prop will be removed in v7. * @default 'left' */ tooltipPlacement?: Tooltip.placement, /** * Label to display in the tooltip. + * @deprecated Use `slotProps.tooltip.title` instead. This prop will be removed in v7. */ tooltipTitle?: React.element, /** * Make the tooltip always visible when the SpeedDial is open. + * @deprecated Use `slotProps.tooltip.open` instead. This prop will be removed in v7. * @default false */ tooltipOpen?: bool, diff --git a/packages/rescript-mui-material/src/components/StepContent.res b/packages/rescript-mui-material/src/components/StepContent.res index 9fcec9a6..7b87f785 100644 --- a/packages/rescript-mui-material/src/components/StepContent.res +++ b/packages/rescript-mui-material/src/components/StepContent.res @@ -7,6 +7,22 @@ type classes = { transition?: string, } +type slots = { + /** + * The component that renders the transition slot. + * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @default Collapse + */ + transition?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the transition slot. + */ + transition?: Transition.props, +} + type props = { ...CommonProps.t, /** @@ -17,6 +33,17 @@ type props = { * Override or extend the styles applied to the component. */ classes?: classes, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ @@ -24,6 +51,7 @@ type props = { /** * The component used for the transition. * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. + * @deprecated Use `slots.transition` instead. This prop will be removed in v7. * @default Collapse */ @as("TransitionComponent") @@ -39,6 +67,7 @@ type props = { /** * Props applied to the transition element. * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component. + * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. */ @as("TransitionProps") transitionProps?: Transition.props, diff --git a/packages/rescript-mui-material/src/components/StepLabel.res b/packages/rescript-mui-material/src/components/StepLabel.res index d25fc125..72b5ab9c 100644 --- a/packages/rescript-mui-material/src/components/StepLabel.res +++ b/packages/rescript-mui-material/src/components/StepLabel.res @@ -23,12 +23,16 @@ type classes = { labelContainer?: string, } +type slots = { + label?: OverridableComponent.t, +} + type slotProps = { /** * Props applied to the label element. * @default {} */ - label?: unknown, + label?: Typography.props, } type props = { @@ -54,6 +58,11 @@ type props = { * The optional node to display. */ optional?: React.element, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, /** * The props used for each slot inside. * @default {} diff --git a/packages/rescript-mui-material/src/components/SwipeableDrawer.res b/packages/rescript-mui-material/src/components/SwipeableDrawer.res index 2e3fbe26..47ad4e8b 100644 --- a/packages/rescript-mui-material/src/components/SwipeableDrawer.res +++ b/packages/rescript-mui-material/src/components/SwipeableDrawer.res @@ -4,8 +4,25 @@ type allowSwipeInChildren = | @as(false) False | Func((ReactEvent.Touch.t, Dom.element, Dom.element) => bool) +type slots = { + ...Drawer.slots, + /** + * The component used for the swipeArea slot. + * @default 'div' + */ + swipeArea?: OverridableComponent.t, +} + +type slotProps = { + ...Drawer.slotProps, + /** + * Props forwarded to the swipeArea slot. + */ + swipeArea?: JsxDOM.domProps, +} + type props = { - ...Drawer.props, + ...Drawer.publicProps, /** * If set to true, the swipe event will open the drawer even if the user begins the swipe on one of the drawer's children. * This can be useful in scenarios where the drawer is partially visible. @@ -56,8 +73,20 @@ type props = { * @param {React.SyntheticEvent<{}>} event The event source of the callback. */ onOpen: ReactEvent.Synthetic.t => unit, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The element is used to intercept the touch events on the edge. + * @deprecated Use `slotProps.swipeArea` instead. This prop will be removed in v7. */ @as("SwipeAreaProps") swipeAreaProps?: unknown, diff --git a/packages/rescript-mui-material/src/components/Switch.res b/packages/rescript-mui-material/src/components/Switch.res index 0a42190b..5fcd113e 100644 --- a/packages/rescript-mui-material/src/components/Switch.res +++ b/packages/rescript-mui-material/src/components/Switch.res @@ -27,6 +27,62 @@ type classes = { track?: string, } +type slots = { + /** + * The component that renders the root slot. + * @default 'span' + */ + root?: OverridableComponent.t, + /** + * The component that renders the track slot. + * @default 'span' + */ + track?: OverridableComponent.t, + /** + * The component that renders the thumb slot. + * @default 'span' + */ + thumb?: OverridableComponent.t, + /** + * The component that renders the switchBase slot. + * @default SwitchBase + */ + switchBase?: OverridableComponent.t, // should be SwitchBase.props, but unbound + /** + * The component that renders the switchBase's input slot. + * @default SwitchBaseInput + */ + input?: OverridableComponent.t, // should be SwitchBaseInput.props, but unbound +} + +type slotProps = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the span element. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the track slot. + * By default, the avaible props are based on the span element. + */ + track?: JsxDOM.domProps, + /** + * Props forwarded to the thumb slot. + * By default, the avaible props are based on the span element. + */ + thumb?: JsxDOM.domProps, + /** + * Props forwarded to the switchBase slot. + * By default, the avaible props are based on the internal SwitchBase component. + */ + switchBase?: JsxDOM.domProps, + /** + * Props forwarded to the input slot. + * By default, the avaible props are based on the input element. + */ + input?: JsxDOM.domProps, +} + @unboxed type color = | @as("primary") Primary @@ -127,6 +183,16 @@ type props<'value, 'inputRef> = { * @default 'medium' */ size?: size, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/TablePagination.res b/packages/rescript-mui-material/src/components/TablePagination.res index d8d24033..12b2f798 100644 --- a/packages/rescript-mui-material/src/components/TablePagination.res +++ b/packages/rescript-mui-material/src/components/TablePagination.res @@ -67,6 +67,125 @@ type labelDisplayedRowsArgs = { page: int, } +type actionsSlots = { + /** + * The component used for the first page button. + * @default IconButton + */ + firstButton?: OverridableComponent.t, + /** + * The component used for the last page button. + * @default IconButton + */ + lastButton?: OverridableComponent.t, + /** + * The component used for the next page button. + * @default IconButton + */ + nextButton?: OverridableComponent.t, + /** + * The component used for the previous page button. + * @default IconButton + */ + previousButton?: OverridableComponent.t, +} + +type actionsSlotProps = { + /** + * Props forwarded to the first page button. + */ + firstButton?: IconButton.props, + /** + * Props forwarded to the last page button. + */ + lastButton?: IconButton.props, + /** + * Props forwarded to the next page button. + */ + nextButton?: IconButton.props, + /** + * Props forwarded to the previous page button. + */ + previousButton?: IconButton.props, +} + +type slots = { + /** + * The component that renders the root slot. + * @default TableCell + */ + root?: OverridableComponent.t, + /** + * The component that renders the toolbar slot. + * @default Toolbar + */ + toolbar?: OverridableComponent.t, + /** + * The component that renders the spacer slot. + * @default 'div' + */ + spacer?: OverridableComponent.t, + /** + * The component that renders the selectLabel slot. + * @default 'p' + */ + selectLabel?: OverridableComponent.t, + /** + * The component that renders the select slot. + * @default Select + */ + select?: OverridableComponent.t, + /** + * The component that renders the menuItem slot. + * @default MenuItem + */ + menuItem?: OverridableComponent.t, + /** + * The component that renders the displayedRows slot. + * @default 'p' + */ + displayedRows?: OverridableComponent.t, + /** + * The slots that passed to the actions slot. + */ + actions?: actionsSlots, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: TableCell.props, + /** + * Props forwarded to the toolbar slot. + */ + toolbar?: Toolbar.props, + /** + * Props forwarded to the spacer slot. + */ + spacer?: JsxDOM.domProps, + /** + * Props forwarded to the selectLabel slot. + */ + selectLabel?: JsxDOM.domProps, + /** + * Props forwarded to the select slot. + */ + select?: JsxDOM.domProps, + /** + * Props forwarded to the menuItem slot. + */ + menuItem?: JsxDOM.domProps, + /** + * Props forwarded to the displayedRows slot. + */ + displayedRows?: JsxDOM.domProps, + /** + * Props forwarded to the actions slot. + */ + actions?: actionsSlotProps, +} + type props<'inputRef> = { ...TableCell.publicProps, /** @@ -101,6 +220,7 @@ type props<'inputRef> = { actionsComponent?: React.component, /** * Props applied to the back arrow [`IconButton`](/material-ui/api/icon-button/) component. + * @deprecated Use `slotProps.actions.previousButton` instead. This prop will be removed in v7. */ backIconButtonProps?: IconButton.props, /** @@ -143,6 +263,7 @@ type props<'inputRef> = { labelRowsPerPage?: React.element, /** * Props applied to the next arrow [`IconButton`](/material-ui/api/icon-button/) element. + * @deprecated Use `slotProps.actions.nextButton` instead. This prop will be removed in v7. */ nextIconButtonProps?: IconButton.props, /** @@ -160,10 +281,22 @@ type props<'inputRef> = { rowsPerPageOptions?: array, /** * Props applied to the rows per page [`Select`](/material-ui/api/select/) element. + * @deprecated Use `slotProps.select` instead. This prop will be removed in v7. * @default {} */ @as("SelectProps") selectProps?: Select.props, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * If `true`, show the first-page button. * @default false diff --git a/packages/rescript-mui-material/src/components/TableSortLabel.res b/packages/rescript-mui-material/src/components/TableSortLabel.res index 9216ffae..f0622089 100644 --- a/packages/rescript-mui-material/src/components/TableSortLabel.res +++ b/packages/rescript-mui-material/src/components/TableSortLabel.res @@ -15,6 +15,30 @@ type direction = | @as("asc") Asc | @as("desc") Desc +type slots = { + /** + * The component that renders the root slot. + * @default 'span' + */ + root?: OverridableComponent.t, + /** + * The component that renders the icon slot. + * @default ArrowDownwardIcon + */ + icon?: OverridableComponent.t, +} + +type slotProps = { + /** + * Props forwarded to the root slot. + */ + root?: JsxDOM.domProps, + /** + * Props forwarded to the icon slot. + */ + icon?: JsxDOM.domProps, +} + type props = { ...ButtonBase.publicPropsWithOnClick, /** @@ -47,6 +71,17 @@ type props = { */ @as("IconComponent") iconComponent?: React.component, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/TextField.res b/packages/rescript-mui-material/src/components/TextField.res index 5ea5a762..b80e8d8e 100644 --- a/packages/rescript-mui-material/src/components/TextField.res +++ b/packages/rescript-mui-material/src/components/TextField.res @@ -3,6 +3,72 @@ type classes = { root?: string, } +type slots = { + /** + * The component that renders the root. + * @default FormControl + */ + root?: OverridableComponent.t, + /** + * The component that renders the input. + * @default OutlinedInput + */ + input?: OverridableComponent.t>, + /** + * The component that renders the input's label. + * @default InputLabel + */ + inputLabel?: OverridableComponent.t, + /** + * The html input element. + * @default 'input' + */ + htmlInput?: OverridableComponent.t, + /** + * The component that renders the helper text. + * @default FormHelperText + */ + formHelperText?: OverridableComponent.t, + /** + * The component that renders the select. + * @default Select + */ + select?: OverridableComponent.t>, +} + +type slotProps<'value, 'inputRef> = { + /** + * Props forwarded to the root slot. + * By default, the avaible props are based on the [FormControl](https://mui.com/material-ui/api/form-control/#props) component. + */ + root?: FormControl.props, + /** + * Props forwarded to the input slot. + * By default, the avaible props are based on the [Input](https://mui.com/material-ui/api/input/#props) component. + */ + input?: Input.props<'value, 'inputRef>, + /** + * Props forwarded to the input label slot. + * By default, the avaible props are based on the [InputLabel](https://mui.com/material-ui/api/input-label/#props) component. + */ + inputLabel?: InputLabel.props, + /** + * Props forwarded to the html input slot. + * By default, the avaible props are based on the html input element. + */ + htmlInput?: InputBase.inputBaseComponentProps, + /** + * Props forwarded to the form helper text slot. + * By default, the avaible props are based on the [FormHelperText](https://mui.com/material-ui/api/form-helper-text/#props) component. + */ + formHelperText?: FormHelperText.props, + /** + * Props forwarded to the select slot. + * By default, the avaible props are based on the [Select](https://mui.com/material-ui/api/select/#props) component. + */ + select?: Select.props<'value, 'inputRef>, +} + @unboxed type size = | @as("small") Small @@ -57,6 +123,7 @@ type props<'value, 'inputRef> = { error?: bool, /** * Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element. + * @deprecated Use `slotProps.formHelperText` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("FormHelperTextProps") formHelperTextProps?: FormHelperText.props, @@ -72,11 +139,13 @@ type props<'value, 'inputRef> = { /** * Props applied to the [`InputLabel`](/material-ui/api/input-label/) element. * Pointer events like `onClick` are enabled if and only if `shrink` is `true`. + * @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("InputLabelProps") inputLabelProps?: InputLabel.props, /** * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. + * @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ inputProps?: InputBase.inputBaseComponentProps, /** @@ -84,6 +153,7 @@ type props<'value, 'inputRef> = { * It will be a [`FilledInput`](/material-ui/api/filled-input/), * [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/) * component depending on the `variant` prop value. + * @deprecated Use `slotProps.input` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("InputProps") inputProps_?: Input.props<'value, 'inputRef>, @@ -121,6 +191,7 @@ type props<'value, 'inputRef> = { select?: bool, /** * Props applied to the [`Select`](/material-ui/api/select/) element. + * @deprecated Use `slotProps.select` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details. */ @as("SelectProps") selectProps?: Select.props<'value, 'inputRef>, @@ -128,6 +199,16 @@ type props<'value, 'inputRef> = { * The size of the component. */ size?: size, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, + /** + * The props used for each slot inside. + * @default {} + */ + slotProps?: slotProps<'value, 'inputRef>, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/rescript-mui-material/src/components/Tooltip.res b/packages/rescript-mui-material/src/components/Tooltip.res index a8dc2e24..1c79465c 100644 --- a/packages/rescript-mui-material/src/components/Tooltip.res +++ b/packages/rescript-mui-material/src/components/Tooltip.res @@ -42,15 +42,15 @@ type placement = type slotProps = { popper?: Popper.props, transition?: Transition.props, - tooltip?: unknown, // React.HTMLProps & MUIStyledCommonProps & TooltipComponentsPropsOverrides; - arrow?: unknown, // React.HTMLProps & MUIStyledCommonProps & TooltipComponentsPropsOverrides; + tooltip?: JsxDOM.domProps, // React.HTMLProps & MUIStyledCommonProps & TooltipComponentsPropsOverrides; + arrow?: JsxDOM.domProps, // React.HTMLProps & MUIStyledCommonProps & TooltipComponentsPropsOverrides; } type slots = { - popper?: React.element, - transition?: React.element, - tooltip?: React.element, - arrow?: React.element, + popper?: OverridableComponent.t, + transition?: OverridableComponent.t, + tooltip?: OverridableComponent.t, + arrow?: OverridableComponent.t, } type publicProps = { @@ -162,17 +162,6 @@ type publicProps = { */ @as("PopperProps") popperProps?: Popper.props, - /** - * The extra props for the slot components. - * You can override the existing props or add new ones. - * @default {} - */ - slotProps?: slotProps, - /** - * The components used for each slot inside. - * @default {} - */ - slots?: slots, /** * Tooltip title. Zero-length titles string, undefined, null and false are never displayed. */ @@ -198,6 +187,17 @@ type props = { * Override or extend the styles applied to the component. */ classes?: classes, + /** + * The extra props for the slot components. + * You can override the existing props or add new ones. + * @default {} + */ + slotProps?: slotProps, + /** + * The components used for each slot inside. + * @default {} + */ + slots?: slots, /** * The system prop that allows defining system overrides as well as additional CSS styles. */