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

[TextField] Use deprecatedPropType on the deprecated props #27503

Merged
merged 3 commits into from
Aug 4, 2021
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
4 changes: 2 additions & 2 deletions docs/pages/api-docs/text-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ The `MuiTextField` name can be used for providing [default props](/customization
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). |
| <span class="prop-name">placeholder</span> | <span class="prop-type">string</span> | | The short hint displayed in the input before the user enters a value. |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the label is displayed as required and the `input` element` will be required. |
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display. |
| ~~<span class="prop-name">rows</span>~~ | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | *Deprecated*. Use `minRows` instead<br><br>Number of rows to display when multiline option is set to true. |
| ~~<span class="prop-name">rowsMax</span>~~ | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | *Deprecated*. Use `maxRows` instead<br><br>Maximum number of rows to display. |
| <span class="prop-name">select</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Render a [`Select`](/api/select/) element while passing the Input element to `Select` as `input` parameter. If this option is set you must pass the options of the select as children. |
| <span class="prop-name">SelectProps</span> | <span class="prop-type">object</span> | | Props applied to the [`Select`](/api/select/) element. |
| <span class="prop-name">size</span> | <span class="prop-type">'medium'<br>&#124;&nbsp;'small'</span> | | The size of the text field. |
Expand Down
11 changes: 9 additions & 2 deletions packages/material-ui/src/TextField/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { refType } from '@material-ui/utils';
import deprecatedPropType from '../utils/deprecatedPropType';
import Input from '../Input';
import FilledInput from '../FilledInput';
import OutlinedInput from '../OutlinedInput';
Expand Down Expand Up @@ -334,12 +335,18 @@ TextField.propTypes = {
* Number of rows to display when multiline option is set to true.
* @deprecated Use `minRows` instead.
*/
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
rows: deprecatedPropType(
PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
'Use `minRows` instead',
),
/**
* Maximum number of rows to display.
* @deprecated Use `maxRows` instead.
*/
rowsMax: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
rowsMax: deprecatedPropType(
PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
'Use `maxRows` instead',
),
/**
* Render a [`Select`](/api/select/) element while passing the Input element to `Select` as `input` parameter.
* If this option is set you must pass the options of the select as children.
Expand Down