From f261224e9bd8ea3ca127923234d66181b0ecf3c0 Mon Sep 17 00:00:00 2001 From: Marija Najdova Date: Wed, 4 Aug 2021 14:31:04 +0200 Subject: [PATCH] [TextField] Use deprecatedPropType on the deprecated props (#27503) --- docs/pages/api-docs/text-field.md | 4 ++-- packages/material-ui/src/TextField/TextField.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/pages/api-docs/text-field.md b/docs/pages/api-docs/text-field.md index 67ba8828cddeb9..a7f937417175a2 100644 --- a/docs/pages/api-docs/text-field.md +++ b/docs/pages/api-docs/text-field.md @@ -81,8 +81,8 @@ The `MuiTextField` name can be used for providing [default props](/customization | onChange | func | | Callback fired when the value is changed.

**Signature:**
`function(event: object) => void`
*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). | | placeholder | string | | The short hint displayed in the input before the user enters a value. | | required | bool | false | If `true`, the label is displayed as required and the `input` element` will be required. | -| rows | number
| string
| | Number of rows to display when multiline option is set to true. | -| rowsMax | number
| string
| | Maximum number of rows to display. | +| ~~rows~~ | number
| string
| | *Deprecated*. Use `minRows` instead

Number of rows to display when multiline option is set to true. | +| ~~rowsMax~~ | number
| string
| | *Deprecated*. Use `maxRows` instead

Maximum number of rows to display. | | select | bool | false | 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. | | SelectProps | object | | Props applied to the [`Select`](/api/select/) element. | | size | 'medium'
| 'small'
| | The size of the text field. | diff --git a/packages/material-ui/src/TextField/TextField.js b/packages/material-ui/src/TextField/TextField.js index 9c63102c08db5f..d78c5ac01ef7c6 100644 --- a/packages/material-ui/src/TextField/TextField.js +++ b/packages/material-ui/src/TextField/TextField.js @@ -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'; @@ -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.