Skip to content

Commit

Permalink
[material-ui][InputBase] Deprecate components and componentProps prop…
Browse files Browse the repository at this point in the history
…s for v6 (mui#42093)
  • Loading branch information
ChronicusUA authored and joserodolfofreitas committed Jul 29, 2024
1 parent 2ae43f7 commit fbb38f7
Show file tree
Hide file tree
Showing 45 changed files with 1,114 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,36 @@ The Divider's `light` prop was deprecated, Use `sx={{ opacity : "0.6" }}` (or an
/>
```

## FilledInput

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#filled-input-props) below to migrate the code as described in the following sections:

```bash
npx @mui/codemod@next deprecations/filled-input-props <path>
```

### components

The FilledInput's prop `components` was deprecated in favor of `slots`:

```diff
<FilledInput
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
/>
```

### componentsProps

The FilledInput's prop `componentsProps` was deprecated in favor of `slotProps`:

```diff
<FilledInput
- componentsProps={{ input: { id: 'test-input-id', root: { id: 'test-root-id' } } }}
+ slotProps={{ input: { id: 'test-input-id', root: { id: 'test-root-id' } } }}
/>
```

## FormControlLabel

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#form-control-label-props) below to migrate the code as described in the following sections:
Expand All @@ -1049,6 +1079,66 @@ The FormControlLabel's `componentsProps` prop was deprecated in favor of `slotPr
/>
```

## Input

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#input-props) below to migrate the code as described in the following sections:

```bash
npx @mui/codemod@next deprecations/input-props <path>
```

### components

The Input's prop `components` was deprecated in favor of `slots`:

```diff
<Input
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
/>
```

### componentsProps

The Input's prop `componentsProps` was deprecated in favor of `slotProps`:

```diff
<Input
- componentsProps={{ input: { id: 'test-input-id', root: { id: 'test-root-id' } } }}
+ slotProps={{ input: { id: 'test-input-id', root: { id: 'test-root-id' } } }}
/>
```

## InputBase

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#input-base-props) below to migrate the code as described in the following sections:

```bash
npx @mui/codemod@next deprecations/input-base-props <path>
```

### components

The InputBase's prop `components` was deprecated in favor of `slots`:

```diff
<InputBase
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
/>
```

### componentsProps

The InputBase's prop `componentsProps` was deprecated in favor of `slotProps`:

```diff
<Input
- componentsProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
+ slotProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
/>
```

## ListItem

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#list-item-props) below to migrate the code as described in the following sections:
Expand Down Expand Up @@ -1130,12 +1220,42 @@ The Grid's `wrap` prop was deprecated in favor of `flexWrap` MUI System prop:
/>;
```

## OutlinedInput

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#outlined-input-props) below to migrate the code as described in the following sections:

```bash
npx @mui/codemod@next deprecations/outlined-input-props <path>
```

### components

The OutlinedInput's prop `components` was deprecated in favor of `slots`:

```diff
<OutlinedInput
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
/>
```

### componentsProps

The OutlinedInput's prop `componentsProps` was deprecated in favor of `slotProps`:

```diff
<OutlinedInput
- componentsProps={{ input: { id: 'test-input-id', root: { id: 'test-root-id' } } }}
+ slotProps={{ input: { id: 'test-input-id', root: { id: 'test-root-id' } } }}
/>
```

## PaginationItem

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#pagination-item-classes) below to migrate the code as described in the following sections:

```bash
npx @mui/codemod@latest deprecations/pagination-item-classes <path>
npx @mui/codemod@next deprecations/pagination-item-classes <path>
```

### Composed CSS classes
Expand Down
8 changes: 6 additions & 2 deletions docs/pages/material-ui/api/filled-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
},
"components": {
"type": { "name": "shape", "description": "{ Input?: elementType, Root?: elementType }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slots</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"componentsProps": {
"type": { "name": "shape", "description": "{ input?: object, root?: object }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"defaultValue": { "type": { "name": "any" } },
"disabled": { "type": { "name": "bool" } },
Expand Down
8 changes: 6 additions & 2 deletions docs/pages/material-ui/api/input-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
},
"components": {
"type": { "name": "shape", "description": "{ Input?: elementType, Root?: elementType }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slots</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"componentsProps": {
"type": { "name": "shape", "description": "{ input?: object, root?: object }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"defaultValue": { "type": { "name": "any" } },
"disabled": { "type": { "name": "bool" } },
Expand Down
8 changes: 6 additions & 2 deletions docs/pages/material-ui/api/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
},
"components": {
"type": { "name": "shape", "description": "{ Input?: elementType, Root?: elementType }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slots</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"componentsProps": {
"type": { "name": "shape", "description": "{ input?: object, root?: object }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"defaultValue": { "type": { "name": "any" } },
"disabled": { "type": { "name": "bool" } },
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/material-ui/api/outlined-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
},
"components": {
"type": { "name": "shape", "description": "{ Input?: elementType, Root?: elementType }" },
"default": "{}"
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slots</code> prop instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"defaultValue": { "type": { "name": "any" } },
"disabled": { "type": { "name": "bool" } },
Expand Down
6 changes: 2 additions & 4 deletions docs/translations/api-docs/filled-input/filled-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
"color": {
"description": "The color of the component. It supports both default and custom theme colors, which can be added as shown in the <a href=\"https://mui.com/material-ui/customization/palette/#custom-colors\">palette customization guide</a>. The prop defaults to the value (<code>&#39;primary&#39;</code>) inherited from the parent FormControl component."
},
"components": {
"description": "The components used for each slot inside.<br>This prop is an alias for the <code>slots</code> prop. It&#39;s recommended to use the <code>slots</code> prop instead."
},
"components": { "description": "The components used for each slot inside." },
"componentsProps": {
"description": "The extra props for the slot components. You can override the existing props or add new ones.<br>This prop is an alias for the <code>slotProps</code> prop. It&#39;s recommended to use the <code>slotProps</code> prop instead, as <code>componentsProps</code> will be deprecated in the future."
"description": "The extra props for the slot components. You can override the existing props or add new ones."
},
"defaultValue": {
"description": "The default value. Use when the component is not controlled."
Expand Down
6 changes: 2 additions & 4 deletions docs/translations/api-docs/input-base/input-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
"color": {
"description": "The color of the component. It supports both default and custom theme colors, which can be added as shown in the <a href=\"https://mui.com/material-ui/customization/palette/#custom-colors\">palette customization guide</a>. The prop defaults to the value (<code>&#39;primary&#39;</code>) inherited from the parent FormControl component."
},
"components": {
"description": "The components used for each slot inside.<br>This prop is an alias for the <code>slots</code> prop. It&#39;s recommended to use the <code>slots</code> prop instead."
},
"components": { "description": "The components used for each slot inside." },
"componentsProps": {
"description": "The extra props for the slot components. You can override the existing props or add new ones.<br>This prop is an alias for the <code>slotProps</code> prop. It&#39;s recommended to use the <code>slotProps</code> prop instead, as <code>componentsProps</code> will be deprecated in the future."
"description": "The extra props for the slot components. You can override the existing props or add new ones."
},
"defaultValue": {
"description": "The default value. Use when the component is not controlled."
Expand Down
6 changes: 2 additions & 4 deletions docs/translations/api-docs/input/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
"color": {
"description": "The color of the component. It supports both default and custom theme colors, which can be added as shown in the <a href=\"https://mui.com/material-ui/customization/palette/#custom-colors\">palette customization guide</a>. The prop defaults to the value (<code>&#39;primary&#39;</code>) inherited from the parent FormControl component."
},
"components": {
"description": "The components used for each slot inside.<br>This prop is an alias for the <code>slots</code> prop. It&#39;s recommended to use the <code>slots</code> prop instead."
},
"components": { "description": "The components used for each slot inside." },
"componentsProps": {
"description": "The extra props for the slot components. You can override the existing props or add new ones.<br>This prop is an alias for the <code>slotProps</code> prop. It&#39;s recommended to use the <code>slotProps</code> prop instead, as <code>componentsProps</code> will be deprecated in the future."
"description": "The extra props for the slot components. You can override the existing props or add new ones."
},
"defaultValue": {
"description": "The default value. Use when the component is not controlled."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"color": {
"description": "The color of the component. It supports both default and custom theme colors, which can be added as shown in the <a href=\"https://mui.com/material-ui/customization/palette/#custom-colors\">palette customization guide</a>. The prop defaults to the value (<code>&#39;primary&#39;</code>) inherited from the parent FormControl component."
},
"components": {
"description": "The components used for each slot inside.<br>This prop is an alias for the <code>slots</code> prop. It&#39;s recommended to use the <code>slots</code> prop instead."
},
"components": { "description": "The components used for each slot inside." },
"defaultValue": {
"description": "The default value. Use when the component is not controlled."
},
Expand Down
104 changes: 104 additions & 0 deletions packages/mui-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,32 @@ npx @mui/codemod@next deprecations/circular-progress-classes <path>
npx @mui/codemod@next deprecations/divider-props <path>
```

#### `filled-input-props`

```diff
<FilledInput
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
- componentsProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
+ slotProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
/>
```

```diff
MuiFilledInput: {
defaultProps: {
- components: { Input: CustomInput, Root: CustomRoot }
+ slots: { input: CustomInput, root: CustomRoot },
- componentsProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }
+ slotProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } },
},
},
```

```bash
npx @mui/codemod@next deprecations/filled-input-props <path>
```

#### `form-control-label-props`

```diff
Expand Down Expand Up @@ -1070,6 +1096,58 @@ npx @mui/codemod@next deprecations/list-item-props <path>
npx @mui/codemod@next deprecations/grid-props <path>
```

#### `input-base-props`

```diff
<InputBase
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
- componentsProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
+ slotProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
/>
```

```diff
MuiInputBase: {
defaultProps: {
- components: { Input: CustomInput, Root: CustomRoot }
+ slots: { input: CustomInput, root: CustomRoot },
- componentsProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }
+ slotProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } },
},
},
```

```bash
npx @mui/codemod@next deprecations/input-base-props <path>
```

#### `input-props`

```diff
<Input
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
- componentsProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
+ slotProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
/>
```

```diff
MuiInput: {
defaultProps: {
- components: { Input: CustomInput, Root: CustomRoot }
+ slots: { input: CustomInput, root: CustomRoot },
- componentsProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }
+ slotProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } },
},
},
```

```bash
npx @mui/codemod@next deprecations/input-props <path>
```

#### `pagination-item-classes`

JS transforms:
Expand Down Expand Up @@ -1182,6 +1260,32 @@ npx @mui/codemod@next deprecations/pagination-item-props <path>
npx @mui/codemod@next deprecations/popper-props <path>
```

#### `outlined-input-props`

```diff
<OutlinedInput
- components={{ Input: CustomInput, Root: CustomRoot }}
+ slots={{ input: CustomInput, root: CustomRoot }}
- componentsProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
+ slotProps={{ input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }}
/>
```

```diff
MuiOutlinedInput: {
defaultProps: {
- components: { Input: CustomInput, Root: CustomRoot }
+ slots: { input: CustomInput, root: CustomRoot },
- componentsProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } }
+ slotProps: { input: { id: 'test-input-id' }, root: { id: 'test-root-id' } },
},
},
```

```bash
npx @mui/codemod@next deprecations/outlined-input-props <path>
```

#### `slider-props`

```diff
Expand Down
Loading

0 comments on commit fbb38f7

Please sign in to comment.