Skip to content

Commit

Permalink
[TextField] Use deprecatedPropType on the deprecated props (#27503)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored Aug 4, 2021
1 parent 6014b62 commit f261224
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit f261224

Please sign in to comment.