Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Remove baseSwitch #12439

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions docs/pages/x/api/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,6 @@
"default": "Select",
"class": null
},
{
"name": "baseSwitch",
"description": "The custom Switch component used in the grid.",
"default": "Switch",
"class": null
},
{
"name": "baseButton",
"description": "The custom Button component used in the grid.",
Expand Down
6 changes: 0 additions & 6 deletions docs/pages/x/api/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,6 @@
"default": "Select",
"class": null
},
{
"name": "baseSwitch",
"description": "The custom Switch component used in the grid.",
"default": "Switch",
"class": null
},
{
"name": "baseButton",
"description": "The custom Button component used in the grid.",
Expand Down
6 changes: 0 additions & 6 deletions docs/pages/x/api/data-grid/data-grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,6 @@
"default": "Select",
"class": null
},
{
"name": "baseSwitch",
"description": "The custom Switch component used in the grid.",
"default": "Switch",
"class": null
},
{
"name": "baseButton",
"description": "The custom Button component used in the grid.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,6 @@
"basePopper": "The custom Popper component used in the grid.",
"baseSelect": "The custom Select component used in the grid.",
"baseSelectOption": "The custom SelectOption component used in the grid.",
"baseSwitch": "The custom Switch component used in the grid.",
"baseTextField": "The custom TextField component used in the grid.",
"baseTooltip": "The custom Tooltip component used in the grid.",
"booleanCellFalseIcon": "Icon displayed on the boolean cell to represent the false value.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,6 @@
"basePopper": "The custom Popper component used in the grid.",
"baseSelect": "The custom Select component used in the grid.",
"baseSelectOption": "The custom SelectOption component used in the grid.",
"baseSwitch": "The custom Switch component used in the grid.",
"baseTextField": "The custom TextField component used in the grid.",
"baseTooltip": "The custom Tooltip component used in the grid.",
"booleanCellFalseIcon": "Icon displayed on the boolean cell to represent the false value.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@
"basePopper": "The custom Popper component used in the grid.",
"baseSelect": "The custom Select component used in the grid.",
"baseSelectOption": "The custom SelectOption component used in the grid.",
"baseSwitch": "The custom Switch component used in the grid.",
"baseTextField": "The custom TextField component used in the grid.",
"baseTooltip": "The custom Tooltip component used in the grid.",
"booleanCellFalseIcon": "Icon displayed on the boolean cell to represent the false value.",
Expand Down
53 changes: 0 additions & 53 deletions packages/x-data-grid/src/joy/joySlots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import JoyFormControl from '@mui/joy/FormControl';
import JoyFormLabel from '@mui/joy/FormLabel';
import JoyButton from '@mui/joy/Button';
import JoyIconButton from '@mui/joy/IconButton';
import JoySwitch, { SwitchProps as JoySwitchProps } from '@mui/joy/Switch';
import JoySelect, { SelectProps as JoySelectProps } from '@mui/joy/Select';
import JoyOption, { OptionProps as JoyOptionProps } from '@mui/joy/Option';
import JoyBox from '@mui/joy/Box';
Expand Down Expand Up @@ -150,57 +149,6 @@ const IconButton = React.forwardRef<
);
});

const Switch = React.forwardRef<any, GridSlotProps['baseSwitch']>(function Switch(
{
name,
checkedIcon,
color: colorProp,
disableRipple,
disableFocusRipple,
disableTouchRipple,
edge,
icon,
inputProps,
inputRef,
size,
sx,
onChange,
onClick,
...props
},
ref,
) {
return (
<JoySwitch
{...(props as JoySwitchProps)}
onChange={onChange as JoySwitchProps['onChange']}
size={convertSize(size)}
color={convertColor(colorProp)}
ref={ref}
slotProps={{
input: {
...inputProps,
name,
onClick: onClick as React.JSX.IntrinsicElements['input']['onClick'],
ref: inputRef,
},
thumb: {
children: icon,
},
}}
sx={
[
{
...(edge === 'start' && { ml: '-8px' }),
...(edge === 'end' && { mr: '-8px' }),
},
...(Array.isArray(sx) ? sx : [sx]),
] as SxProps<Theme>
}
/>
);
});

const Select = React.forwardRef<any, GridSlotProps['baseSelect']>(
(
{
Expand Down Expand Up @@ -430,7 +378,6 @@ const joySlots: Partial<GridSlotsComponent> = {
baseTextField: TextField,
baseButton: Button,
baseIconButton: IconButton,
baseSwitch: Switch,
baseSelect: Select,
baseSelectOption: Option,
baseInputLabel: InputLabel,
Expand Down
2 changes: 0 additions & 2 deletions packages/x-data-grid/src/material/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import MUICheckbox from '@mui/material/Checkbox';
import MUITextField from '@mui/material/TextField';
import MUIFormControl from '@mui/material/FormControl';
import MUISelect from '@mui/material/Select';
import MUISwitch from '@mui/material/Switch';
import MUIButton from '@mui/material/Button';
import MUIIconButton from '@mui/material/IconButton';
import MUIInputAdornment from '@mui/material/InputAdornment';
Expand Down Expand Up @@ -86,7 +85,6 @@ const materialSlots: GridBaseSlots & GridIconSlotsComponent = {
baseTextField: MUITextField,
baseFormControl: MUIFormControl,
baseSelect: MUISelect,
baseSwitch: MUISwitch,
baseButton: MUIButton,
baseIconButton: MUIIconButton,
baseInputAdornment: MUIInputAdornment,
Expand Down
5 changes: 0 additions & 5 deletions packages/x-data-grid/src/models/gridSlotsComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ export interface GridBaseSlots {
* @default Select
*/
baseSelect: React.JSXElementConstructor<GridSlotProps['baseSelect']>;
/**
* The custom Switch component used in the grid.
* @default Switch
*/
baseSwitch: React.JSXElementConstructor<GridSlotProps['baseSwitch']>;
/**
* The custom Button component used in the grid.
* @default Button
Expand Down
Loading